# How do you stop an Ogre PSSM shader from creating unwanted or blocky shadows due to large 'world size'

I'm using PSSM Shadows in Ogre 1.6.4 and I have a scene which is around 100m square.

I also create a flat ground texture which does not cast shadows and extends off towards the horizon, but when I do this, and the Sun light source goes towards the horizon at dawn or dusk, then I get extra shadows at the edges of some of my objects. It's like some kind of self shadowing.

I'm using custom shaders, but the Ogre PlayPen PSSM shader also goes beserk in this environment too.

Is there a technique to allow this ground area to exist (ie my world to be big) without affecting my PSSM shadowing?

(btw - my derived light direction is correctly normalized!)

Well here's what I actually did to resolve my problem:

It so happens that the far terrain that is making my world so large doesn't need to receive shadows, and as I mentioned above, neither is it a shadow caster.

Now in Ogre it seems that although you can tell an object not to cast shadows, you can't tell it not to receive shadows.

But what you can do is put the relevant objects in a separate rendergroup in the render queue, and then tell that renderQueue group not to form part of any of the shadow processing or setup:

sceneManager->getRenderQueue()->getQueueGroup(myID)->setShadowsEnabled(false);


This then fixes my problem where these non casting, non receiving planes seem to be affecting the shadows in the rest of my scene - and maybe ever so slightly improves performance too.

If I'd understood all this a bit more I'd probably have known that's what I should be doing anyway, but there you go!

• Caveat: you might get some unwanted z sorting problems with this idea for some scene (e.g. smoke, lights and post-processing). If it works with those, then this is really a nice work-around. +1 for future reference! – teodron Aug 10 '12 at 6:51

I don't know about Ogre specifically, but a very common way to deal with shadow resolution in a large world is cascaded shadow maps. This technique uses multiple shadow maps, with high-resolution ones that cover only the area near the camera and lower-resolution ones for areas farther from the camera. There are some subtleties in avoiding "swimming" artifacts as the camera moves around, but if implemented correctly CSM can be very effective. I don't know whether Ogre already has CSM technology built into it or whether you would need to implement it yourself, but it's worth looking into.

• Thanks. PSSM or Parallel-Split Shadow Mapping is already a cascaded shadow map technique. Also, changing the resolution of the maps, or their split distances doesn't affect the problem in hand. – Roger Attrill Aug 9 '12 at 7:33
• It's true that PSSM only differs from CSM in how the splits are generated, but you should attempt to increase the res of the closest maps only. This gives you more headroom to use even larger textures without increasing overall memory usage much. – ChrisC Aug 9 '12 at 21:57