Hello Paul,
> Interesting. I changed ShadowMap's clamping to CLAMP_TO_BORDER some time ago
> to eliminate seeing the "square" of the shadow map texture on the base
> geometry, which occurred when CLAMP_TO_EDGE was used (the shadow map did not
> contain an edge, so it defaulted to black, producing a shadow for any
> geometry outside the area covered by the shadow map).
I think you misunderstand. I'm not talking about the shadow map texture, I'm
talking about the 1x1 "dummy" texture that's added to the subgraph on unit 0
(by default) to allow the same shader to work on textured and untextured
objects. These are the lines to change:
fakeTex->setWrap(osg::Texture2D::WRAP_S,osg::Texture2D::CLAMP_TO_BORDER);
fakeTex->setWrap(osg::Texture2D::WRAP_T,osg::Texture2D::CLAMP_TO_BORDER);
Change that to either CLAMP_TO_EDGE or REPEAT.
I don't think this has any effect on the actual shadows, since fakeTex is bound
to texture unit 0, and the shadow map is bound to unit 1 (by default).
> To me, it seems incorrect for the algorithm to use the same texture clamping
> for both the shadow texture and the scene model textures. Shouldn't it use
> whatever the user has specified for clamping for the model textures? Then it
> would use CLAMP_TO_BORDER for the shadow map texture.
Exactly, but what happens if the user's model has no textures? Try it - comment
out the part that creates and assigns fakeTex in osgShadow::ShadowMap::init().
What you'll get for an untextured model is black, because the shader tries to
do a texture lookup on unit 0 which has nothing bound to it.
If the model is textured, then fakeTex (bound to unit 0) is just overridden by
the model's textures lower down in the graph, so there is no problem, and in
that case the clamping mode of that texture takes effect.
J-S
--
______________________________________________________
Jean-Sebastien Guay [EMAIL PROTECTED]
http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org