Hi all.

Im trying to use a VertexShader to drive the SoftShadowMap implementation of
the FragmentShader (which is present in the SoftShadowMap.cpp).

Problem is as usual, that when vertex shader is enabled, all automatic stuff
are disabled, such as texture generation.
Now after browsing archive, surfing the net and looking through the GLSL
book, I have come to the conclusion that the vertex shader below should be
enough to drive the Fragmentshader:

void main( void )
{
  gl_Position = ftransform();
  gl_TexCoord[0] = gl_MultiTexCoord0;
  gl_TexCoord[1] = gl_MultiTexCoord1;

  // Emulate glTexGen (on unit 2)
  gl_TexCoord[2].s = dot(gl_Vertex, gl_ObjectPlaneS[2]);
  gl_TexCoord[2].t = dot(gl_Vertex, gl_ObjectPlaneT[2]);
  gl_TexCoord[2].p = dot(gl_Vertex, gl_ObjectPlaneR[2]);
  gl_TexCoord[2].q = dot(gl_Vertex, gl_ObjectPlaneQ[2]);

 }

baseTexture - Texture unit = 0
osgShadow_shadowTexture - Texture unit = 1
osgShadow_jitterTexture - Texture unit = 2

But as soon as I enable this vertex shader, the shadow stops working.
I need to write my own vertex shader to calculate vertex pos in eye
coordinates etc. Im basically trying to merge the shadows with other
texturing, such as parallax mapping etc.

Any hints on how to write a vertex shader that will replace the fixed
functionality for the SoftShadowMap Fragment shader (with base texture)??

/Anders

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

Reply via email to