   Deferred rendering and antialiasing
  I'm thinking of switching to deferred rendering for my game, and this gave me an idea...Say we lay out the G-buffer and we use deferred rendering to calculate only the lighting, and saving it into an HDR buffer. We can perform bloom in that buffer if we want. After that, we do only one additional pass, rendering the geometry with the materials, and in the end we additive blend those 2(lighting+materials). Am I correct to think that we will have proper anti-aliasing in that case(seeing as the final material pass *will* have antialiasing)? If so, I think it would be a good idea at least for my case, since it's only 1 additional pass. What do you think?   
  That's almost how light-pre-pass works, which is becoming popular on consoles now-a-days for deferred+MSAA =DYou create a GBuffer with depth, normals (and spec-power if you can fit it in), then use that to generate a Lighting Buffer (RGB = Diffuse light, A = specular). To keep the buffers small, you don't get properly coloured specular, but guessing from the diffuse color is close enough.Instead of blending the LBuffer and the material-pass, you sample the LBuffer in the material pass.vec4 lighting = tex2d( LBuffer, screenPos )vec3 diffuse  = lighting.rgb * diffuseMap.rgb;vec3 specular = lighting.aaa * light.rgb * specularMap.rgb;return vec4( diffuseLight + specularLight, diffuseMap.a );  Thanks for the link! I had no idea people were already doing this, that's reassuring. I'll go ahead and implement it then :)About sampling the light buffer, at first I thought of doing exactly that, but if I want to implement a bloom filter of the light buffer, this would obviously not work, since bloom is visible beyond the boundaries of the polygon. Apparently I can't apply the bloom after the material pass, since I would run into the same situation again as I have in the beginning- poor MSAA support for render-to-texture. Now, if I were to store the specular value in the alpha channel of the LBuffer, simple blending wouldn't work, but I think a short 2-pass filter where I first multiply with diffuse and then add specular should do it I think.   ;  You can still do bloom as a post effect, after the second geometry pass. At this point, all of your geometry has been rendered with MSAA, and your post-effects (bloom) work on the resolved AA buffer. AFAIK, MSAA supporte for render-to-texture is pretty good -- the reason it's not used in deferred rendering is because AA is designed for colors, not positions/normals/etc that you put in the GBuffer.However, you could perform your blur filter just on the LBuffer (before the second geometry pass), but this will produce slightly different results.e.g. imagine a red sphere, lit by a green spotlight, with a grey background.With post-bloom: In the final buffer, the sphere's color is red*green==black, which won't be bloomed.With pre-bloom: In the LBuffer the sphere's color is green, which will be bloomed onto the grey background.I guess it's a matter of taste which effect is "correct"?   ;Quote:Original post by HodgmanYou can still do bloom as a post effect, after the second geometry pass. At this point, all of your geometry has been rendered with MSAA, and your post-effects (bloom) work on the resolved AA buffer. Yeah, you're right. Thanks :)Quote:AFAIK, MSAA supporte for render-to-texture is pretty good -- the reason it's not used in deferred rendering is because AA is designed for colors, not positions/normals/etc that you put in the GBuffer.Well, I guess it's in the GL3.2 core, but I don't know what range of hardware supports it...I'll look into it.;Thank you for the idea and the prepass details. It finally makes sense to me now to do such a thing [smile]