PDA

View Full Version : Blending problem



JoshKlint
07-04-2009, 06:18 PM
I have two color textures and a depth texture in an FBO. I want to draw an alpha-blended object. I want to use the alpha channel of gl_FragData[0] for the alpha value when both color attachment 0 and color attachment 1 are blended. I need the alpha channel of color attachment 1 to store some other data. How can this be achieved?

It's a deferred renderer with the normals and specular value stored in the second color component. Writing the alpha value out into both color components' alpha channels would be wasteful, and force me to use one extra texture for specular values. Any ideas?

JoshKlint
07-06-2009, 08:39 AM
I can use glColorMask to disable alpha writing, while still using alpha blending, but I lose the ability to write out the specular component of the material. Without this, I can't do things like place a mud decal and have the watery parts shinier...it just uses whatever specular value is already written by the underlying surface.