Cascaded sun shadows

Hey,
Recently I’ve seen some blender games that have large landscapes that look dull and boring just because of the lack of shadows. So, here’s my first try to create non-overlapping shadow cascades with a dynamic day/night cycle (shadows only cycle) and no cascade overlapping. I’ve used some basic vector maths to make the cascades behave as they should and follow the camera correctly.
Basic description:
There is 1 main sun lamp that controls that’s basically the light source (called MainSun), and 4 shadow-only sun lamps for the cascades. and there are few pink cubes parented to each lamp just for visualization, and an almost transparent huge plane slightly above the ground that’s simply just for casting shadows to show if anything is overlapping.

(I know that this is nothing close to the actual concept and implementation of cascaded shadow maps, but atleast it works as it should ! )

press Space to rotate the main sun , D to rotate the camera.

Download:

Attachments

cascades.blend (571 KB)

I don’t seem to get it, I pres P and nothing happens, I am not getting any shadow at all from the cube,

is there other inputs to trigger it?

maybe I just don’t understand?

I do not see any effect either. Just letting you know.

Just read the post more carefully ?

Nicely done!

One thought on this: the highest detail shadow should probably extend just behind the player, so if there’s something there the shadow doesn’t vanish as soon as he’s past.
Nice work though. Mind if I hijack this trick into my lighting manager (which I will release sometime soon I hope)

Sorry for the “very” late reply, just decided to check my threads.
Well if you look at how the lamps move while rotating you’d notice that there’s no possible way for a shadow to not appear in the camera frastum while it’s supposed to.

Sure feel free to use it in your lighting manager, I really like it’s seamlessness so far!