Fire effect and zbuffer state

From what I found fire effects are done with a disabled zbuffer state and additive alpha blending.

In a stand-alone demo that looks nice, but how should that be done in a game where you need zbuffer testing? If I just add such an effect to my scene I get clipping problems due to the switched off zbuffer state.

you don't need to disable the zBuffer entirely, only disable writing for the fire itself. If you then put it into the TRANSPARENT queue it should be fine.

Okies maybe I've just gone a little insane but both of those pictures look the same and neither have any fire in  :stuck_out_tongue:

Gentleman Hal said:

Okies maybe I've just gone a little insane but both of those pictures look the same and neither have any fire in  :P

scroll down  :D

Hard to say, but definitely looks like something is clipping or zfighting with it.  I'd turn off things (aside from the fire) in your game until you find what is blocking it, then look at what is causing it.

I don't  do hand coded particles but that happens to me when additive blending is disabled in the editor

Before I change the game to death … Could it be the render passes? I changed it quite some time ago to implement a shadow render pass but it's skipped as it took too much performance.

There is another problem: The compass in the upper right corner should show a texture with direction marks but with a 50:50 chance it's just white. This could be totally unrelated but maybe it's a hint for another possible reason? It's a quad with a texture in the ortho queue. The updateRenderState() is called every time the texture coords are changed.

gerbildrop said:

scroll down  :D

Man the cheek of some people!  I'll expect you'll want me to be solving his problem next too!

I think the problem with the particles is due to the bounding. This is a screenshot of the test program. It doesn’t look that bad but the bounding volume is too big.

In the game the bounding volume is even bigger, it’s so big I cannot capture it complete (~24000 units radius). I tried to set a smaller bounding sphere but it gets overwritten and the world bound is still the same size.

If you set your end color's alpha to 1, or disable the alpha state, you'll see that there are particles that are invisible but still there, continuing up above the flames (which is normal, btw.)  Because you are using bounding sphere, the boundings are that much more exagerated, but still correct.

That said, I don't really get your assumption that a partial showing of particles is due to boundings.

Well, I would agree with a bounding sphere that is let's say three times the visible flame but in the game there is a bounding sphere with a radius of 24000 where the ground plate of the fire place is 40 units wide. That means the visible flame is less than 200 and that's what I meant with a way too big bounding sphere.

Of course this could be unrelated to my problem but I thought it's strange and it seems I cannot override it.

Hmm, do you use flow control?  Also, does it look like the bounds include the vector 0,0,0?  It could be that there are particles in the mesh that never get used and therefore stay at 0,0,0.  I've seen this happen before.  Then bounds calculation would try to include those particles.  (it really depends on how you are using it.)  I will look into that possibility.

The flow control setting and the phantom particles at 0/0/0 were indeed the problem of the big bounding volume:

The fire place is at 31253/-1713/-29236.

With flow control the bounding is at 15579/-897.6/-14680 radius 21438.6,

without flow control it is at 31257/-1642.7/-29229.7 radius 74.97.

Unfortunately the culling problem is still there.

Yeah, as I said, I didn't think boundings would solve it for you.  :/  Are you doing the particles in a seperate Pass?  I do them after drawing the level geometry.

I implemented a shadow render pass but it is disabled.

The render function looks like this:

   protected void render(float interpolation) {
      Renderer r = display.getRenderer();
      long start = System.currentTimeMillis();
      if (showBounds)
         Debugger.drawBounds(rootNode, r, true);


      // draw GUI scene node and it childs
        if (showDepth) {
            Debugger.drawBuffer(Texture.RTT_SOURCE_DEPTH, Debugger.NORTHEAST, r);

        if (Config.DEBUG) {
           long renderTime = System.currentTimeMillis() - start;
           if (renderTime > 200) {
              log.warning("rendering took "+renderTime+"ms "+

The setup is:

      pManager = new BasicPassManager();
      shadowPass = new ShadowedRenderPass();


      Atmosphere.getInstance().init(display, rootNode);

      gui = new ClientGui(display, cam, input);
      desktop = gui.getDesktop();
      desktop.setClickListener(new GuiClickListener());

      renderPass = new RenderPass();

Config.USESHADOWS is false and the fireplace is a grandchild (IIRC) of rootNode.