Hello Sebastian,
> I reckon that my assumption regarding the texture compare mode were wrong.
> But indeed the whole problem seems to be with my shaders. I'm willing to
> provide the per-pixel modifications.
> I guess I'm doing something very wrong in my vertex shader. Upon
> completion and testing these shaders could be integrated into the
> osgShadow::ShadowMap implementation (if I get this working ;-))
>
Before writing your shader, did you look at the shader in
src/osgShadow/ShadowMap.cpp? It does things a bit differently than
classic shadow map implementations (in particular it does not need a
vertex shader), so I'd also suspect something is wrong in your vertex
shader. Also, I think you need to use the same uniform sampler names in
your fragment shader that ShadowMap sets, otherwise you're not using the
same sampler, right?
//////////////////////////////////////////////////////////////////
// fragment shader
//
static const char fragmentShaderSource_withBaseTexture[] =
"uniform sampler2D osgShadow_baseTexture; \n"
"uniform sampler2DShadow osgShadow_shadowTexture; \n"
"uniform vec2 osgShadow_ambientBias; \n"
"\n"
"void main(void) \n"
"{ \n"
" vec4 color = gl_Color * texture2D( osgShadow_baseTexture,
gl_TexCoord[0].xy ); \n"
" gl_FragColor = color * (osgShadow_ambientBias.x + shadow2DProj(
osgShadow_shadowTexture, gl_TexCoord[1] ) * osgShadow_ambientBias.y); \n"
"}\n";
Unfortunately I cannot dive into this right now, but I think you have
some leads... Keep us updated on how it goes.
Hope this helps,
J-S
--
______________________________________________________
Jean-Sebastien Guay [EMAIL PROTECTED]
http://www.cm-labs.com/
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org