Hello! I was using a code like this one to create my compositor shadow node:
Code: Select all
Ogre::CompositorShadowNodeDef *shadowNodeDef = root->getCompositorManager2()->addShadowNodeDefinition( "ShadowNode" );
shadowNodeDef->setNumShadowTextureDefinitions( 4 );
shadowNodeDef->setNumTargetPass( 4 );
//Splits
int shadowRes = 4096;
for(int i=0; i<4; i++){
Ogre::ShadowTextureDefinition *texDef = shadowNodeDef->addShadowTextureDefinition( 0, i, Ogre::StringConverter::toString(i), false );
texDef->numSplits = 4;
texDef->width = shadowRes;
texDef->height = shadowRes;
texDef->pssmLambda = 0.95;
texDef->formatList.push_back( Ogre::PF_FLOAT32_R );
texDef->shadowMapTechnique = Ogre::SHADOWMAP_PSSM;
}
for(int i=0; i<4; i++){
Ogre::CompositorTargetDef *targetDef = shadowNodeDef->addTargetPass( Ogre::StringConverter::toString(i) );
targetDef->setNumPasses( 2 );
//Clear
Ogre::CompositorPassDef *passClearDef = targetDef->addPass( Ogre::PASS_CLEAR );
((Ogre::CompositorPassClearDef*)(passClearDef))->mColourValue = Ogre::ColourValue::White;
//Scene
Ogre::CompositorPassDef *passSceneDef = targetDef->addPass( Ogre::PASS_SCENE );
passSceneDef->mShadowMapIdx = i;
}
the strange thing is that this script works very well:
Code: Select all
compositor_node_shadow ShadowNode
{
technique pssm
num_splits 4
pssm_lambda 0.95
shadow_map 0 4096 4096 PF_D32_FLOAT light 0 split 0
shadow_map 1 4096 4096 PF_D32_FLOAT light 0 split 1
shadow_map 2 4096 4096 PF_D32_FLOAT light 0 split 2
shadow_map 3 4096 4096 PF_D32_FLOAT light 0 split 3
shadow_map 0 1 2 3
{
pass clear
{
colour_value 1 1 1 1
}
pass render_scene
{
}
}
}
thanks!!
EDIT: lol, I just quickly solved it... I was missing this in ShadowTextureDefinition:
Code: Select all
/// Depth Buffer's pool ID. If the format is a depth format, it
/// is recommended you set this value to POOL_NON_SHAREABLE
uint16 depthBufferId;