[osg-users] Computing Normals for Drawables
James Buckthorpe
James.Buckthorpe at gmail.com
Fri Nov 6 08:18:15 PST 2009
Hi,
I have a scene that contains a very large number of osg::Drawables.
I am currently using osg::SmoothingVisitor to compute the normals for each geometry. This creates a normal per vertex. If I turn normals off I see a sigificant reduction in the amount of memory in use, hence I am currently looking at implementing a visitor to compute 1 normal per triangle which would still give the appearance I need and reduce the memory load.
However, I am not sure of the correct way to binding normals to the geometry:
In osg::SmoothingVisitor this is done using:
geom.setNormalArray( normals );
geom.setNormalIndices( geom.getVertexIndices() );
geom.setNormalBinding(osg::Geometry::BIND_PER_VERTEX);
My geometries are mostly defined using quads and triangle strips. If I use osg::Geometry::BIND_PER_PRIMITVE I am guessing that this will try to bind to a quad or triangle strip not a triangle as I would like. Is this correct?
Using a single normal for a triangle strip is not going to give me a suitable view of the geometry.
Is anyone able to point me in the right direction?
Many Thanks for your help.
James
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=19269#19269
More information about the osg-users
mailing list