PDA

View Full Version : Hiding a particle stream behind an object



Handkor
04-23-2001, 06:59 AM
I am working on a space shooter and right now I am trying to make my jumpgate effect look right.

The jumpgates consists on a ring with a particle stream comming out of the center. I am blending my particles so that they look right with each other and disabling depth testing which makes the whole particle system look right (no black squares).

Basicaly I am following the instructions found in most particle system tutorial and on this board.

My problem is that the particles can be seen through the jumpgate ring and also through ships passing in front of the jumpgate. Leaving depth testing enabled solves this problem but then the particles are drawn wrong.

I tried drawing the particles before eveything and by changing glDepthFunc for the particles to GL_ALWAYS it works but now the particles are not blended with the background.

Help!

j
04-23-2001, 07:43 AM
Draw the particles after drawing everything else, with the depth buffer on. Just set glDepthMask(GL_FALSE) before you draw them and glDepthMask(GL_TRUE) after you are done.

j

Korval
04-23-2001, 07:51 AM
Also, sort the particles in back-to-front order and draw them that way.

Handkor
04-23-2001, 08:11 AM
Thank you, glDepthMask did the trick.