Hey guys, small problem I'm having.
Been following Nehe's tutorial for particle effects and I've built a fireball for my game, however the issue I'm having is that I have to disable GL_DEPTH_TEST for it to look good - otherwise the particles won't blend over one another, only the environment they appear over.
So I'm trying to make sense of why this is happening? it's textured and blended.
The blend function I'm using is glBlendFunc(GL_SRC_ALPHA,GL_ONE);
2 replies to this topic
Moderators - Reputation: 8195
Posted 29 February 2012 - 06:18 PM
If you have the depth test enabled, then particles with occlude each other since the depth buffer is binary and has no concept of transparency. The blending function you use does not require back-to-front sorting, but you need to ensure that particles don't occlude each other. If you disable the depth test, then nothing will occlude the particles (not even things that should occlude them). Another option is to keep depth test enabled, but disable depth writes. That ensures that the environment occludes the particles, but the particles don't update the depth buffer so they never occlude themselves. Look up glDepthMask.