Particles and ZBufferState

Hi,

Im developing a racing game and i have burnout effect in particles.

But i have 4 cars on track and the burnout smoke is always in front of the screen.

Thats because ZBufferState is set enabled false.

If i enable zbuffer the smoke effect gets weird.

Anyone has an idea of how could i get the smoke effect works properly but using zbuffer?!



Thanks!

Let's start by what you mean by "weird"?  :)  Usually if your particles are in the transparent queue and have a zbuffer that is enabled but not writing then you are good.

Screenshots a better than thousand words  :smiley:



Weird (with zbuffer .setFunction(ZBufferState.TestFunction.GreaterThanOrEqualTo):wink:





OK (with zbufferState disabled)

Use LessThanOrEqualTo

Didn't solve!

Here is how it get:

Make sure the z buffer for the particles is set with writing to false as well.

I put writing to false and it works :smiley:



Thanks a lot Renanse!!!



But, can you tell me what exactaly this setWritable makes?

(Oversimplification…) When an object is drawn, it can also draw to the zbuffer, which is basically a buffer that keeps track of the closest distance drawn at each pixel.  When you draw the next item, OpenGL can check these values to see if what it is drawing is actually farther away and therefore "blocked" by the previous objects.  By having a writable zbuffer, the particles are blocking each other and thus only chunks of them get drawn.

Hum… i got it!!



Thanks!