I am writing a space trading game.
I have space ships, which leave a trail of alpha blended particles in their wake, from their exhaust ports, and I am using Nehe’s particle example as the basis of my code.
I notice, that to get the plasma/blending effect, Nehe, disables the depth buffer as the particles are drawn.
Unfortunately, this has a strange effect in my game code, as the ships pass behind planets, their exhaust trails are visible through the planet, but the ship is not.
Basically, the order I draw things in is:
- Draw starfield
- draw all planets
- for each ship:
disable depth test
enable depth test
draw the ship.
I know this is incorrect, and if I leave the depth test on throughout, my nice plasma effect goes…
what should be the correct drawing order?