[osg-users] VRML Normal Issue

Jan Ciger jan.ciger at gmail.com
Tue Mar 24 10:36:00 PDT 2009

Hash: SHA1

Ben Axelrod wrote:
> Thanks for the info.  Is this standard procedure with mesh files?
> Because I have noticed similar affects with a variety of file
> formats.
> I agree that when no normals are specified, the proper behavior for
> the parser is to use one normal per face, and calculate the face
> normals from the vertex points, but the shading I see in badbox.wrl
> does not look like one normal per face, it looks like one normal per
> vertex.  The shading of goodbox.wrl looks like one normal per face to
> me.  Am I mistaken on how these should look?

I can't test it right now, because I do not have the VRML plugin
compiled at the moment. I have loaded the models in WhiteDune editor,
and both look OK to me, with the badbox one showing some artifacts.

I had a look at the code and if you do not specify any normals, the OSG
loader will not really handle it right. It seems that in that case an
average normal out of the adjacent faces is computed and used per-vertex
(i.e. the edges and corners are smoothed ...) This isn't completely
correct, the VRML spec specifies use of crease angle parameter that will
make all angles smaller than this one averaged and ones larger sharp.
However, this is not intended to be a 100% compliant VRML viewer.
Originally, the case without normals was not handled at all.

You have basically two options:

- - generate your VRML including normals
- - fix the VRML plugin code to include handling of the crease angle (in
IndexedFaceSet.cpp, around lines 240 and on in the VRML plugin)


Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org


More information about the osg-users mailing list