Monday, April 19, 2010

Got Stencil Light Volumes to work


Finally got the stencil buffer to work. This will allow me to save some lighting time by not doing lighting computations on unlit pixels. The only drawback is that each light volume has to be drawn twice, which shouldn't really be too bad.

However, I'm not using stencil light volumes for the speedup primarily - since I'm going to be reflected light volumes off of surfaces, almost the entire scene is going to have some contribution of light, and the stencil light volumes won't make much of a difference in rendering time. However, I can use stencil light volumes to precisely determine which lights are actually lighting a given pixel.

I'm going to start using a lighting technique called Light Indexed Deferred Lighting. The paper on it is here. I render each light volume with a different color, which is used for an array lookup to get the properties for that light. With alpha blending and bit-packing, I can have multiple overlapping lights (up to 16 with 4 render targets), which I'll need.

No comments:

Post a Comment