Hi,
I believe osg_NormalMatrix may be being calculated incorrectly in the trunk
version of OSG. At present, it is calculated as the inverse 3x3 of the
modelview matrix, but should be the transpose inverse. The patch below appears
to correct this.
To test, try running osgsimplegl3 cow.osg. You will see the cow is mostly
black until you spin it around a bit. After the patch is applied the cow
appears fully lit all the time as expected.
Cheers,
Roland
Index: src/osg/State.cpp
===================================================================
--- src/osg/State.cpp (revision 13060)
+++ src/osg/State.cpp (working copy)
@@ -1414,9 +1414,12 @@
Matrix matrix;
matrix.invert(mv);
- Matrix3 normalMatrix(matrix(0,0), matrix(1,0), matrix(2,0),
- matrix(0,1), matrix(1,1), matrix(2,1),
- matrix(0,2), matrix(1,2), matrix(2,2));
+ Matrix3 normalMatrix(matrix(0,0), matrix(0,1), matrix(0,2),
+ matrix(1,0), matrix(1,1), matrix(1,2),
+ matrix(2,0), matrix(2,1), matrix(2,2));
_normalMatrixUniform->set(normalMatrix);
}
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=47039#47039
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org