PDA

View Full Version : Blending Strangeness



plucky
01-23-2001, 04:12 PM
hey everyone,

i'm having some wierd blending artifacts in opengl and i can't figure out why, so hopefully someone here will have some insight...

here's the deal, i'm rendering the particles in a particle system as texture mapped triangle pairs, and the blend mode is set to (GL_SRC_ALPHA, GL_ONE) but when a bunch of particles are rendered on top of each other, the seperate textures are distinctly shown, instead of all the particles blending into each other with no visible distinction between each individual texture mapped triangle...

i hope that made some sense... i could send a small demo to show the effect if my explanation didn't make it clear enough...

i've tried various combinations of blending modes and they all have the same problem...

thank in advance

Rob The Bloke
01-23-2001, 06:01 PM
Blending is dependant on the order in which you draw the particles. You should (ideally) draw the most distance particles first, moving up to the one nearest the viewport.

plucky
01-23-2001, 06:18 PM
that could be the problem...

in this case, i'm just rendering all the particles in the same plane... so i suppose it could be z-fighting... but (altho i may be wrong) i don't think that's the problem... basically it just looks like the textures are blocking each other out, for example, the texture i'm using is a little white 'flare' kind of texture... you can see where one texture starts and the next begins... geez this is hard to explain...

the executable and texture file are only a bit over 200K so if someone wants to take a look at it, i can email it quite easily... (assuming that they would have the most recent glut dlls)

thanks again

---brian

dufke
01-24-2001, 07:08 AM
Originally posted by plucky:
basically it just looks like the textures are blocking each other out, for example, the texture i'm using is a little white 'flare' kind of texture... you can see where one texture starts and the next begins... geez this is hard to explain...


This sounds like depth buffer writes are on. GL will only draw the frontmost particle. You should turn depth buffer writes off when drawing particles. (glDepthMask(GL_FALSE)). But don't turn the depth test off, since it will make your particles draw inside your geometry.
Hope it works,
David.

Punchey
01-24-2001, 07:24 AM
And be sure you're calling glEnable(GL_BLEND); first.

plucky
01-24-2001, 12:31 PM
depthmasking seems to have done the trick... thank you very much!!

--brian

[This message has been edited by plucky (edited 01-24-2001).]