Zfighting particle emitters

this is the issue im having: - YouTube (theres like 5 seconds of black in the beginning, sorry)

theres 3 emitters in that video, but the 2 with the issue is the engine smoke and the engine fire. at some points they seem to work in the way i want them to work. but they also kind of flicker and zfight, its especially noticable when the smoke overpowers and draws in front of the flame emitter. i think the main factor here is that the smoke uses alpha blending instead of alphaadditive so that it can be dark colored

Does anyone know how to solve this? i tried messing with depthwrite and stuff like that but that didnt get me anywhere.

I’m using @t0neg0d 's emitter system (http://hub.jmonkeyengine.org/forum/topic/particle-system-source-code-if-ya-want-it/ ), but i have a feeling this same problem would happen on the regular particle emitters or in simply just other scenarios.

code that creates the particle emitters: http://pastebin.com/RiuDJcpN

Yeah, this is a pretty standard transparency issue. You could easily simulate this with even just two triangles… so it’s not directly particle related. It’s more or less a fundamental 3D graphics issue.

You could try turning off depth write for the smoke. That’s probably about the best you can do. Then at least the stuff behind it will get drawn… you’ll want to make sure the smoke is drawn after anything that you might want it to occlude. You could put it in the translucent bucket… which may fix your problems anyway.

yeh ive had this problem before usually i solve it by messing with depthwrite. somehow i managed to completely forget about queuebuckets…

though setting the smoke to translucuent didnt fix it…, the best combination ive found was to set the fire to translucuent, and the smoke to transparent. (in the video they were both set to transparent). its also still not exactly producing the effect i wanted, but this seems to be the only way to not create zfighting/flickering. I’ll have to mess around with some emitter settings to balance stuff out.


Likely, this can be solved by resorting the buffers based on Z value stored in ParticleData.

I have this working properly in the 2D framework’s AnimElement class and plan on applying the solution to the emitter in the near future.