Hi Martin,

Here you could implement a custom osgFX::Effect. Have a look to osgFX::Cartoon : it is a simple effect with two pass.

Martin Großer a écrit :
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


--
Lamoliatte Stephane
Ingenieur R&D

R.S.A. Cosmos
Z.I. de la Vaure - B.P.40
42290 Sorbiers, France
Tél : +33 (0)4 77 53 30 48
Fax : +33 (0)4 77 53 38 61

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

Reply via email to