PDA

View Full Version : floating-point fbo: blending?



Vexator
07-12-2007, 01:14 PM
this scene is made up of three passes - an initial depth/ambience pass and two lighting passes.

i run this on a gf7800gt. if i render the scene to a fixed-point framebuffer, everything looks fine. if i switch to 16bit floating point, however, some parts are much too dark. i'm not sure if my card is supposed to handle blending in floating point fbo's (correctly/at all), but it seems to work at least for the lighting passes..

if it's not, how else can i apply post-processing effects like bloom to my multi-pass based renderer?!

GL_RGBA:
http://vexator.net/fixed.jpg

GL_RGBA_FLOAT_16:
http://vexator.net/floating-point.jpg

the final image is rendered by drawing a full-screen quad with this shader:


varying vec2 v_Coordinates;
uniform sampler2D u_DiffuseAlphaTexture;

void main()
{
gl_FragColor = texture2D( u_DiffuseAlphaTexture, v_Coordinates );
}thanks in advance!

edit: yes, all blending operations are done when the fbo is active.

AlexN
07-12-2007, 04:00 PM
Maybe you are outputting negative values at some point (could be a dot product that doesn't get saturated). With blending on a floating point buffer this could darken areas that would otherwise be unaffected with a fixed point buffer.

Vexator
07-13-2007, 07:23 AM
you're right - it was the normal/light vector dot product that was not saturated. thanks for the hint :)