diff --git a/components/sceneutil/shadow.cpp b/components/sceneutil/shadow.cpp index 08581ee5a4..902627023f 100644 --- a/components/sceneutil/shadow.cpp +++ b/components/sceneutil/shadow.cpp @@ -66,6 +66,8 @@ namespace SceneUtil void ShadowManager::disableShadowsForStateSet(osg::ref_ptr stateset) { int numberOfShadowMapsPerLight = Settings::Manager::getInt("number of shadow maps", "Shadows"); + numberOfShadowMapsPerLight = std::max(1, std::min(numberOfShadowMapsPerLight, 8)); + int baseShadowTextureUnit = 8 - numberOfShadowMapsPerLight; osg::ref_ptr fakeShadowMapImage = new osg::Image();