   deferred shading - light accumulation buffer
  Hi,Can someone  explain me what light accumulation buffer is in deferred shading terminology ? and what do you write into it ? what are the sources ?once I write this render target, how will I use it in my final color buffer ?ThanksMadan
  I have already implemented a deferred renderer, but i am not that sure about the exact terminology.From my understanding, a light accumulation buffer is simply a texture, where you render your intermediate lighting equation results to. So you write something like lightcolor to the rgb channel and the specular value to the alpha channel. If you have multiple light sources, you can additively blend those results onto the same texture. This is basically the lighting phase of deferred rendering.in your final color buffer you use the results of your light accumulation buffer and insert them in the final lightning equation which is most likely some pixelshader similar tofloat4 PS(VS_OUT input) : SV_TARGET0{float3 diffuseColor = g_color.Sample( LinearSamplerClamp,input.texC ).rgb;float4 light = g_light.Sample( LinearSamplerClamp,input.texC );    float3 diffuseLight = light.rgb;float specularLight = light.a;  float3 diffuse  = (diffuseColor * g_ambientFactor) + (diffuseColor * diffuseLight);    return float4(diffuse + specularLight, 1.0f);}where g_color = texture where material results were rendered to, and g_light is the light accumulation bufferat least this is the way i do deferred renderinghope this helps!ps: look at this tutorial - its basically for XNA, but it really helped me to understand the conceptsCatalin's XNA Experiments - tutorial deferred rendering in XNA;It looks like your g_color and g_light are same ?   ;  OK..heres what the killzone 2 slides say about light accumulation buffer..http://www.scribd.com/doc/6522844/Deferred-Rendering-in-Kill-Zone----------------------------------------------------------------Initialize light accumulation buffer with pre-baked light‣Ambient, Incandescence, Constant specular‣Lightmaps on static geometry‣YUV color space, S3TC5 with Y in Alpha‣Sun occlusion in B channel‣Dynamic range [0..2]‣Image based lighting on dynamic geometry ----------------------------------------------------------------I assume we blend all these components (multiply ?) in the shader for each opaque pixel !Now, my next question is how to get these maps or create a data set for these ... boy am I digging a hole for myself ??I request if someone can help me in understand these datasets or provide me links.Thanks,   ;Quote:Original post by aayudhIt looks like your g_color and g_light are same ?g_color and g_light are 2 different texture shader constants. This is DX10 not DX9 where (i think) the sampler determines which texture gets sampled.Quote:Original post by aayudhI assume we blend all these components (multiply ?) in the shader for each opaque pixel !they get additively blended together (as i said)Quote:Original post by aayudhNow, my next question is how to get these maps or create a data set for these ... i dont know if i got your question right, but if you want to know how to create the buffer - i dont know how this can be achieved in DX9Quote:Original post by aayudhboy am I digging a hole for myself ??dont know :-) but try to read catalins tutorial - its really great and helps you in understanding the key concepts a lot better..   ;  Thanks Mancubit ! very much appreciate your response !So basically this is the final color buffer ! Is that what you mean ? All this time I was assuming I needed to take this 4 RT's and do lighting pass into the color buffer (which was seperate)..Do you also know what would be a good source to learn how to do spherical harmonic lighting ?Thanks.   ;Quote:Original post by aayudhSo basically this is the final color buffer ! Is that what you mean ? yes, the rendertarget for the pixelshader i posted above would be the final color buffer (the framebuffer, which is presented on the screen). g_color in the code, would be the texture where material values were rendered to (e.g. simple "diffuse" color values, if simple texture mapping is used)Quote:Original post by aayudhAll this time I was assuming I needed to take this 4 RT's and do lighting pass into the color buffer (which was seperate)..this is one huge advantage of deferred rendering, that you can separate the lighting phase from everything else.Quote:Original post by aayudhDo you also know what would be a good source to learn how to do spherical harmonic lighting ?Thanks.sorry, i haven't got any experience with this, yet.[Edited by - mancubit on November 18, 2010 4:41:00 AM]