Tiled Forward Shading

I finally finished implementing both the tiled techniques, here it is running on 2048 and 4096 point lights respectively:

tiled forward 2048

tiled forward 4096 lights

So how about that implementation huh? Well, let’s go through it shall we?

Well first of all I started by doing a pre-z pass which fills the depth buffer, then I run the same compute shader as before where I construct a clip space frustum and check every light if they intersect the tile or not. Here’s where the main changes happen from tiled deferred. In the deferred technique I just looped through the lights and calculated lighting and then stored the final image in a texture which I blitted to the screen afterwards. Now I store the lights in a simple list that I then access from the forward shader, the setup looks a little something like this:


In this example there are 6 work groups in the x dimension and 2 in the y dimension. There are also a max limit of 4 lights per tile. So the entire grid setup is stored in two arrays, one that stores the  light index of lights that affect that tile and then one array that stores the size (or amount of lights) that affect a tile. These two arrays along with the original point light array is then accessed in the forward shader where you calculate which tile the current pixel is in by just dividing the fragments position by the work group size.  Using this setup you can just set how many lights you want to calculate per tile by increase the array setup, I should also mention that you could easily store all the lights in a tile, so say you have 1024 lights you just allocate that much memory, since it’s only one uint the size will still remain relatively small, which is also the reason for storing all the point lights in a seperate array as otherwise it would become quite big. I’m not sure if this is the best solution but it works rather well for lots of lights. I’ve since looked into other techniques where a linked list is stored which I might implement or at least understand how it works. For now I believe this is one of the simplest ways to implement this technique. From now on I will just make sure everything looks good for the final presentation as well as possibly implementing MSAA and running some tests on both techniques and see how they perform.

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *