"Controlled Additive Blending", or, awesome particle system trickery

A long time ago I asked on this forum if it was possible somehow to interpolate between additive blending ( GL_SRC_ALPHA, GL_ONE ) and normal blending modes ( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA ). I asked it here:

Long and short of it is that it's possible, and it's easy! And you can even do it in the fixed-function pipeline ( which is satisfying, even though I do most everything with GLSL nowadays ).

So, I decided to take a few days and write a particle system using this technique for my robotics visualization engine ( well, not the "soft particles" bit, though I probably will implement that soon enough ).

Yeah, I did something similar to that using premultiplied RGBA textures. It was annoying to do without proper tools though. In particular, Photoshop likes to replace fully transparent areas with a solid color. I had to work with a combination of Photoshop and Graphic Converter to make it work. Then I never even used it.

Skorche Wrote:Yeah, I did something similar to that using premultiplied RGBA textures. It was annoying to do without proper tools though. In particular, Photoshop likes to replace fully transparent areas with a solid color. I had to work with a combination of Photoshop and Graphic Converter to make it work. Then I never even used it.

Flaming Pear's free Solidify plugin really helps for preparing textures with alpha for OpenGL. Solidify the "transparency" and stick the mask in the alpha channel.

I posted because I had found that paper on using a single blending mode and some alpha premultiplication trickery to get both additive and traditional blending without the need to toggle gl blending states. If this trick is common knowledge, I'm sorry for spamming...

TomorrowPlusX Wrote:I noticed this as well, but it's easy enough to toggle to black fog when rendering the system and back to the original fog when done.

Are you sure this works in all cases? I remember playing with this way back when and although switching to black fog for this pass "fixes" the additive parts there are problems with the premultiplied areas (i.e. they can render too dark). I'll have to try this again, perhaps I missed something...