• entries
3
3
• views
4496

## Untitled

I'm still working on a better shadow demo, although my engine at home is having to be reworked and finally brought up to date to handle it all. I'm going to use cascaded shadow maps for an outside scene (with dir. light) but one thought strikes me - as soon as I start spending gpu cycles blurring up multiple shadow maps, wouldn't I be better off sampling mutliple times in screen space again..? I'll have to see I guess.

Other stuff...

A L I E N S !!!!

The news that SEGA have got the Aliens license (and that Gearbox might be making a FPS and Obsidian making a RPG with said license) has me super excited :D

I've solved the false shadowing problem I mentioned in the previous entry - the fault wasn't really in the shadow mapping per se, but rather could be attributed to an incorrectly sized light frustum..

The only remaining problem is the weakening of the shadow at the point of contact - something I've mitigated slightly by changing to a standard box filter when blurring the SM, rather than using a gaussian filter. This way, the shadows are less "curved" and maintain more of the occluders shape, whilst still being plenty smooth.

I'm hoping to put together a more impressive demo next, to see how it works out with more real-world examples.

stoo

## Shadows and such (with pictures :)

Hello

After having a GDNet account for a while, I figured it was about time I started using my Journal. I think this might be quite a big first entry too :).

float lightAmount = 1.0f;if((lightSpaceDepth - shadowMapDepth) < 0)    lightAmount = 0.0f;

We do something like this:
float lightAmount = 1.0 - ((lightSpaceDepth - shadowMapDepth) / fuzzyDist);lightAmount = clamp(lit, 0, 1);

where fuzzyDist is the range where the test result ranges from 0 to 1 e.g. it will give us less shadow where depths are close together. Because our shadow map values now look like this (since they are blurred):
        _______       /       \            /         \  _____/           \______

as apposed to this:
        _______       |       |       |       |_______|       |_________

it means we should get a nice soft shadow boundary.

I gave it a go - I made a regular 512x512 shadow map, down sampled it to 256x256 and then ran a 13x13 gaussian blur kernal over it. This is the result:

(Featuring a T-rex by cyberchinchilla from Turbo Squid)

I was quite pleased with the result - there's no aliasing even though the shadow map is only 256x256 and I only have to take a single sample in the lighting shader meaning it runs quickly. What's even better, by increasing the value of fuzzyDist, I was able to increase the blurryness of the shadow at no extra cost.

However, my happyness was pretty short lived when I tried it with other bits of geometry:

As you can see, using a fuzzy test to determine the amount of shadow, we loose a lot of important information about the scene - the knot is actually resting on the floor, yet the shadow at the point of contact is very weak.

Even worse that that, geometry that isn't primarily smooth in nature looses too much info in the blurring process giving you results like this (please excuse the poor modelling :))

As you can see, the building in the top right is showing lots of false self shadowing. TBH, these are all things that I expected - I didn't really foresee much use in blurring the shadow map, but the results are also more pleasant (and faster) than I assumed.

To try and combat these issues, I'm going to use the original depth map in conjunction with the blurred one, but so far it looks like i'll have to take multiple samples from it to have any useful info to combat the problem.

Anyway, I'll get back shortly if I make any progress.

Cheers,
stoo