People‎ > ‎John Stavrakakis‎ > ‎John's blog‎ > ‎

### Revisiting camera transformation

posted 1 Nov 2011, 00:24 by John Stavrakakis
 Moving between coordinate frames of camera and world space. I found that I was doing way too much when trying to find a single vector, V (of UVN space) from the full transformation matrix. The simplification comes from the substitution of zeroes for the algebra of matrix-vec multiply:Let v' be the vector in world space, v = [0 1 0 0], M a 4x4 transformation matrix. Normally we require: v' = Mv4 mults, 3 adds for each row column pair --> 16 mults, 12 adds, 4 assignment operations.substituting zeroes v' = | 0 * m0  +   1 * m1  +   0 * m2  +   0 * m3 || 0 * m4  +   1 * m5  +   0 * m6  +   0 * m7 || 0 * m8  +   1 * m9  +   0 * m10  + 0 * m11 || 0 * m12  + 1 * m13  +  0 * m14  + 0 * m15 |=|  m1  ||  m5  ||  m9  ||   0    |3 assignment ops!Normalise this and the same result as previously obtained! Note that we can only do this since it is a vector, not a vertex. The full transformation, involving translation, is not necessary.I'm sure this speedup will save many trees/babies. Xcode crashing consistently everyday since last post. Am I using it wrong? :P