Seams in terrain

Judging from what brent said its not the update loop, try enqueueing the change.

TerrainGridListener is not on the render thread. I think it should be however. The only difficult piece is the tileLoaded(Material, cell) call as it is the only method of TerrainGridListener that is called in a separate thread, and going on and off that thread caused major slowdown when I tried.

How is that method intended to be used with the material, and the returned material, @anthyon?

oh yes sorry, it is run in the update loop. As I see you should not even have to call updateModelBounds as it is already called after the listeners are done. I understand why you have to attach back when updating the heights :slight_smile: I just don’t see yet why it is failing. :confused: I’ll go on looking for the cause. :slight_smile: Could you put together a small test on how to get this Exception?

@Sploreg: I created it, so I can load the alphamaps for a material set to terraingrid, when the tile is loaded. Though it can be replaced by the new tileAttached method. It was a functionality EmpirePhoenix asked for, as he was using alphamaps not my heightbased material.

okay

What I think might have to happen with it is have it still create the quad on the outside thread as it is currently doing. Then a call to the material setting can happen afterwards back on the render thread (instead of in the middle of that thread run call). If the material returned by the listener is different, then it will set the new material; all happening on the render thread.

Or, the ‘tileLoaded(Material material, Vector3f cell);’ method could change to not return the material. But let the user set the proper material instead:

[java]

public void tileLoaded(Material currentMaterial, TerrainQuad loadedQuad, Vector3f cell);

[/java]

The call to that would be queued up before the call to tileAttached, so there shouldn’t be any material artifacts while it switches.

hmm I just tried the TerrainGridAlphaMapTest that makes use of this method. It was really slow, but not because of the tileLoaded call. It was trying to load a grid of 1025 size, and that waas not even working with the simple TerrainGridTest. TerrainQuads of size 512 are too slow for loading with the new load mechanism, and they cause an “infinite” lag on start (at least I was too impatient to wait for the load). I change this alphamaptest to use fractalheightmap instead and changed the gridsize to 257, and it is working as expected. (though I get some artifacts because of your change to the alphamap usage, I have to figure out in which order it takes the rgba components)

Could you put together a small test on how to get this Exception?

I try... seriously... and I fail to reproduce it outside of my own project.
I can offert the source of my prototype, if it helps... I have a SVN.