Thomas Wrote:There is never any redrawing of any geometry or anything like that. All I do is to render the scene to shadow map (from the perspective of the light) using a single "forward rendering" pass, which is something you are doing as well and something that must be done. To cut down on overdraw in this state I make sure to render front to back (so that the z test will discard most fragments) and I also do occlusion culling.
Assuming I have gotten all of your stuff right then I am afraid that I cannot see any reason why your method would give any speed ups. If you are using a deferred shader then u can get the view space position (and must do this for attenuation anyway) in the light shader and can use that to calculate if the fragment is occluded (or level of occlusion, if several samples are used).
hmmm, from the sounds of it, we are not exactly doing the same thing but it appears to be similar. Out of curiosity, are you preforming a matrix multiplication inside the pixel shader to preform shadowing? Because if so I think I understand your method.
I know that occlusion and z-sorting is done, and I previously did the same thing. Frankly, I'm not entirley sure why I got such an enourmous speed up from the method. I would have to do more reasearch on how graphics cards render on a vertex->pixel level. What I can say is that when sampling a huge resolution depth map in the deferred method (2048 x 2048), it only droped the framerate 8 fps, and a (4096 x 4096) depth map only dropped it 15 fps from the origional. This is compared to forward that at 2048, dropped an entire 25 fps and with a 4096 depth map, it became unplayable. Another thing I had to consider was the possiblity of multiple shadow casters, which at higher resolutions was out of the question with forward shadowing.
In theory, it does make sense that there would be no advantage as long as proper occlusion culling and z-sorting was used, but the same can be said about deferred lighting as well.