LiSPSM / PSSM mapping with caelum

nargil

09-04-2009 01:18:13

I'm implementing various shadow techniques into my project.
- Uniform depth texture seems to work fine
- PSSM depth texture, which is working for my directional lights causes errors when caelum is enabled:
* some parts of the world constantly receive shadows if CAELUM_COMPONENT_CLOUDS is active.
* the shadows seem to react to camera movement in a weird way - I have to look exactly at the sun position to get a valid shadow map if CAELUM_COMPONENT_CLOUDS is active. (this seems to also occur with LiSPSM)
* only the first PSSM plane is working (even if I just leave the sun component). The others are being shadowed dark.

Tomorrow i'll try make mEntity public in the cloud layer to set:
mCaelumSystem->getCloudSystem()->getLayer(0)->mEntity->setCastShadows(false); and see if that changes the clouds problem.

I have no clue, why only the first PSSM plane is working with caelums sun, although all of them are working fine with any other directional light. Voodoo ? Has anyone gotten PSSM working with caelum ?

nargil

09-04-2009 08:03:04

Well I must say I'm stupid... I had set: mCaelumSystem->getSun()->getMainLight()->setShadowFarDistance(15); and forgot about it.
Removing this fixes the problem, that shadows are only on the first plane :P

After some debugging I can say that: mCaelumSystem->setManageSceneFog(false); fixes a lot problems. Now it works even with clouds on. Well... almost. Clouds cause some flickering. That's the only problem I have left now. I'll keep you updated ;)

nargil

10-04-2009 00:08:25

No success in fixing the pssm + clouds flickering issue. I tried to getEntity for the cloud layer and disable setShadowCaster, and I tried to add clouds to the skies_late renderque which ogre disables shadows for. The shadows are still flickering ;/

Edit: neither does setting them to render_que_max.
Setting the clouds entity to not visible fixes it, but it's not what I want.

Setting a shadow listener

void shadowTextureCasterPreViewProj(Ogre::Light*, Ogre::Camera *camera, size_t)
{
GameEngine::getSingletonPtr()->getEnviromentManager()->setCloudsVisible(false);
}

void shadowTexturesUpdated(size_t)
{
GameEngine::getSingletonPtr()->getEnviromentManager()->setCloudsVisible(true);
}
doesn't help.

Now I'm really clueless, how to get clouds working with PSSM.