Hello!
I can´t fin a way to set the VisibilityMask for a shadow node created with createShadowNodeWithSettings, I have some objects that have a special mask set to them and when I omit this mask in the VisibilityMask for the main render scene pass, the objects are hidden but I can see the shadows
thanks in advance!!
Set VisibilityMask when using ShadowNodeHelper::createShadowNodeWithSettings
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
-
- OGRE Team Member
- Posts: 5505
- Joined: Sat Jul 21, 2007 4:55 pm
- Location: Buenos Aires, Argentina
- x 1372
Re: Set VisibilityMask when using ShadowNodeHelper::createShadowNodeWithSettings
Welcome back!
The visibility mask from shadow nodes is independent from that of its master.
I see several possible solutions:
Matias
The visibility mask from shadow nodes is independent from that of its master.
I see several possible solutions:
- Modify createShadowNodeWithSettings to accept a default visibility mask
- Modify createShadowNodeWithSettings to accept an array of visibility masks (one per individual shadow map)
- Alter the shadow nodes created by createShadowNodeWithSettings after it returns
- Modify shadow nodes to inherit an 'and' mask from its master node (slightly tricky, because CompositorShadowNodeDef::_validateAndFinish needs to correctly determine, when using SHADOW_NODE_FIRST_ONLY, if the shadow node needs recalculation)
- Provide your visibility mask via SceneManager::setVisibilityMask (which affects all viewports/compositor workspaces) instead of doing at pass level
Matias
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
Re: Set VisibilityMask when using ShadowNodeHelper::createShadowNodeWithSettings
Thanks!!
I tried 3. like this:
but its not working =(, pretty sure the mask I am setting is correct since its the same I am setting to my main workspace render scene pass
I am going to try 1 or 2 if I find it fast to implement, and I'll make a PR
edit: implementing 1 was a piece of cake, I´ll make a PR hopefully soon
I tried 3. like this:
Code: Select all
mCompositorManager->validateAllNodes();
Ogre::CompositorNodeDef* shadowNode = mCompositorManager->getShadowNodeDefinitionNonConst( "MainEngineShadowNode" );
for( size_t i=0; i<shadowNode->getNumTargetPasses(); ++i ){
Ogre::CompositorTargetDef* targetDef = shadowNode->getTargetPass(i);
Ogre::CompositorPassDefVec passesDef = targetDef->getCompositorPassesNonConst();
for( size_t j=0; j<passesDef.size(); ++j ){
Ogre::CompositorPassDef* passDef = passesDef.at(j);
if( passDef->getType() == Ogre::PASS_SCENE ){
static_cast<Ogre::CompositorPassSceneDef*>( passDef )->mVisibilityMask = MySuperMegaDuperMask;
}
}
}
I am going to try 1 or 2 if I find it fast to implement, and I'll make a PR
edit: implementing 1 was a piece of cake, I´ll make a PR hopefully soon
-
- OGRE Expert User
- Posts: 1148
- Joined: Sat Jul 06, 2013 10:59 pm
- Location: Chile
- x 169
Re: Set VisibilityMask when using ShadowNodeHelper::createShadowNodeWithSettings
https://github.com/OGRECave/ogre-next/pull/52 (made with my company's account =D)