I just confirmed that this is fixed by David's submission in r13067.
   -Paul


On 4/12/2012 10:22 PM, Roland Hill wrote:
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
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to