Particle effects and FilterPostProcessor

Hey All!
When I add water and fire (Particle), then when the camera moves fire changes its position. If the filter is removed, then everything becomes normal. Is it possible to somehow avoid this trouble?
Shot

water:

  waterProcessor = new FilterPostProcessor(assetManager);
        water = new WaterFilter(rootNode, lightDir);
        water.setCenter(new Vector3f(0f, -13.830074f, 70f));
        water.setRadius(20);
        water.setWaveScale(0.003f);
        water.setMaxAmplitude(1f);
        water.setWaterTransparency(3.01f);
        water.setUseRipples(true);
        water.setWindDirection(new Vector2f(-2, 0));
        water.setSpeed(0.18f);
        water.setFoamExistence(new Vector3f(-4f, 4, 0.0f));
        water.setFoamTexture((Texture2D) assetManager.loadTexture("Common/MatDefs/Water/Textures/foam2.jpg"));
        water.setRefractionStrength(0.2f);
        water.setWaterHeight(-1.5f);
        waterProcessor.addFilter(water);
        viewPort.addProcessor(waterProcessor);

fire:

     ParticleEmitter fire =
                new ParticleEmitter("Emitter", ParticleMesh.Type.Triangle, 50);
        Material mat_red = new Material(assetManager,
                "Common/MatDefs/Misc/Particle.j3md");
        mat_red.setTexture("Texture", assetManager.loadTexture(
                "Interface/Effects/flame.png"));
        mat_red.setFloat("Softness", 3f);

        fire.setMaterial(mat_red);
        fire.setImagesX(2);
        fire.setImagesY(2); // 2x2 texture animation
        fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));   // red
        fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 2, 0));
        fire.getParticleInfluencer().setInitialVelocity(new Vector3f(0, 1, 0));
        fire.getParticleInfluencer().setVelocityVariation(0.1f);
        fire.setLowLife(1f);
        fire.setHighLife(3f);
        fire.setStartSize(0.9f);
        fire.setEndSize(0.2f);
        fire.setGravity(0, 0, 0);
        fire.setLowLife(1f);
        fire.setHighLife(3f);
        fire.setEndColor(new ColorRGBA(1f, 0f, 0f, 1f));   // red
        fire.setStartColor(new ColorRGBA(1f, 1f, 0f, 0.5f)); // yellow
        fire.setQueueBucket(RenderQueue.Bucket.Translucent);
        final Node fireEffect = new Node(id + type);
        fireEffect.setLocalTranslation(x, z, y);
        fireEffect.setQueueBucket(RenderQueue.Bucket.Translucent);
        fireEffect.attachChild(fire);

        rootNode.attachChild(fireEffect);

no one knows?

Which filter?

Did you try different filter ordering? Did you try fire in the transparent bucket instead of the translucent bucket? (I think in the presence of water, translucent bucket may behave oddly without the translucent filter.)

We don’t seem to experience this issue. I guess folks cannot instantly spot the problem in the snippets of code you posted so it is possible that the problem is elsewhere.

As always, the best way to proceed is to post a simple single class test case the illustrates the problem. 90% of the time, it will work fine for you and then you have something to work from to figure out “what’s different”. The other 9% of the time, it’s easier for others to spot the issue. And 1% of the time, it’s a bug in JME that now has a prebuilt test case that makes it easier to find and fix.

3 Likes