RSS
 

Shadowmap LOD

18 Feb

ShadowmapLOD

This week I’ve been working on the LOD system for the shadowmaps…

Using the idea that I can have about 60-70 lights per area on the game, I can’t update 1024×1024 shadowmaps every frame… Well, I could, but I’d get 0.5 FPS (I tested it for fun)…

So, I decided to play with 4 variables:

  1. Multisampling: 16 samples per pixel take some time to render, even in today’s video cards, so I can’t have all lights multisampling
  2. Resolution: 1024×1024 to 64×64 shadowmaps give me quality on those that are near, but still have some quality on stuff that’s far away
  3. Update rate: Updating all shadowmaps (even the 64×64 ones) is slow, because of all the setup time, changing rendertargets, etc…
  4. Turning off shadows at a distance

Number 4 got removed from my LOD algorithm. The reason for this is that in some angles, the difference in lighting is actually pretty big… the shadows are necessary to keep the light confined to the room where the light source is.

So, what I do is that I do the nearest N1 lights with multisampling+256×256 shadowmaps+update all frames, then I do N2 lights with 128×128 shadowmaps+update every 4th frame, and so forth…

On my test case, I have 120 lights, and I defined that I could do 10 updates per frame… I defined circa 22 categories with different resolutions and update rates, and I set the category of each light per frame, based on distance.

On my video card (a NVidia GTX 465), I get about 200 FPS average with this scene (which is very simple, not many texture switches)… In a real case, this will of course not be the frame rate, with all the setup of objects, etc, but I still have some tricks up my sleeve (group up all static objects in a few DIP calls for shadowmap rendering, separating objects that might have alpha-test from the others so I don’t need to use texture swaps, change the criteria of the lights, even going back to not having shadowmapping in lights that are too far away).

Anyway, I’m very happy with the results, specially considering that the game will not feature a camera so close to the shadows as on the above screenshot. This, combined with the ambient occlusion map rendering, will probably be a good rendering solution for the game.

Now I’m going back to work on the editor I’ve been working on and off for one year… Never added 3d capabilities to it, so it will be a neat challenge, but I hope that in the next few weeks, my artist can start creating levels with decals and such stuff…

 
 

Tags: , , , , , , , , , , , ,

Leave a Reply

 
*