pouët.net

Go to bottom

on computational complexity of quaternions.

category: general [glöplog]
 
Thinking of doing lots of quaternion rotations in glsl. Likely a lot of slerp() linear interpolation of a vector being rotated by fractions of the same quaternion.

Even though quaternion multiplication is a single multiply instruction: Vec4 quaternionmult( q1,q2) = a.xyzw * b.xyzw it is computationally more complex than a cross product because its 16 scalar mults and 12adds. The vec4 is of a different type, replacing dotproduct syntax with quaternion multiplication, that is a different function.

Doable in parallel but 4resulting terms each have 4mult and 3add.

So I assume that quaternion multiplication is not pipelined to be done within 1tick.
Is that assumption correct?

Does the compiler at least utilize mad() for quaternion multiplication or can I be more implicit on using mad.

Would fmad ()make sense within explicit rough quaternion rotation or would I have to normalize my rounded result too much.

How well do all the quaternion functions pipeline in glsl and have any benchmarks been done that compare 2 variants of the same quaternion function.

It gets more tricky with dual quaternions and quaternion division.

A lot of people write too general math instructions on quaternions that are just too obfuscating, unlike clear glsl instructions. And that's not just due to preference but due to complex numbers in the general terms.
added on the 2016-04-07 13:12:01 by ollj ollj
http://developer.amd.com/tools-and-sdks/graphics-development/gpu-shaderanalyzer/
added on the 2016-04-10 21:13:57 by MsK` MsK`
Peiople who talk threads. I like it.
added on the 2016-04-11 00:28:34 by Optimus Optimus

login

Go to top