Image Based Terrain Problem


I just generated 100km^2 of map in World Machine and exported it as tiles 1024x1024 heightmaps.
Now I want create scenes - each from another tile. When I add Terrain - choose Image Based - choose Image file and set MAX Rough and HEIGHT as 2 (because JME has so low heightmap interpretation - I must use height 2 to get terrain look ok) and click DONE my terrain has 2 sides with Chopped terrain and 2 without as on image:

and 2 don’t

and here’s my heightmap.

What’s wrong? Also, is it possible to have terrain high but on low position? (i mean only terran shape, not all terrain node) because when I use height 2 my LOD for terrain is working not correctly

The TerrainQuad is made of TerrainPatch, they have (2^n+1)^2 vertices thus that means eg. heightmap of 10241024 creates 10251025 vertices. From that you can see that there are two sides of extra vertices. As it turns out in the code their values are left at 0 (not chopped) and the the other two sides obey the height map.
If you would want each side to look the same… what you could do is in your heightmap, fill two edges with black so that all 4 edges will be at 0. (I do not know which edges, you can try to experiment with that)

I do not understand what you mean by high but low. How is the Lod control not working correctly?

Hello, thanks for reply.
I mean: LOD use high leveles for me in that situation (all is so square, around 7 / 8 /9 level). Also have some problems during moving betwen tiles.

Found same issue myself; I believe it’s a bug of TerrainQuad.
Unfortunately @Sploreg is missing lately… :frowning:

Yeah ; / it’s a quite serious problem. Even when I had other maps with mountains, I could saw how strange LOD work for high parts of mountains

Terrain Quads can load in raw height values, meaning whatever granularity of height you want. As soon as you save height to an image then you are limited by the image’s restrictions. So save the terrain to an array of raw values instead of an image.

You can adjust the LOD thresholds. Since you have a massively large terrain and scale you will need to tweak these. The default values are just that: defaults for a scale we chose (1x1m per 1x1 WU).

But I want use simple .j3o scene files generated once from heightmap, not loading everytime from Image.

Any one got solution/fix ?

Terrain LODing is not an easy task. There is a reason no game displays 100 square kilometers at once.

At some point you run into raw vertex draw limit. Just do the math: 1024x1024 verts for each tile is already 1 million vertices.

Lod deceases the detail anf at some point a tile is only a quad. No way to draw a mountain with a single quad.

Also from my point of view the terrain system was never ment to display such large worlds. High likely that you will need some specialized terrain rendering algorithm if you require a such large terrain

I won’t use all tiles. And my problem is not about LOD but generating from Image. I also have some functions to manage tiles and display only the once which are needed at time.

If your only problem is creating the mesh, the just load the heightmap, create your own custom mesh and save the result as j3o

Dude can you read? Check up my first posts. There is a problem with generating terrain from Image Heightmap. It cut the edges and set strange highness of mesh…

That’s why he wrote “load the heightmap” and not “load the heightmap image” I guess. Even if I might be wrong, no need to be rude in here. :wink:
If the default terrain image loader is bugged or doesn’t fit your needs, you will need to either:

  • write an own image based loader
  • (let someone) fix the existing one
  • load the terrain based on the raw values (as already suggested in this thread)

Dude, i have created a few terrain rendering systems with jme, and i am nearly 100% confident that the heightmap loading code does work as expected.
Your mesh creation algorithm might not. Or your heightmap data is wrong. Dont know…
You could start showing some code how you create your mesh…

I for one have created a Terrain with a heightmap with a int[][] where all the values are constant. I did see something similar to the issue experiected by @Skatty so I tend to believe that there might be something that needs an improvement…

Could be that the default terrain quad requires a 1024+1x 1024+1 sized data? at least i have seen terrain systems with that requirement.
Another possible explanaition would be stiching. But again i dont think the terrain system uses it