Hi,

download osgPPU from here

http://projects.tevs.eu/osgppu

and look at the examples.

Also have a look at the osgstereomatch example. It uses multiple shaders and multiple passes per frame. The readme explains the details.

jp

Martin Großer wrote:
Hello,

I have the following vertex and fragment shader. This is a simply fur shader, 
but the difficult part is the rendering in passes.

Vertex Shader
--------------
uniform float shell_distance; //  is a constant
uniform float pass_index;  // increase on every render pass

varying vec2  vTexCoord;



void main(void)

{

   vTexCoord    = gl_MultiTexCoord0.xy;

   vec4 Position = gl_Vertex;

Position.xyz += shell_distance * pass_index * gl_Normal;
   gl_Position = gl_ModelViewProjectionMatrix * Position;

}



Fragment Shader
----------------
uniform vec4 furColorScale;

uniform sampler2D Fur;

uniform sampler2D FurColor;



varying vec2 vTexCoord;



void main(void)

{

    // Get the alpha component for this shaft

vec4 fAlpha = texture2D( Fur, vTexCoord );
    // Get the hair shaft color, and scale by the color scale

    vec4 fColor = furColorScale * texture2D( FurColor, vTexCoord )*fAlpha;

    // Return the calculated color

    gl_FragColor = fColor;

}

My problem is, how can render a object in some passes??
My idea is... - first I render the Objekt with Shader -> pass_index = 1
              - second I increase the pass_index -> pass_index = 2
              - than the first and the second step again and so on
              - at the end I want to see the combined scene

How can I implement this with OpenSceneGraph?

Cheers,

Martin

--
This message is subject to the CSIR's copyright terms and conditions, e-mail legal notice, and implemented Open Document Format (ODF) standard. The full disclaimer details can be found at http://www.csir.co.za/disclaimer.html.

This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. MailScanner thanks Transtec Computers for their support.

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

Reply via email to