Deferred lighting.

My forward rendered lighting setup almost suited my purposes, but it turned out that the limitations of the XBOX CPU limited me to far too few terrain chunks, and therefore far too few lights.

Maximum of 7 lights touching each chunk in the terrain shader, but chunks were far too large due to CPU limitations on the XBOX.

To this end, I’ve been exploring some deferred lighting options.

For the Xbox 360, an attractive option is light-pre-pass, which suits the Xbox much moreso than a fully deferred setup, as LPP uses less intermediate texture buffering, and therefore avoids Xbox 360 texture bandwidth limitations, and avoids predicated tiling issues.

J. Coluna has a good LPP example, and he was wondering how to deal with the problem of being limited to 32 bit render target formats on the Xbox 360, yet wanting to store specular light data in the light buffer (for which I use HDRBlendable, on the xbox this format stores 10 bits for RGB and 2 bits for alpha).

If we had a 64 bit rendertarget, we’d have 16 bits for each channel, and (monochrome) specular color could be stored in the alpha.

On the xbox we have only 2 bits in the alpha.

I am currently not using a dedicated specular channel. Instead I’m accumulating specular in the light buffer RGB channels. This means that you can’t use a specular strength map, and it means that you can more easily exceed the HDR “overbright” limits, since specular highlights are often close to full brightness (or at least, they are always brighter than the diffuse color). However, it does allow you to have colored specular highlights, which a single specular channel does not.

One idea I’ve been considering to work around this, is to pack the specular into the 1010102 format using the 2 bit alpha, plus 1 bit in R and 1 bit in B. Then, I would apply half of the specular to the RGB channels, and store the other half in RBA (4 packed bits total).

Then your specular strength maps can at most reduce specular highlights by half.

However, if we are willing to sacrifice some range on the specular highlights, and use only 6 bits for specular, we can apply 25% of the specular to the RGB channels, and then store the remaining 75% of the specular packed in RBA (4 bits worth). This would allow specular strength maps to reduce specular highlights by up to 75%, which is probably enough for decent results.

One drawback to this method is that we lose 1 bit of red and 1 bit of blue channel information. This means that for red and blue, lights can more easily reach the HDR overbright limit.

Which method suits your purpose depends on your application.

Part of the benefit of the LPP method, is that we can avoid much of the texture bandwidth requirements that a full defferred setup requires — making this a better fit for the XBOX. For this reason, I’ll be avoiding using a second texture to store specular.

This entry was posted in XNA and tagged , , , . Bookmark the permalink.

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>