Sunday, 14 June 2009

Light Pre Pass Rendering

Iv been looking at light pre pass rendering as described here and started playing round with it. The basic concept is:
  • On you z pre pass, render mesh normals and depth into a render target.
  • Then using this rendertarget you obtain the normal of a surface and the world position ( pos = mul( float4( In.Tex.xy, depth, 1.0 ), matInvViewProj ) ) and can render the lights into the back buffer.

This is as far as I have got. After this the idea is to render the scene again adding the objects material data ( albedo (texture colour ), reflections etc) to the backbuffer (which already has the light data in it). The advantage over deferred endering is that you dont need a huge G-Buffer, which is good on platfoms like the xbox 360 where there is a fixed frame buffer size.

The backbuffer containing a single directional light:

The pre pass buffer rgb channels(normals ):

The pre pass buffer alpha channel (depth):