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.
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.
http://developer.amd.com/tools-and-sdks/graphics-development/gpu-shaderanalyzer/
Peiople who talk threads. I like it.