Page 1 of 1

Normal transform question

Posted: Thu May 19, 2005 10:47 pm
by EladarGL
Im exporting normals very well.. but when i transform (rotate) the 3d figure, normals isnt transformed. I tried transform them whit getMatrix() of the figure. However, it is not correct way, because normals are transformed in the wrong way. How can i transform normals in the correct way when i rotate the figure? Thx for reply

Posted: Mon May 23, 2005 7:54 am
by Brandano
Vertex normals are defined as vectors with an origin set at 0,0,0 and a length of 1, so when you apply a transform matrix to them you must remember that:
1-they mustn't be translated
2-they mustn't be scaled
So if you want to apply transforms to them you must obtain the rotation part of the transform matrix (easy) and remove from it the scaling info (a bit harder). If the scaling is uniform you can just apply the rotation and normalize the vector back to alength of one, otherwise you will need quite a bit of mathematics that at the moment I am unable to help you with. My suggestion would be to apply your transformations within Blender before exporting, as he does all these calculations for you and recalculates the normals internally. You can copy the mesh to a new object, export that one and delete it, so that the original scene will be left unchanged.