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.

6 Responses to Deferred lighting.

  1. Hello friends, its great piece of writing on the topic of teachingand fully defined, keep it up all the time.

  2. Since the admin of this web site is working,
    no doubt very rapidly it will be well-known, due to its feature contents.

  3. I constantly emailed this weblog post page to all my
    contacts, for the reason that if like to read it next my friends will too.

  4. I think this is among the most important info for me.
    And i am glad reading your article. But want to remark on few general things,
    The web site style is ideal, the articles is really excellent : D.
    Good job, cheers

  5. you are actually a excellent webmaster. The site
    loading pace is incredible. It kind of feels that you are
    doing any distinctive trick. In addition, The contents are masterwork.
    you have done a magnificent activity in this subject!

  6. Thanks in favor of sharing such a pleasant thinking,
    piece of writing is pleasant, thats why i have read it fully

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>