Advertisement

Blending particles

Started by July 19, 2001 07:29 PM
1 comment, last by BLZBub 23 years, 7 months ago
Hi there! I have just written a particle system which uses textured quads. I''m loading a tga and blending it using: glDepthMask(0) glBlendFunc(GL_SRC_ALPHA,GL_ONE) renderparticles() glDepthmask(1) this blends the particles nicely, but I have models behind the particle system which should be partially obscured but are not due to the depth mask. What is the best way to get around this??? Thanks in advance!
The models aren''t obscured becuase you''re only adding color a''la a light effect. If you wanna obscure the background, you''ll need to use your source alpha to block out the background. GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA would seem to be appropriate (altho I like GL_ONE, GL_ONE_MINUS_SRC_ALPHA). This has the effect, tho, of making your particle drawing order somewhat important. You may need to sort your particles to draw back to front, but that''ll depend really on the actual effect you''re looking for.

What are your particles simulating?
Advertisement
Thanks for your reply!

I had a look at my code and realised that I was drawing the particles before the game objects and not disabling sphere mapping - doh!

I actually found that GL_SRC_ALPHA,GL_ONE was the one to use for my purposes....but thanks again for your help!

This topic is closed to new replies.

Advertisement