Assertion failure in Intersection.intersect()

In 3.1 with assertions enabled, com.jme3.bounding.Intersection.intersect() fails, shortly after I add an emitter to the scene.

The meshBound of the emitter’s mesh gets set to BoundingBox [Center: (NaN, NaN, NaN) xExtent: NaN yExtent: NaN zExtent: NaN] – I’m not sure how – and the worldBounds soon become similarly corrupted with NaNs, leading to:

INFO: jME3-core version is jMonkeyEngine 3.1-5745
Jan 24, 2017 5:51:53 PM mygame.Main simpleUpdate
INFO: add the emitter
Jan 24, 2017 5:51:53 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.AssertionError
at com.jme3.bounding.Intersection.intersect(Intersection.java:66)
at com.jme3.light.PointLight.intersectsBox(PointLight.java:196)
at com.jme3.light.DefaultLightFilter.filterLights(DefaultLightFilter.java:81)
at com.jme3.renderer.RenderManager.renderGeometry(RenderManager.java:573)
at com.jme3.renderer.queue.RenderQueue.renderGeometryList(RenderQueue.java:266)
at com.jme3.renderer.queue.RenderQueue.renderQueue(RenderQueue.java:311)
at com.jme3.renderer.RenderManager.renderViewPortQueues(RenderManager.java:891)
at com.jme3.renderer.RenderManager.flushQueue(RenderManager.java:781)
at com.jme3.renderer.RenderManager.renderViewPort(RenderManager.java:1097)
at com.jme3.renderer.RenderManager.render(RenderManager.java:1145)
at com.jme3.app.SimpleApplication.update(SimpleApplication.java:253)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.runLoop(LwjglAbstractDisplay.java:151)
at com.jme3.system.lwjgl.LwjglDisplay.runLoop(LwjglDisplay.java:193)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:232)
at java.lang.Thread.run(Thread.java:745)

Any assistance with debugging this would be appreciated. Here is my test class:


import com.jme3.app.SimpleApplication;
import com.jme3.effect.ParticleEmitter;
import com.jme3.effect.ParticleMesh;
import com.jme3.light.PointLight;
import com.jme3.material.Material;
import com.jme3.system.JmeVersion;
import com.jme3.texture.Texture;
import java.util.logging.Level;
import java.util.logging.Logger;

public class Main extends SimpleApplication {

    final private static Logger logger
            = Logger.getLogger(Main.class.getName());
    static float totalTime = 0f;

    public static void main(String[] arguments) {
        Main application = new Main();
        application.start();
    }

    @Override
    public void simpleInitApp() {
        logger.log(Level.INFO, "jME3-core version is {0}", JmeVersion.FULL_NAME);
        
        PointLight light = new PointLight();
        rootNode.addLight(light);
        light.setRadius(1000f);
    }

    @Override
    public void simpleUpdate(float timeSinceLastUpdate) {
        totalTime += timeSinceLastUpdate;
        if (totalTime > 1f && totalTime < 4f) {
            logger.log(Level.INFO, "add the emitter");

            ParticleEmitter emitter = createEmitter();
            rootNode.attachChild(emitter);

            totalTime = 4f;
        }
    }

    private ParticleEmitter createEmitter() {
        /*
         * Create material for particles.
         */
        String texturePath = "Effects/Explosion/flame.png";
        Texture texture = assetManager.loadTexture(texturePath);
        String materialPath = "Common/MatDefs/Misc/Particle.j3md";
        Material material = new Material(assetManager, materialPath);
        material.setTexture("Texture", texture);
        /*
         * Create the emitter.
         */
        ParticleMesh.Type meshType = ParticleMesh.Type.Triangle;
        int maxParticleCount = 25;
        ParticleEmitter emitter = new ParticleEmitter("emitter",
                meshType, maxParticleCount);
        emitter.setMaterial(material);

        return emitter;
    }
}

I should mention that the test class works in jME 3.0.10 with assertions enabled, so this constitutes a regression.

I’ll look into it tonight

1 Like

I eagerly await your findings.

At first glance it seems that the ParticleEmitter bounds are never updated…

1 Like

Got it

Not sure why it was working before. I d’ont remember when the ParticleEmitterControl was added, but maybe it introduced some change in update order of the emitter…
I guess it didn’t matter much without assertions, because the bounds were fixed the next frame.
Anyway it works now with this safety check.

Thanks for reporting

2 Likes

Thank you for the investigation and the fix!

I’ll test the fix with my full application.

I tested the v3.1 fix in two different games. Looks good!

1 Like