25 Sept 2007

Smooth Shadows

I'm currently working on the dynamic shadow system. This is a shot from the PC-version with 2 shadow-casting spotlights (animated lights, it actually looks much cooler in motion):


I have decided to use Variance Shadow Mapping in Nebula3, a relatively new approach which allows the shadow buffer to be linearly filtered. This is a big win because post-process filters can be applied on the shadow buffers, and all the hardware filtering features of the graphics card to fight aliasing (mipmapping, min/mag filtering, anistropic filtering, etc...) can be used when sampling the shadow map. It produces wonderfully smooth shadows from relatively low-res shadow buffers (the scene above uses 256x256 shadow maps).

The current implementation uses one "big" shadow buffer (512x512, pixelformat is G16R16F) which is re-used for all shadow-casting light sources:

This is then downsampled to 256x256:

Finally the downsampled buffer is blurred into a shared shadow buffer which stores the shadow buffers of all active shadow casting light sources into a single texture:


The pixel junk in the right half are the two unused slots, since there are only 2 (out of currently 4) shadow casting light sources in the scene. A texture array would be a better solution here, because at the moment sampling will "leak" into the neighbouring shadow buffer (for spot lights this isn't a big problem, since this will happen outside of the light cone). But texture arrays don't exist on DX9, so unfortunataly that's not an option.

There's still a lot of work to do on the lighting system, but the intermediate results look very promising. I think I will first bring the 360 version uptodate before moving along. It's lagging behind a few days now.

I have started to play through Ninja Gaiden Black again. Even among current 360 titles it would still look quite good, and it runs wonderfully on the 360 in 720p and 16:9. I finally want to beat the game on Normal (first time I only managed Ninja Dog... yeah I know). Everything about this game is simply kick-ass (well... except from the "story", yawn...). A real f*cking shame Team Ninja didn't release Sigma on the 360 as well. This was actually the only time where I was tempted to get a PS3, but... I seriously can't justify spending 600 Euro just for one game (which I already played).

I also got Halo3 today, I didn't expect to see it on shelf already (European launch is tomorrow). It stood there right amongst all the old 360 titles. Germany is still PC-land. No doubt ;)