|
Hello all. After looking at the explicit OpenGL blend functions at modwiki and experimenting with them, I found 2 useful blend methods that may come in handy. And just to make sure, I did a search but I didn't find anything particle related.
Most of you probably know the two main blend methods for particles, blend (gl_src_alpha, gl_one_minus_src_alpha) and add (gl_one, gl_one) as they are really the only two. For the blend method blend to work properly, you need a transparent texture with an alpha channel, and for add to work you need a texture with a black background.
However, with the explicit blend method gl_src_alpha, gl_one (add_alpha), you can use a transparent texture and render it exactly the way add does, by adding color value over what it is being rendered over.
The first advantage with this method is that you can already use an existing texture with a transparent background without having to create another version with a black background, so you can make extra use of that texture while saving space and reducing clutter in the particle folder. The other advantage is that while it renders additionally, it responds to alpha masking, so you can fade it in or out either by color value or by alpha (or both).
The one main problem I had with the blend method add was that if you wanted it to fade in and out properly and smoothly, the fade color had to be set to 0 0 0 0 (with alpha being irrelevant), so it was strictly fading to or from any given vertex color given (or entity color). With this method, you can have a particle spawn for example as green and fade out as red, or whatever color you wish while fading it in and out perfectly via the alpha channel. So like, 1 1 1 1 to 1 1 1 0.
So far, it does everything add does and more without any odd effects. I say that because there were other methods I found that worked but had issues so they shouldn't really be used, although there is another working method...
If you want another blend method to use, here is something else you may like. gl_one, gl_one_minus_src_color (add_hue?), which renders like add but looks somewhat opaque still, and the color is lightly saturated, creating a washed out look. You could say it gives it a hue instead of a color really unless you pick a color that is heavily saturated. It requires a texture with a black background, and does not respond to alpha masking, so it is basically like another version of add. Try it if you are curious. It works best with a cloudy texture, such as textures/particles/dustcloud.
All this was done trying to find a way to have an inverse of add and somehow subtract color value, just for the sake of curiosity. I was not successful haha.
So yea, if gl_src_alpha, gl_one is what I think it is capable of, the blend add method is actually inferior when applied to particles. Use that instead and don't make two versions of one texture for the sake of add, unless you want to use gl_one, gl_one_minus_src_color, the you will need it. Add is still perfectly fine for other textures like for models and such, just in defense of my critique, though this method may work just as well.
I hope this was insightful and helpful, and not a repeat of something ya'll already knew. Take care!
_________________ Doom 3 editor noob. Doom 3 - Day 75 [HD] Particle editor/editing | Phrozo Weapons Mod
|