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

Attachment: goodbox.wrl
Description: goodbox.wrl

Attachment: badbox.wrl
Description: badbox.wrl

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

Reply via email to