On 3/22/2011 9:12 PM, Simon Kolciter wrote:
> 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?

  Correct.

> 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?

  I don't think so.

  I think what you'd need to do is a single pass through with some sort of 
render to
texture, storing the calculated (and possibly normalized) normals in the 
texture. Then,
you'll need to do a second pass to actually render the imagery, fetching the 
new normals
from the texture in the vertex shader and utilizing them as, err, normal.

-- 
Chris 'Xenon' Hanson, omo sanza lettere. xe...@alphapixel.com 
http://www.alphapixel.com/
  Digital Imaging. OpenGL. Scene Graphs. GIS. GPS. Training. Consulting. 
Contracting.
    "There is no Truth. There is only Perception. To Perceive is to Exist." - 
Xen
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to