iDevGames Forums
"Controlled Additive Blending", or, awesome particle system trickery - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: "Controlled Additive Blending", or, awesome particle system trickery (/thread-3304.html)



"Controlled Additive Blending", or, awesome particle system trickery - TomorrowPlusX - May 3, 2007 02:07 PM

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:

http://www.idevgames.com/forum/showthread.php?t=7924

I figured out crappy workarounds using multiple particle systems and forgot about it. Last week, while googling for some unrelated particle system stuff, I found this paper:

http://wscg.zcu.cz/WSCG2006/Papers_2006/Short/A73-full.pdf

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 ).

Here's a screenshot:
[Image: Particles.png]

And here's a movie of it running:
http://zakariya.net/shamyl/etc/ParticleApp.mov

I'm really excited to finally be able to have a good looking particle system, with proper blending, depth sorting, and efficient memory use.

Anyway, if anybody's angry about blending in particle systems, check out the paper I linked. It really opened my eyes Love


"Controlled Additive Blending", or, awesome particle system trickery - AnotherJake - May 3, 2007 04:37 PM

Nice paper!


"Controlled Additive Blending", or, awesome particle system trickery - Skorche - May 3, 2007 04:55 PM

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. Rolleyes


"Controlled Additive Blending", or, awesome particle system trickery - aarku - May 3, 2007 08:30 PM

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. Rolleyes

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.

http://www.flamingpear.com/download.html

Cheers,
-Jon

p.s. Nice burning Grin


"Controlled Additive Blending", or, awesome particle system trickery - kelvin - May 8, 2007 04:58 PM

I've seen that effect somewhere... can't quite put my finger on it.


"Controlled Additive Blending", or, awesome particle system trickery - DoG - May 9, 2007 03:52 AM

This is another nice paper describing volumetric billboards for nicer particle effects:
http://www.iit.bme.hu/~szirmay/firesmoke_link.htm


"Controlled Additive Blending", or, awesome particle system trickery - TomorrowPlusX - May 9, 2007 05:38 AM

kelvin Wrote:I've seen that effect somewhere... can't quite put my finger on it.

It certainly does look like your avatar Rasp

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...


"Controlled Additive Blending", or, awesome particle system trickery - Nevada - May 9, 2007 07:15 AM

I think it should be put in the resources sticky. Given that I wasn't the one who found it, I feel I shouldn't steal your glory...


"Controlled Additive Blending", or, awesome particle system trickery - Frank C. - May 9, 2007 11:42 AM

TomorrowPlusX Wrote:If this trick is common knowledge, I'm sorry for spamming...
It was common knowledge - back in the 90's when it was the only blend mode available in QuickDraw3D Wink

I *think* there are some issues with this type of blending in OpenGL if you're using glFog (well, other than black fog).


"Controlled Additive Blending", or, awesome particle system trickery - TomorrowPlusX - May 10, 2007 10:20 AM

Frank C. Wrote:It was common knowledge - back in the 90's when it was the only blend mode available in QuickDraw3D Wink

Weird...


Frank C. Wrote:I *think* there are some issues with this type of blending in OpenGL if you're using glFog (well, other than black fog).

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.


"Controlled Additive Blending", or, awesome particle system trickery - Frank C. - May 10, 2007 11:09 AM

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...