Storing Normals faster/easier Idea

Started by
14 comments, last by eq 18 years, 7 months ago
if you have a matrix that represents a rotation for the object, how do you extrapolate the necessarey information to do the two additions for this "simple" rotation of normal? seems to me there's as much math needed there to detract it as an alternative to a matrix multiplicaition issue. a 2-d lookup table seems nice, but like I said before I'd think it would need to be rather large to get good results, for mobile devices space is a premium I'd think. I guess you'd have to impliment it to be sure.
Advertisement
Quote:if you have a matrix that represents a rotation for the object, how do you extrapolate the necessarey information to do the two additions for this "simple" rotation of normal? seems to me there's as much math needed there to detract it as an alternative to a matrix multiplicaition issue


clearly not... with the normal method, you need one 3*3matrix/vector multiplication per vertex to rotate the normals.
here, you only need to convert the matrix to the theta/phi offsets once per transformation matrix (that is, once per _object_ for non skinned meshes, once per bone for vertex skinned ones), and to perform two additions per vertex.

and the amount of maths needed is quite small indeed: matrix to euler conversion, then you can go from euler to theta/phi angles directly with no further computations.
oops, sorry, there was supposed to be a link in the previous post: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToEuler/
your right I wasn't thinking, I was thinking you'd have to do it for every normal. I guess the real question here is, how big of a lookup table is necessary to get reasonable results? 360*180 would definitly suffice I'd think, perhaps make it even smaller by introducing interpolation, however like I said before any interpolation might offset speed.
how do you get to theta phi with no aditional computation?
If you're doing SW rendering and you're using the normals for lighting I'd suggest that you rotate the light into object space and then performing the lighting.
Usually the number of lights is alot smaller than the number of vertices, hence it's faster to transform the light once per frame per object.
Just a tip.

This topic is closed to new replies.

Advertisement