"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:
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]](http://zakariya.net/shamyl/etc/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
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]](http://zakariya.net/shamyl/etc/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
Nice paper!
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.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
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.
http://www.flamingpear.com/download.html
Cheers,
-Jon
p.s. Nice burning
I've seen that effect somewhere... can't quite put my finger on it.
---Kelvin--
15.4" MacBook Pro revA
1.83GHz/2GB/250GB
This is another nice paper describing volumetric billboards for nicer particle effects:
http://www.iit.bme.hu/~szirmay/firesmoke_link.htm
http://www.iit.bme.hu/~szirmay/firesmoke_link.htm
kelvin Wrote:I've seen that effect somewhere... can't quite put my finger on it.
It certainly does look like your avatar
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...
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...
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

I *think* there are some issues with this type of blending in OpenGL if you're using glFog (well, other than black fog).
Frank C. Wrote:It was common knowledge - back in the 90's when it was the only blend mode available in QuickDraw3D
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.
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...
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| general blending versus texture blending questions | WhatMeWorry | 2 | 4,238 |
Dec 7, 2006 02:43 PM Last Post: arekkusu |
|
| Additive/Subtractive blending mode for particle systems | TomorrowPlusX | 2 | 3,951 |
Dec 10, 2004 05:29 AM Last Post: TomorrowPlusX |
|
| Additive blending for flames | Fenris | 7 | 3,842 |
Jan 9, 2004 03:30 AM Last Post: DoG |
|

