I’m implementing deferred lighting. My models contain several texture layers including:
So I should render these layers to 8 color buffers using FBO:
I also need to output the scene to another buffer. So I need 9 out qualifiers.
My old graphics card (Geforce 9600) supports 8 out qualifiers. So if I try to output another out qualifier, I get this error:
error C5041: cannot locate suitable resource to bind parameter “myVec48”
How can I solve this problem?
Well looks like I can use one draw buffer to render all of the textures. Am I correct? For example:
myVec43 = vec4((diffuseColor.xyz + GlossColor.xyz ) * 0.5, 0.0);
In order to blend diffuse and gloss colors.
First of all, you don’t need to write a position buffer. You can restore the view space position from the fragment xy position and the value from the depth buffer.
Second of all, what is the difference between “normal” and “normal map”? Normal mapped materials can simply write the perturbed normal to the G-Buffer instead.
Third, you don’t use a shadow map for your G-Buffer pass. One big advantage of deferred lighing is the fact that objects don’t need to know anything about light or
shadow caclulations. During the light pass you can generate a shadow map for the light you are currently rendering and use that. No need for per-light shadow maps
during the G-Buffer pass.