Werner Modenbach wrote:
Maybe someone can give me some explanation on my stupid little problem.

I have a geometry being composed of TRIANGLES.
I have a vertex-array, a verted-index-array and a normal-array assigned to my geometry.

Off-topic: Do you need to use the vertex-index-array? It is deprecated:
/** deprecated - forces OpenGL slow path, just kept for backwards compatibility.*/
        void setVertexIndices(IndexArray* array);

3 indexes and 3 normals per Triangle.
Normal binding is set to BIND_PER_PRIMITIVE_SET.

Unfortunately the rendering shows the geometry flat in curious dark colors and some unexpected light behaviour. For analysis purpose I set the normal binding to BIND_PER_PRIMITIVE and pushed just 1 normal per TRIANGLE. Everything looks good except I see the triangles and the geometry isn't smooth. The next test is pushing the same normal vector 3 times and setting the binding back to BIND_PER_PRIMITIVE_SET. In my understanding this should give the same optical result as before. Unfortunately it doesn't and everything is dark again.

I guess, I misunderstand something with the normal bindings.

Any hint is highly appreciated. Thanks in advance

I'm not sure why you don't use BIND_PER_VERTEX, as you stated above that your normal array contains 3 normals per triangle, so you have one normal per vertex, right?

BIND_PER_PRIMITIVE would result in flat shading (only one normal used for each triangle -- which, by the way, also forces OpenGL down the slow path), and BIND_PER_PRIMITIVE_SET would be even more granular: one normal used for each PrimitiveSet you add to the Geometry. This would make all triangles in the PrimitiveSet either uniformly dark or uniformly lit, depending on the direction of the one normal used for the whole group.

For analysis purposes, I suggest using the normals pseudoloader:
  > osgviewer dumptruck.osg.normals

Hope that helps,
   -Paul

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to