All i did was invert the view matrix and took out the translation part of the matrix, so it should only "orientate" not translate.

If you want, implement it and tell me what it does, im curious.

[EDIT] i tested it it works. Maybe someone would like to post a method that doesnt take matrix inversion?[/EDIT]

Reedbeta
—
2010-02-04T07:35:22Z —
#3

With the view matrix you should be able to invert it by taking the transpose, because it's orthonormal. Regardless, though, don't worry about the expense of the inversion; this is only done once per frame so it'll never even show up on a profile. Now if you were doing it 1000 times per frame I'd start worrying.

With the view matrix you should be able to invert it by taking the transpose, because it's orthonormal. Regardless, though, don't worry about the expense of the inversion; this is only done once per frame so it'll never even show up on a profile. Now if you were doing it 1000 times per frame I'd start worrying.

I don't understand what you mean , can you show an example?

Reedbeta
—
2010-02-04T21:13:11Z —
#5

Which part of my post are you confused about - inverting by taking the transpose? Basically, if a matrix contains a pure rotation, no scaling or translation, it satisfies a condition called orthonormality. Don't worry too much about the mathematical definition; the practical consequence is that for matrices of this kind, their inverse is provably equal to their transpose. Since the transpose is cheap it's useful to substitute it for the inverse in cases where you know the matrix to be orthonormal.

Note that for 4x4 matrices, the transpose/inverse equivalence strictly speaking applies only when the translation part of the matrix is zero. You can also use this property to speed up inversion when there is a nonzero translation but I'll leave that as an exercise for the reader.