diff --git a/src/osgShadow/StandardShadowMap.cpp b/src/osgShadow/StandardShadowMap.cpp index ad27b0cfe..387aca1f7 100644 --- a/src/osgShadow/StandardShadowMap.cpp +++ b/src/osgShadow/StandardShadowMap.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -526,6 +527,12 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv stateset->setRenderBinDetails( 0, "RenderBin", osg::StateSet::OVERRIDE_RENDERBIN_DETAILS ); + // Assure that AlphaTest/AlphaRef works when redirecting all drawables to single bin. + // If AlphaFunc/AlphaTest is off - transparent objects will cast solid blocky shadows. + // No override to allow users change this policy in the model if really want solid shadows. + stateset->setAttributeAndModes + ( new osg::AlphaFunc( osg::AlphaFunc::GREATER, 0 ), osg::StateAttribute::ON ); + // agressive optimization stateset->setAttributeAndModes ( new osg::ColorMask( false, false, false, false ), @@ -555,11 +562,6 @@ void StandardShadowMap::ViewData::init( ThisClass *st, osgUtil::CullVisitor *cv stateset->setMode ( GL_BLEND, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF ); -#if 0 - stateset->setMode - ( GL_ALPHA_TEST, osg::StateAttribute::OVERRIDE | osg::StateAttribute::OFF ); -#endif - #if 0 // fixed pipeline seems faster (at least on my 7800) program->addShader( new osg::Shader( osg::Shader::FRAGMENT, "uniform sampler2D texture; \n"