View Full Version : Problems with Blending
11-15-2000, 01:41 AM
I am trying to to do some Blendig on my particles.
I used until now the glBlendFunc (GL_ONE, GL_ONE); blending mode which produced nice results.
The problem is that the results look only nice on black bagrounds. If I use a colored backround say a Blue plane and my particel texture is red/yellow, the result comes out white to purple. I think its the blending mode, because when I used the proposed in the red Book blending mode glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
it worked fine too but the particles did not blend the same i.e. did not glow like in the previous mode.
Is there any way to combine the particeles achieving the same effect as using glBlendFunc (GL_ONE, GL_ONE); but without having the bachground color screw everything
Thanks in advance
11-15-2000, 03:22 AM
I may be wrong, but try:
11-15-2000, 03:46 AM
I tried that too, but I had the same problem.
I need a way to prevent the background to be blended with all the particles.
11-15-2000, 04:05 AM
How about GL_DST_COLOR & GL_ONE (by the way some cards don't support destination factors for the source parameter). Its not really what you want but it may be better than just GL_ONE & GL_ONE.
11-15-2000, 05:35 AM
right at the moment, I can't see any direct way of rendering such particles ;
maybe you could try accumulating particules brightness in destination alpha (blending with GL_ONE, GL_ONE ; and particules with only alpha component) and then blend a quad that covers every particle with something like GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA ; of course you can only have particles with the same color. Just a thought, don't know of its value http://www.opengl.org/discussion_boards/ubb/smile.gif
or, hmm, perhaps plot our particles before any other geometry ; but I think it could cause troubles ...
03-03-2002, 07:26 AM
Hi guys !
I'm dealing with fire particles and blending right now and as I roamed in the past topics I saw this one and here I am with with the same damn problem ! anyone got an answer ?
The best two combination I found are
but the problem is that the first one doesn't give the "glow" effect you know...cause it's not an additive blending mode I guess...
the second one gives a great glow effect !
BUT the color of my fire changes depending on the color of what's behing the fire...so in front of my sky the fire looks purple ! not a great color for a fire !
hahaha anyone got any idea about that kind of problems ? I'll continue looking for it myself but If someone has an answer let me know ! thanks guys (or girls...which are highly rare)
*Let's have a funny day*
03-03-2002, 07:51 AM
The reason "add" works like "glow" is that it's like it's emitting light.
The reason your texture changes color on different backgrounds is that, well, blue plus red plus green makes white. The light from the background passes through your "glowing" particle and adds to it. The way to fix this is often to make the particles much darker in their texture than you want them on screen -- because they'll add whatever's behind them when you draw.
You can make SRC_ALPHA and ONE_MINUS_SRC_ALPHA work well, but you'll probably find out that you have to paint all your backgrounds in darker textures than what you're doing now, and make the particle colors really bright. That's because, well, that's how fire works in reality (in relative terms).
One mode which may help a bit with the color blending while still doing the glow would be GL_SRC_ALPHA, GL_ONE, or doing SRC_ALPHA, ONE_MINUS_SRC_ALPHA, and making the src alpha never go above about 30%.
Anyway, the problem you're having with it "not looking right" probably needs to be cured in your artwork, not in your blending modes! Texture mixing/compositing/blending, on an art level, is rather unintuitive the first time you have a go at it.
Powered by vBulletin® Version 4.2.2 Copyright © 2014 vBulletin Solutions, Inc. All rights reserved.