Optimizing terrain causes NPE

When i Use the Scene Explorer to “Optimize Geometery” of a Terrain i created in the Terrain editor (i do it on the parent terrain and not the individual quads), i get the following exception when launching my APP

SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]


at com.jme3.bounding.BoundingBox.intersects(BoundingBox.java:580)

at com.jme3.terrain.geomipmap.TerrainQuad.fixNormals(TerrainQuad.java:1411)

at com.jme3.terrain.geomipmap.TerrainQuad.updateNormals(TerrainQuad.java:224)

at com.jme3.terrain.geomipmap.TerrainQuad.read(TerrainQuad.java:1562)

… MORE STUFF that hopefully isn’t important

on the line where i load my j3o terrain.

[java]Spatial terrainSpatial = myApp.getAssetManager().loadModel(“Scenes/Terrain.j3o”);[/java]

any idea what is going on? can i optimize a terrain in this way or do i need to do it

oh that won’t be a good thing for the terrain, it is already optimized. I guess it should be disabled in the menu for terrain.

1 Like

Ahh… i see, thanks for the response… Well bummer that means i’ll have to think of something else to get some precious FPS

Remember that in-game you have to re-attach the camera to the TerrainLodControl to get the performance gain. Without that then it is rendering the terrain in full detail.

I am doing that… .i don’t think my biggest performance hit is the terrain though, i think i am going to have to start attaching/detaching nodes when they are not visible to save some FPS… I have a lake with a simple water processor, and i can buy myself 40 FPS just by turning that off every-time i walk away from the lake…

@kbender88 said:
i think i am going to have to start attaching/detaching nodes when they are not visible to save some FPS...

Jme culls nodes and spatials out automatically if they are not in the view frustum so you do not have to do this. You can view this in action by looking at the stats screen at the object count.

Your best bet for easy performance gains is BatchNode or GeometryBatchFactory.

I misspoke, the performance increase comes from removing the water processorc from the view port… When my lake is not visible i run at about 30FPS (if i leave the processor on)… but if i remove the Simple water processor from the viewport… i run at 60FPS…

I have experimented adding and removing the water processor and there is no noticeable lag or popping when i add/remove, so i think this is a valid way to get an performance increase

UNLESS i have my camera setup in such away that JME is not properly culling the items correctly… I would think that not looking at the lake should give me about the same performance as if the item was dettached, but that doesn’t seem to be the case

ah ok that makes sense. The processor is running all the time, so manually turning it on/off when the lake is visible will help. I don’t know the intricate details of the water processor, but it might do a depth check first before it does the actual rendering of the water. So in that case it will be faster when the lake is not in view, but will still take some overhead.