Re: [osg-users] transforming normals

2009-03-21 Thread Can Hosgor
Thanks, I will try it as soon as possible

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8879#8879





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


[osg-users] transforming normals

2009-03-20 Thread Can Hosgor
Hi,

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?

Thank you,
Can

--
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=8857#8857





___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] transforming normals

2009-03-20 Thread Paul Melis

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
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] transforming normals

2009-03-20 Thread Paul Melis

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).


Paul
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org