Mintmaster
Veteran
The problem is this distance is not a well defined quantity for more complex geometries. Even worse is when you have an object behind another, for example a smaller pole lying in the shadow the the bigger pole. You need a sharp shadow there, but the shadow map rendered from the light source can't even see the small pole. Then, as the light source moves, suddenly the small pole appears and you render a sharp shadow now.I think the next logical step for the noise system, would be to calculate the distance of the surface the projected shadow is mapped to in relation to the distance of the object that is creating the shadow, as that relation in distance is a very important determining factor in how soft a shadow is.
This "next step" is extremely complicated and needs a completely different approach. The only realtime solution I know of without these artifacts is the penumbra wedge stuff from Assarsson and Akenine-Moller. It's stencil shadow based and really expensive, though. Not worth the cost over regular shadow maps, IMO, but damn are they pretty.
Here's a screenshot from my implementation of that algorithm:
http://forum.beyond3d.com/attachment.php?attachmentid=286&d=1187727472
The approximation they use for the aforementioned distance only works for simple cases. I did something very similar to this with VSM, as they are great for fast, variable width shadows after you strategically mipmap them or use summed area tables - much faster than 64 sample PCF.Percentage closer shadows do this. PDF about it and video of it here:
http://developer.download.nvidia.com/SDK/9.5/Samples/featured_effects.html
Last edited by a moderator: