[osg-users] [osgPlugins] Need help with setting/calculating normals

Robert Osfield robert.osfield at gmail.com
Wed Jun 29 06:40:17 PDT 2016


Hi Daniel,

If your models don't come with normals then there is no way to know
what the appropriate normals would be so there isn't any single
automated tools that will automagically do the right thing by all
models.

The SmoothingVisitor is simply assumes that vertices in the same x,y,z
are shared vertices that potentially will share the same normal, so in
it's default settings will smooth round sharp edges.  This works
really well for smooth objects, but performs poorly on angular
objects.

Recent versions of SmoothingVisitor add support for users to specify a
crease angle, this gives a hint to the smoothing algorithm that edges
in the mesh that are sharper than the specified create angle should
not assume shared vertices and shared normals, instead should have
separate vertices and normals.  This enables one to see sharp edges in
the mesh.

For you using the SmoothingVisitor::setCreaseAngle(angleInRadians)
will be worth trying, however, you can't expect it to give you perfect
results for all models, in the end it's a crude geometric algorithm
that knows nothing about what the object it is processing represents,
it can't make any of the higher level artistic judgements that a
modeller can do.  Essentially models with normals are already broken,
so these automated tools can only go so far in fixing the problems
that the art path route has created.

Robert.

On 29 June 2016 at 01:52, Daniel Lecklider <lecklider_daniel at bah.com> wrote:
> Hi,
>
> First of all I am new to OSG so forgive me if I am making any mistakes.
>
> I am creating a plugin for a proprietary 3d model format that we use at my work. These model files only contain grid points and unsorted primitives such as TRI's and QUADs.
>
> Currently when I create the model I am not setting normals since non are provided by the file format. So I used the smoothing visitor to calculate the normals for me. However when I do this I get weird white spots all over model when I rotate it and look at it.
>
> It seems like this really occurs when there is a 2d shape that is outjutting into 3d space. (Essentially has no or almost no width).
>
> Is there any way I can calculate the proper normals, even though they are not given? Or is there any way to fix this rendering issue.
>
> And do not worry about the models color, each section has its own section to denote different things for our clients.
>
> Thank you!
>
> Cheers,
> Daniel
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=67888#67888
>
>
>
>
> Attachments:
> http://forum.openscenegraph.org//files/osg2_109.png
> http://forum.openscenegraph.org//files/osg1_115.png
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org



More information about the osg-users mailing list