[osg-users] VRML Normal Issue

Ben Axelrod baxelrod at coroware.com
Wed Mar 25 12:54:49 PDT 2009


Just to clarify, the way the normals *should* work is sketched in the attached image.  Please verify.

When the angle between 2 faces is sharper than the crease angle, there is one normal per face, and when the angle is smoother than the crease angle, the normal is averaged.

Thanks,
-Ben

-----Original Message-----
From: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Jan Ciger
Sent: Tuesday, March 24, 2009 1:36 PM
To: OpenSceneGraph Users
Subject: Re: [osg-users] VRML Normal Issue

-----BEGIN PGP SIGNED MESSAGE-----
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)


Regards,

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

iD8DBQFJyRn8n11XseNj94gRAhPtAKDd+ov0409iUlfCEoPs0Jgz8z2V/QCfTV6C
trLfTvJTRgm+KjV2GCYphTA=
=dT7/
-----END PGP SIGNATURE-----
_______________________________________________
osg-users mailing list
osg-users at lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: creasenormals.png
Type: image/png
Size: 4050 bytes
Desc: creasenormals.png
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20090325/0bbeaaef/attachment-0003.png>


More information about the osg-users mailing list