On 10/3/06, John Aughey <[EMAIL PROTECTED]
> wrote:
The osg file I forgot to attach is attached to this e-mail.
JohnOn 10/3/06, Robert Osfield < [EMAIL PROTECTED] > wrote:Hi John,
The file did get through, perhaps it was eaten my mail filters, or missed..
Robert.On 10/3/06, John Aughey < [EMAIL PROTECTED]> wrote:Attached is a file that shows the issue. It's a small roof model, and your loader won't be able to find the textures, but it shows the problem. In the .osg file, it rotates the roof 90 degrees to orient it correctly in my axis system. The Transform is marked STATIC, so the optimizer in osgviewer will optimize out the transform.
If you run osgviewer on it with full optimization, the roof panels don't shade right because of the normals. If you turn off optimization by setting OSG_OPTIMIZER to NONE, then the normals are correct and it shades right. Or, if you apply the fix I suggested it behaves correctly too.
JohnOn 10/3/06, Robert Osfield < [EMAIL PROTECTED]> wrote:Hi John,
To transform planes and normals you mulitple by the transpose of the inverse of a matrix, to transform vertices you multiple by the matrix directly. The code you see does the trick of doing the transpose by doing doing switching the post and pre multiple order.
I also haven't see switching normal orientations before, this makes me wonder if there isn't something else wrong that you usage is uncovering. Could you provide a model that reproduces it?
Robert.
On 10/3/06, John Aughey < [EMAIL PROTECTED]> wrote:When the optimizer reduces static transforms, it multiplies the verticies and normals by the current transformation matrix. It uses TransformAttributeFunctor to do this. However, it's transforming the normals backwards. The comment in the TransformAttributeFunctor.cpp line 43 says to post mult by inverse for normals which makes no sense. The normals should be transformed the same way the verticies are. If you change the matrix from _im to _m on line 44, then the model optimizes correctly with the normals pointing the correct way._______________________________________________
If you want, I can submit a patch for just this.
John
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/
_______________________________________________ osg-users mailing list [email protected] http://openscenegraph.net/mailman/listinfo/osg-users http://www.openscenegraph.org/
