I want to run this algorithm by you guys before I try implementing it, just to make sure that this idea actually works.
One of the problems with shadow maps is that they have to be very large, usually, in order for them to generate good shadows (ie, without visible aliasing problems and so forth). This stems from the fact that the shadow map is drawn relative to the light’s position and orientation. It seems to me that this is not necessary.
It seems to me that one can do the following. To generate the shadow map, render the scene from the camera’s perspective as normal, but write the data to a texture. The “color” that you are writing is actually the radial distance to the light source. You will, also, be writing this out as the depth value from your fragment program. That way, fragments will be properly culled based on the radial distance to the light, not the actual z-depth of the pixels. BTW, the texture will be initialized to having some value to be considered “infinity”.
Once you have done this for every light, do your actual render, binding each lightmap texture to all of the rendering primitives. To check to see if a particular fragment is in shadow or not from the texture, compute the radial distance exactly as it was done before. Check this distance against what is in the texture. If the computed radial distance is less than or equal to the texture’s radial distance, then the fragment is illuminated.
Because all the computations are done in programs, there shouldn’t be much of a problem with depth-fighting issues. And, if there are, the shadow maps can be rendered using back-facing polygons just as easily as front (assuming all of the objects are closed volumes). Also, your shadow maps are only as large as the screen; there’s no longer a need to have massive shadow maps. Lastly, luminance (single-channel) floating-point textures can be used on fragment-program hardware to alieviate the issue of precision.
Is there something I’ve overlooked here? It seems way too easy to do (given the hardware, of course), and it seems like a virtually perfect method for doing shadow maps. If it were this easy to do camera-space shadowmaps, I think someone would have figured it out by now.