The weekend has been a total loss work-wise, so I didn't get too far with this, sorry.

But I did back-date trunk to r13018, which was the last time oversimple3.cpp was modified, and the lines of code in your proposed change haven't been modified since then either. The example ran and lit correct at that svn revision. I also checked the eye coordinate light vector used in oversimple3 and I believe it's correct.

Moving forward, please let me dig into this a little more and see if I can identify the svn revision that broke lighting in this example. Thanks.
   -Paul



On 4/13/2012 8:53 AM, Paul Martz wrote:
Something odd is going on here, as this works correctly in 3.0.1. I don't have
time to dig in to the math right now; maybe over the weekend...
-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
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


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


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

Reply via email to