PDA

View Full Version : Particle depth test



fortikur
08-31-2004, 10:58 PM
I have 'glowing' particles (around 300 pieces) that fly around some 3d objects.
- If I enable depth test and use quads, I always have to calculate the distance between the camera and all of the particles (to know the drawing order) and between the camera and the objects (difficult geometry) and I have to make calculations to make the particles face the viewer. This eats up a lot of CPU time...
- If i use point sprites, I have only a limited particle size and I have to calculate the distance and so on...
- If I disable depth test, I won't be able to see the particle disappearing behind an object and reappearing in front of it.

A saw a lot of examples concerning this problem, but they always showed glut examples and only a particle emitter (nothing else in the scene), but no depth testing.

My question is:
What is the technique I have to use for particles (not gl_points, but trangle strips or quads) to make them move around in 3D space?

thx

ps: I don't use glut

Bob
09-01-2004, 12:52 AM
Disable depth writes, but keep depth test enabled. Check out glDepthMask.

fortikur
09-01-2004, 02:02 AM
That solved my problem. Thank you. :D
I've never seen anyone mentioning that thing concerning particles...

ZbuffeR
09-01-2004, 02:54 AM
You did not search that much, because it is well known that with additive transparency you don't have to sort particles.
Quite often games use additive instead of classic blending to avoid sorting, even for smoke and dust. It does not look so good though.