I tried to reduce the number of objects that cast shadows by setting visibility flags.
This is what is done in a custom compositor pass:
Code: Select all
// Pause the rendering, switch to the shadow caster mask, render, then switch mask back Ogre::SceneManager::RenderContext* context = p_sm->_pauseRendering(); unsigned int oldMask = _viewport->getVisibilityMask(); _viewport->setVisibilityMask(VISIBILITY_MASK_NONE); p_sm->prepareShadowTextures(cam, _viewport, &ll); _viewport->setVisibilityMask(oldMask); p_sm->_resumeRendering(context);
However, everything casts a shadow, so that leads to the conclusion that visibility flags are ignored in the prepareShadowTextures() function.
I know I can use the dedicated function for that (setCastShadows), but IMO, visibility flags should also work here, as they allow some more fine grained control. Also, when an object is not visible in the actual scene due to visibility flags, it should not cast a shadow either. For that to work, you would currently have to setCastShadows to false in addition to certain visibility flags.
So, should this be changed or is it WAD (working as designed)?