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

Sage
Posts: 1,199
Joined: 2004.10
Post: #1
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/...3-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
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #2
Nice paper!
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #3
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

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Moderator
Posts: 522
Joined: 2002.04
Post: #4
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
Quote this message in a reply
Member
Posts: 469
Joined: 2002.10
Post: #5
I've seen that effect somewhere... can't quite put my finger on it.

---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
Quote this message in a reply
DoG
Moderator
Posts: 869
Joined: 2003.01
Post: #6
This is another nice paper describing volumetric billboards for nicer particle effects:
http://www.iit.bme.hu/~szirmay/firesmoke_link.htm
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #7
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...
Quote this message in a reply
Member
Posts: 100
Joined: 2006.05
Post: #8
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...
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #9
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).
Quote this message in a reply
Sage
Posts: 1,199
Joined: 2004.10
Post: #10
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.
Quote this message in a reply
Member
Posts: 446
Joined: 2002.09
Post: #11
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...
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  general blending versus texture blending questions WhatMeWorry 2 5,223 Dec 7, 2006 02:43 PM
Last Post: arekkusu
  Particle Engine bronxbomber92 9 3,828 Oct 16, 2006 03:44 PM
Last Post: bronxbomber92
  Particle trails LongJumper 6 3,353 Jun 29, 2005 12:42 AM
Last Post: LongJumper
  Additive/Subtractive blending mode for particle systems TomorrowPlusX 2 4,700 Dec 10, 2004 05:29 AM
Last Post: TomorrowPlusX
  Additive blending for flames Fenris 7 4,396 Jan 9, 2004 03:30 AM
Last Post: DoG