Hi,
     Sorry for borthering. I seem to be encountered with the same kind of 
problems which confused me for a long time. I hope that we can do further 
communicate on the GLSL subject.
     Up to now, I still didn't know what kind of  vertex that vertex shader 
dealt with in deed? Is the vertex in the vertex shader totally about primitives 
such as triangles, lines ,points? Or about the whole surface that is assembled 
by primitives?
        
 
> From: ethanf...@gmail.com
> Date: Mon, 18 Nov 2013 16:50:53 +0100
> To: osg-users@lists.openscenegraph.org
> Subject: Re: [osg-users] Render-To-Texture GLSL program question
> 
> Thanks, that makes sense that it would just be rendering a quad and that the 
> original scene geometry would be lost.  However, the GLSL geometry shader 
> only accepts primitives of the type point, line, or triangle->is it perhaps 
> rendering two triangles to the geometry shader to make up the quad?  How 
> would I even go about determining since there's no debugging available?
> 
> But back to what I'm trying to do, I'm trying to use a geometry shader to 
> calculate the min, max, mean, std dev, and histogram of an RTT texture.  
> Fellow osg forum member Aurelius has advised me that he has working code that 
> does this using geometry shaders and pointed me to:
> http://http.developer.nvidia.com/GPUGems3/gpugems3_ch41.html
> and
> http://developer.amd.com/wordpress/media/2012/10/GPUHistogramGeneration_I3D07.pdf
> but the first example only has Cg code and not GLSL, and the second example 
> is a paper that describers an algorithm but doesn't have any src.  These are 
> both potentially great resources, but I'm struggling to just get a basic 
> pass-through geometry shader working to get some sort of starting point.
> 
> As a side note, I am also considering using a compute shader since this would 
> be the more natual fit for this type of algorithm while the geometry shader 
> method is more of a "hack" that goes against the original intention of the 
> geometry shader, but I'd be happy using either method, I'm just trying to get 
> some traction on either of them.
> 
> -Ethan
> 
> 
> SMesserschmidt wrote:
> > 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 wou
>  ld
> > > 
> > 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
> > > 
> > > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > > 
> > 
> > 
> > _______________________________________________
> > osg-users mailing list
> > 
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > 
> >  ------------------
> > Post generated by Mail2Forum
> 
> 
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=57285#57285
> 
> 
> 
> 
> 
> _______________________________________________
> 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