Yes, I dropped everything but the thing I experienced problem with, the shader replacement of TexGen. Thanks for the tip to look into StandardShadowMap.cpp, that was the only one I didnt peek into before.
Now it works. /Anders On Mon, Jun 7, 2010 at 11:42 PM, Wojciech Lewandowski <lewandow...@ai.com.pl > wrote: > Hi Anders, > > I see two problems with your shader. > > First it looks like you swaped shadow and jitter map coords. I suppose you > want to generate shadow map coords with texgen. So texgen should produce > unit 1 texture coords. But most probably you should use view space > (gl_EyePlane) coords for shadow coords. > > Second it looks like lighting/ color math is completely absent so resulting > lighting will be probably random. > > Please have a look at Vertex shader in osgShadow::StandardShadowMap.cpp. > Its quite generic and except jitter part it should contain all what you need > for single light scenario. > > Cheers, > Wojtek Lewandowski > > > *From:* Anders Backman <ande...@cs.umu.se> > *Sent:* Monday, June 07, 2010 3:27 PM > *To:* OpenSceneGraph Users <osg-users@lists.openscenegraph.org> > *Subject:* [osg-users] vertex shader for SoftShadowMap FragmentShader. > > 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 > > > _______________________________________________ > 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