JoshKlint
10-21-2010, 10:57 AM
I started a topic on this a while back, and now I want to ask if OpenGL3/4 offers any solution to this problem.
I use alpha blending in my deferred renderer for things like roads and decals, before lighting is performed. It works because the depth of the two blended surfaces is the same, and the normals and diffuse colors just get blended. Lighting is performed on the resulting values, and works just fine.
The problem is that to use alpha blending, each color attachment must write the alpha value into the alpha channel, of each attachment.
Here's the gbuffer format I want to use:
Color0 - RGBA8 (4 bytes)
R - diffuse red
G - diffuse green
B - diffuse blue
A - diffuse alpha
Color1 - RG11B10 (4 bytes)
R - normal x
G - normal y
B - normal z
Color2 - RGBA8 (4 bytes)
R - emission red
G - emission green
B - emission blue
A - specular intensity
Total = 12 bytes
Here's the gbuffer format I must use:
Color0 - RGBA8 (4 bytes)
R - diffuse red
G - diffuse green
B - diffuse blue
A - diffuse alpha
Color1 - RGBA16F (8 bytes)
R - normal x
G - normal y
B - normal z
A - diffuse alpha
Color2 - RGBA8 (4 bytes)
R - emission red
G - emission green
B - emission blue
A - diffuse alpha
Color3 - RGBA8 (4 bytes)
R - specular intensity
G - extra
B - extra
A - diffuse alpha
Total = 20 bytes
Is there any way to gain more control of blending in OpenGL 3/4 so that the alpha channel doesn't have to be wasted like this?
I use alpha blending in my deferred renderer for things like roads and decals, before lighting is performed. It works because the depth of the two blended surfaces is the same, and the normals and diffuse colors just get blended. Lighting is performed on the resulting values, and works just fine.
The problem is that to use alpha blending, each color attachment must write the alpha value into the alpha channel, of each attachment.
Here's the gbuffer format I want to use:
Color0 - RGBA8 (4 bytes)
R - diffuse red
G - diffuse green
B - diffuse blue
A - diffuse alpha
Color1 - RG11B10 (4 bytes)
R - normal x
G - normal y
B - normal z
Color2 - RGBA8 (4 bytes)
R - emission red
G - emission green
B - emission blue
A - specular intensity
Total = 12 bytes
Here's the gbuffer format I must use:
Color0 - RGBA8 (4 bytes)
R - diffuse red
G - diffuse green
B - diffuse blue
A - diffuse alpha
Color1 - RGBA16F (8 bytes)
R - normal x
G - normal y
B - normal z
A - diffuse alpha
Color2 - RGBA8 (4 bytes)
R - emission red
G - emission green
B - emission blue
A - diffuse alpha
Color3 - RGBA8 (4 bytes)
R - specular intensity
G - extra
B - extra
A - diffuse alpha
Total = 20 bytes
Is there any way to gain more control of blending in OpenGL 3/4 so that the alpha channel doesn't have to be wasted like this?