Terrain Problem

Well i stumbled on this great height map editor called EarthSculpter. i found it really great and i like it. anyway i got the heightmap from it, it was a gray 16bit and i attempted to load it into jme using ImageBasedHeightMap and this is what happend:


im not sure what causes those wierd step-like lines going thru the terrain but it really doesn’t look nice :frowning:


here is what it should like mostly like:


It seems to be a an export error more than a jME loader error. Why do not you try to load it with another program? For example Blender if the format is supported.

the imagebasedheightmap is only 8-bit…the most common way of importing heightmap data is to use the raw format, where you can choose to use 16 or 32 bit data…there's a RawHeightMap in jME that supports 16 bit data that you can use…

ok ill get to work on using rawheightmap

well i attempted to use it. i didnt get any errors it was just that the terrain was all the same height :frowning: i exported using photoshops .raw format and tried different settings such as IBM PC and mac on export. i also tried different formats in importing into jme

i used rawheightmap like you said and the results are very close to looking good except for one error…

here is the line i used:

RawHeightMap rhm = new RawHeightMap("classes/yo.raw",
                512, RawHeightMap.FORMAT_16BITLE, false);

TerrainPage tp=new TerrainPage("terrainpage1"
                , 257, 513, new Vector3f(1,.001f,1), rhm.getHeightMap(),false);

but the the terrain has very odd dips in it that shouldn't be there.

the heights can't go below 0, they just wrap from max 16-bit then…that's what you're seeing…

should i go thru the whole array and add 1 to it?

No, that probably wouldn't help anything. Compared to 2^16, 1 is quite a small number :wink:

You should try to convert the heightmap to 16 bits.


The problem is the ImageBasedHeightMap class I believe.  It reads in the image and converts each pixel to an int in the range of [0-255]

there's no reason to use ImageBasedHeightMap when there's RawHeightmap.

immo: did you use the RawHeightMap(String filename, int size, int format, boolean swapxy) constructor? format specifies if the heightmap is 8 bit or 16 bit.

RawHeightMap needs some cleanup anyways.

Great, after copying by hand and playing with it a while (patches don't seem to work these days for me… :frowning: ) raws import like a charm.  Thanks!

it was no big deal. it's just one line of code (it's just me who makes such a big fuss of everything with patches, tests and data sampes :P).

the patch was more about code formatting, removing those strange log statements and adjusting the log level somewhere in there. :wink:

this fix is in the 0.11 release :wink: thanks!