Am 18.11.2013 15:32, schrieb Ethan Fahy:
Hello,

Preface: I realize this question comes about because I've never really learned 
OpenGL/GLSL from the ground up and am likely missing some simple concepts, but 
I mostly have been coasting by at the osg middleware level and have been doing 
OK so far.

If I want to do some simple post-processing I can create a render-to-texture camera and 
render to the framebuffer.  I can attach a texture to the framebuffer and then create 
another "screen" camera to render that texture to the screen.  I can add a GLSL 
shader program to this texture so that before the texture gets rendered to the screen it 
gets an effect added to it using the shaders.

When I use shaders attached to 3-D model nodes in the scene itself, the meaning of 
the vertex and frag shaders is easy to understand->the vertices of the 3-D 
model are the vertices referenced in the vertex shader.  However, When I render my 
scene to a texture and then do a simple pass-through vertex and frag shader combo, 
what is the meaning of the vertices in this scenario?  I had assumed that once you 
render your scene to a texture, all knowledge of the original scene's geometry and 
vertex locations has been lost, is this true?  If so, then what vertices am I 
dealing with?  It's easy enough to follow along with examples and to use a simple 
pass-through vertex shader, but I'd like to understand this better because I now 
want to insert a geometry shader in between the vertex and frag shaders and again 
I'm not sure whether to use point, line, or triangle in my geometry shader as the 
primitive type because I thought that the geometry and primitives of the original 
scene would
 b
  e lost after rendering to texture.

Usually when doing the post-processing pass you will be rendering to a fullscreen quad. So the vertices you are dealing with are those of the quad you are rendering too. And yes, If you don't any further actions, rendering to texture will not preserve the information on your orignal vertices etc. The question is what you want to achieve. A geometry shader inbetween your postprocessing pass will work on the quads vertices. Maybe you should elaborate which kind of post processing you want to achieve, so we can help you here.

What am I missing here?  Any clarification is most welcome.

-Ethan

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=57281#57281





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


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

Reply via email to