On 03/22/2011 12:31 PM, Chris 'Xenon' Hanson wrote:
   You should be able to do what you're looking for on-GPU. There are some 
cache and
read/write issues when you need to write to a data store and then immediately 
read it back
and use it for drawing. Others can comment on that.


I haven't done this myself, but from what I've read/heard, the way to do this would be to submit the vertices to a geometry shader, compute the normals in the geometry shader, then use transform feedback to stream the new normals to another vertex buffer which can then be used for rendering. If you want smooth shading, you may need to use one of the primitives that includes adjacent vertex data. Look at the specs for ARB_geometry_shader4 and EXT_transform_feedback for more info. I don't know how well OSG supports transform feedback at this point, either, so you might have your work cut out for you if you go this direction.

In any case, there shouldn't be any need for a trip back to the CPU, unless you need the normals for some task other than rendering.

--"J"

_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to