PDA

View Full Version : Good Blendmodes for particleeffects.



Jan
12-19-2006, 06:33 AM
Hi there

Currently i use for particles either additive blending (glBlendFunc (GL_SRC_ALPHA, GL_ONE)) or transparency (glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)).

Are there any other good blending-modes for particle-effects?

For example, when i want to have water-effects, it's difficult to get them look the way i want. I don't want water to glow in the dark (additive), but i am also not satisfied with the transparency-look.

Any suggestions?
Thanks,
Jan.

k_szczech
12-19-2006, 07:30 AM
Typically, when particle is some kind of light source (sparkles, fire) then you can use additive blending, but if it's some kind of occluding particle (smoke, dirt) then standard alpha blending should be used + sort particles by z.

What kind of water effects do you have in mind?

Jan
12-19-2006, 09:39 AM
Yeah, that's what i do already, works fine for most effects.

I wanted to create some water-splash effects, like when some object hits a water-surface. The problem is, that with transparency i don't get it to look dense and like water, it always looks more like smoke. With additive blending it looks dense, but the colors saturate and then it often looks more like a magic spell.

I don't know, maybe it could be solved with better textures, i don't have really good textures, but i'm not sure.

Jan.

k_szczech
12-19-2006, 10:50 AM
A common mistake is to make some effects without actually spending some tome to look at them in real life. I suggest you take a look at real photos of such splashes.

Very small objects will produce a thin "crown" and multiple droplets.
http://www.raindropimage.com/thumbs/23.jpg (http://www.raindropimage.com/pics/23.jpg)
Such effects should be done using a set of polygons that form an outline of such crown, with everything painted on them using texture (normalmap + thickness map) - a shader could then apply lighting / scattering effects. It would be also great to support reflections/refractions.

Medium and large objects will create a dense "cloud".
http://images.google.pl/images?q=tbn:3LMgFO_litqamM:http://www.wetasschronicles.com/Flying%2520Motorboat.jpg (http://www.wetasschronicles.com/Flying%20Motorboat.jpg) http://images.google.pl/images?q=tbn:1EB2TGdrkHBWFM:http://www.terrawind.com/web3424big%2520splash.jpg (http://www.terrawind.com/web3424big%20splash.jpg) http://www.sfot-source.com/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=826&g2_serialNumber=2 (http://www.sfot-source.com/gallery2/main.php?g2_view=core.DownloadItem&g2_itemId=827&g2_serialNumber=2)
In this case you actually have so many droplets, than it makes no sense to use such large number of small particles. So you just use a texture with many droplets on it. Atually these droplets should cover texture almost completely near it's center.
You could probably get very good results if you do a good comet first, and then just throw many comets in different directions. A shadowmap is a must if you want realistic shadowing.

I actually use some noise brush, but my foam is VERY simple - I have just one texture with random points on it. Note that this texture has a high alpha value where droplets are. Few such textures overlayed will produce a dense cloud.
These are screenshots from my game:
http://www.ks-media.ehost.pl/images/boats/screen/01sm.jpg (http://www.ks-media.ehost.pl/images/boats/screen/01.jpg) http://www.ks-media.ehost.pl/images/boats/screen/06sm.jpg (http://www.ks-media.ehost.pl/images/boats/screen/06.jpg)
The foam thrown in the air behind boats is done using standard blending. Additionally I give particles thrown lower a little bit of blue color.
Yeah, I know it's very simple. Wish I had more time to make some real dynamic splash shapes and realtime light scattering.

The key is proper (high enough) alpha value to make foam dense enough - note that in my game it's not dense as it should be, because I didn't want separate particles to be too visible.

As for night/day you should only modulate the color of droplets, and not their alpha value.