[osg-users] VRML Normal Issue

Ben Axelrod baxelrod at coroware.com
Fri Mar 20 14:35:00 PDT 2009


I have noticed a very strange issue regarding VRML file rendering.  This issue happens in OSG viewer version 2.6, with openVRML version 0.14.3.

Please view the two attached vrml files and observe very different shading on the 2 cubes.  The only difference between the files is that in goodbox.vml, the coordinate indices are used only once per triangle.  In badbox.wrl, the 8 vertices are reused for multiple triangles.  You can see that in goodbox.vml, I duplicated the vertices so that they would be used only once.  For example, for index '0', I copied it and made it also index 8 through 12, then used those new indices in the coordIndex[] definition.

I think that the vrml parser tries to interpolate vertex vectors from the triangles they belong to.  If a vertex belongs to two ore more triangles which are not co-planar then the vertex vector is something in between the different surface normals of the different triangles. And because normal vectors along a triangle surface are interpolated from the vertex normals, this leads to a gradient along the triangle surface (because the vertex normals are not pointing in the same direction). Hence, if only co-planar triangles share their points the problem disappears.

Are there some VRML flags to prevent this behavior?  Is this a bug in the VRML parser?  If so, is this part of OSG or openVRML?

Thanks,
-Ben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090320/cba496f2/attachment-0002.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: goodbox.wrl
Type: x-world/x-vrml
Size: 2115 bytes
Desc: goodbox.wrl
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090320/cba496f2/attachment-0004.wrl>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: badbox.wrl
Type: x-world/x-vrml
Size: 2079 bytes
Desc: badbox.wrl
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090320/cba496f2/attachment-0005.wrl>


More information about the osg-users mailing list