Saturday, February 14, 2009

My Variant of Light Pre-Pass Renderer

About Light Pre-Pass Renderer you can read here:

http://diaryofagraphicsprogrammer.blogspot.com/2008/03/light-pre-pass-renderer.html

I like this idea, but I don't like reading normalmap in depth/normal pass. 

My idea to store light directions multipled withN.L, without normalmap reading. 

Geometry pass to MRT(R16F, R8G8): 
In R16F we write linear depth: 
Out.Depth = In.PositionViewSpace.z / zFar; 
In R8G8 we write view space normal:
Out.NormalXY = 0.5 + 0.5 * mul(float3(0,0,1), TBN).xy; 

R16F we need for fast post-process effects speed. 

Then lighting pass: 
 Render light volumes to MRT (A16B16G16R16F, A8R8G8B8) 
 Read depth, normal; 
 Compute LightDir, LightAttenuation and N.L; 
 Out.Dir = LightAttenuation * LightDir * N_dot_L; 
 Out.Color = InLightColor * N_dot_L; 

Then color geometry pass to a A8R8G8B8: 
 Read LightDir, LightColor from LightDirBuffer and LightColorBuffer; 
 Compute N.LightDir, R.LightDir; 
 And final light geometry;
++ Dont need read normalmap in depth/normal pass; 
-- Problems only with specular when crossings more then 2 lights; 
Your opinions? 

Here is some results:

No comments: