Original Post
Ok so I've made an implementation of shadow mapping, but I'm noticing some serious artifacts. I'm sure this problem has been solved before, so I'm hoping someone experienced can point me in the right direction. Step 1, I get it working without any biasing, and I get this(light source is above): http://www.geocities.com/terrence321/SM1.jpg There are two major sources of visual artifacts that I know of: self-shadowing problems, and projective aliasing. The self-shadowing problems account for all the pixely garbage on the lit surface of the sphere, while projective aliasing appears right on the border of the shadow, in the places where the normals of the sphere are nearly perpendicular to the light direction (and thus there isn't good projective sampling there). So, I add biasing to fix those two problems, and get something like this: http://www.geocities.com/terrence321/SM2.jpg The self shadowing errors are gone, and the borders are a lot cleaner. The main problem now is that due to what I assume is my biasing, some of the shadow is getting taken off. When the light source is moved sufficiently far away, the shadows now completely disappear! I can partially solve this by adding a diffuse lighting model, and simply choosing the light value per-pixel as the minimum of the shadow value and diffuse value. Then I get this: http://www.geocities.com/terrence321/SM3.jpg The problem is, this only fixes the missing shadowing on each object. If the camera gets more than a few hundred world units away, the shadows on the ground completely disappear! What can I do to strike a balance between biasing to remove artifacts, and accuracy so my shadows don't disappear? Note my ultimate use for this system will be in an RTS game, so the light source should ideally be from roughly above at an infinite distance. Thanks a lot for any advice. Terrence