PDA

View Full Version : Performing signed-add blending



OrangyTang
11-19-2009, 03:41 AM
Does anyone know if it's possible to do a signed-add blend mode? Preferably with something <2.0 since I'm after good hardware compatibility, especially integrated intel chips from a few years back.

I'm after something along the lines of (assuming everything in the range [0,1] ):

framebuffer.rgb = (framebuffer.rgb * 2 - 1) + (fragment.rgb * 2 - 1)

Ideally the fragment alpha would be multiplied by the fragment.rgb beforehand, but I can probably hack around that if it's not possible.

The closest I can come up with at the moment is splitting it into two passes, one with regular additive and one with Ext_blend_subtract, but obviously that's not ideal and requires some preprocessing to split my textures up into their +ive and -ive components.

Any hints appreciated. Thanks.

Alfonse Reinheart
11-19-2009, 10:57 AM
What happens if your framebuffer is an FBO that uses a signed-normalized format?

OrangyTang
11-19-2009, 11:14 AM
Er, not sure. I'm trying to keep this as low-tech as possible so I'm trying to avoid the use of FBOs and odd texture/framebuffer formats.

Is that a known solution for this problem?

Alfonse Reinheart
11-19-2009, 11:25 AM
No. Not without using real, semi-modern hardware.

OrangyTang
11-20-2009, 01:57 AM
Dang. I was hoping to find some cunning combination of EXT extensions I've never heard of could do the trick. It feels like this shouldn't be too hard and available on older hw, as it's just regular additive blending but with an offset, but I have nothing to actually base that on. :)