diff --git a/src/osgShadow/ViewDependentShadowMap.cpp b/src/osgShadow/ViewDependentShadowMap.cpp index 6860ad862..68016c704 100644 --- a/src/osgShadow/ViewDependentShadowMap.cpp +++ b/src/osgShadow/ViewDependentShadowMap.cpp @@ -1052,7 +1052,14 @@ void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv) // pass on shadow data to ShadowDataList sd->_textureUnit = textureUnit; - sdl.push_back(sd); + if (textureUnit >= 8) + { + OSG_NOTICE<<"Shadow texture unit is invalid for texgen, will not be used."<(itr->first.get()); - if (light) + if (light && light->getLightNum() >= 0) { // is LightNum matched to that defined in settings if (settings && settings->getLightNum()>=0 && light->getLightNum()!=settings->getLightNum()) continue;