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
--
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org