[osg-users] transforming normals

Paul Melis paul at science.uva.nl
Fri Mar 20 09:03:09 PDT 2009


Paul Melis wrote:
> Can Hosgor wrote:
>> I'm writing a simple nodevisitor to compute the lightmap of a given 
>> node. This nodevisitor treats transforms and geodes specially, so 
>> that each vertex in the geometry is multiplied with the most recent 
>> transform matrix in order to obtain world coordinates. So far the 
>> above code works well except that i don't know how to transform the 
>> normals. Can I obtain the normal matrix directly from the 
>> transformation matrix, if so how?   
> If M is your transformation matrix then (M^-1)^T transforms your 
> normals (that's the transposed inverse of M).
You might have to rescale your normals so they become unit length again, 
after using the above matrix

Paul



More information about the osg-users mailing list