Hi Simon,

Am 23.03.2011 04:12, schrieb Simon Kolciter:
> Well, the problem is that the normal vertices are PER_VERTEX, not 
> PER_PRIMITIVE.
> 
> In Geometry shader, I only have access to the current primitive, not the 
> whole mesh, right?

In principle, you are right, the geometry shader can
only access the current primitive, but there
are new kinds of primitives that were introduced
to give the geometry shader some neighbourhood
on information. One of those is the new "primitive type"
GL_TRIANGLES_ADJACENCY which will give you information
about adjacent (via edges) triangles. I found a nice
explanation at the beginning of

http://prideout.net/blog/?p=54


> I need to
> 
> 1. calculate the normal vector of each face (triangle) and add it to the 
> normal vectors of all 3 vertices
> 
> 2. normalize the normal vector of each vertex (optional)
> 
> Is there any way to access normal vector of each vertex in geometry shader?

In that situation I would think that you need to use
TRANSFORM_FEEDBACK to record the primitive normals
to a buffer object on a first render pass (with
rasterization disables) and then do the summing/
normalization on the second and final render pass.

There does not seen to be a lot of support for
TRANSFORM_FEEDBACK in OSG at the moment. The only
thing i could find was osg::TransformFeedbackBufferBinding.

There are some (non-OSG) examples for TRANSFORM_FEEDBACK
at

http://rastergrid.com/blog/tag/transform-feedback/

Cheers,

Peter

> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=37819#37819
> 
> 
> 
> 
> 
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> 

-- 
Vorstand/Board of Management:
Dr. Bernd Finkbeiner, Dr. Roland Niemeier, 
Dr. Arno Steitz, Dr. Ingrid Zech
Vorsitzender des Aufsichtsrats/
Chairman of the Supervisory Board:
Michel Lepert
Sitz/Registered Office: Tuebingen
Registergericht/Registration Court: Stuttgart
Registernummer/Commercial Register No.: HRB 382196 


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

Reply via email to