Heightmaps

Is there any special considerations that I should take in to account when designing a heightmap for importing into jME. I am using Photoshop Elements and Blender to make the heightmap.



Things I am interested in are;


  • how large to make the map, are there any restrictions etc?
  • should I restrict the amount of different levels that the heightmap has? ie 16 different levels of 'height'.
  • should I keep the grid in blender in squares from top-down view? What will happen if it isn't in squares?
  • What will happen if I create overhangs and caves? (fairly certain that it will take the highest point on the map and disregard any other data)



    Thanks



    Neilos
- how large to make the map, are there any restrictions etc?

a power of 2. 128x128 , 256x256 (we speak here of pixels)

- What will happen if I create overhangs and caves? (fairly certain that it will take the highest point on the map and disregard any other data)


That is not possible.
Neilos said:

- how large to make the map, are there any restrictions etc?


also the maximum texture size of your graphics card

Neilos said:

- should I restrict the amount of different levels that the heightmap has? ie 16 different levels of 'height'.


no, afaik it is just limited by the number of grey shades possible with your bit depth of the texture. 8bit greyscale makes 256 levels, and so on.

Ahh ok, like I say I'm yet to read in to it.



So as a rule of thumb should I design the terrain as 2^n or as (2^n)+1? I'm a little lost  :?



Also I'm having resolution issues. Say I make a heightmap 128x128 how big should I make the features? (I know that this is really a preference thing and I should play about with it to see what I like but I just wonder if anyone has any hints). See what I'm thinking is that if I make it low resolution it would be difficult to define a small path winding up a mountain. I don't mind if the hills are low detail, I could handle one quad of the mesh being say 10 meters by 10 meters but things like paths probably want to be 2 meters wide, but even with this in mind the quads would want to be smaller to make it smoother. Meaning that my originally low detail hills may as well be higher detail because of the detail needed elsewhere. But I want is low detail to make it less intensive.



Basically I don't really understand how jME interprets a heightmap. For the terrain does jME basically just apply a heightmap to a mesh, where the mesh and the heightmap can have different resolutions? This is what I think happens.



If this is so, how would one get the mesh and modify it afterwards to add finer detail? Or would this detail need to be in the heightmap.



Also what are benefits for using a heightmap instead of importing a mesh? Other than file size.



Last question. How much more intensive would using a high res terrain be compared to a low res one?



Sorry if my questions are dumb but I'm just trying to get a feel for this before I delve into it too far, get lost and lose hope  :stuck_out_tongue:



Thanks



Neilos

You can export the map as a model if you would like to have overhangs. Although it is possible to have a heightmap and overhangs by placing models on top of it. If you have a very large map, like 1024+, it's probably best to split it up and use some kind of quadtree with LOD.

Great! Thanks, I understand it all a lot better now.



With regards to the quadtree structure, I have no understanding of how to implement it. I'll probably just stick to low res maps to avoid this problem for now but it is something that I have the intention of learning sooner or later.



I was intending to investigate jME's TerrainPage class so that I could cull areas of the terrain mesh so I could have higher resolution terrain and a quadtree structure would be necessary here i think.



I like the idea of placing models for overhangs/caves etc… It's funny how many simple ideas you can overlook when you are thinking inside the box.



Many thanks guys,



Neilos

The TerrainPage class is actually a quadtree implementation, although it does not provide LOD. There are several requirements for it though, for example, the heightmap must be square and be a power of two + 1, like 65, 129, 257, etc.

So as a rule of thumb should I design the terrain as 2^n or as (2^n)+1? I'm a little lost

(2^n)+1
and it's not a rule of thumb, its a requirement of the TerrainPage class.

See what I'm thinking is that if I make it low resolution it would be difficult to define a small path winding up a mountain. I don't mind if the hills are low detail, I could handle one quad of the mesh being say 10 meters by 10 meters but things like paths probably want to be 2 meters wide, but even with this in mind the quads would want to be smaller to make it smoother. Meaning that my originally low detail hills may as well be higher detail because of the detail needed elsewhere. But I want is low detail to make it less intensive.

With LOD (level of detail) this would have been easier. LOD dynamically switches down the resolution for parts of the map that are far away from the player, thus reducing costs of having a higher resolution heightmap. In your case, you could have the high detail you need on that path while the mountains in the background would be downscaled to be low resolution by the LOD algorithm.

Basically I don't really understand how jME interprets a heightmap. For the terrain does jME basically just apply a heightmap to a mesh, where the mesh and the heightmap can have different resolutions? This is what I think happens.

The mesh is generated from the heightmap, the mesh is the heightmap. So, for each pixel on the heightmap, you get one vertex on the mesh. The mesh will always have the exact same resolution as the heightmap, unless you use LOD.

If this is so, how would one get the mesh and modify it afterwards to add finer detail? Or would this detail need to be in the heightmap.

You can put models on the heightmap to add detail. If you were to modify the mesh after being loaded as a heightmap, you would lose the heightmap representation and you will have to load the terrain as a model instead.

Also what are benefits for using a heightmap instead of importing a mesh? Other than file size.

Simplicity, and flexibility as a terrain format. It is much harder to do certain things with a model rather than a heightmap, one example would be LOD which is integral to outdoor terrains.

Last question. How much more intensive would using a high res terrain be compared to a low res one?

Depends on how much high res, doubling the resolution of the heightmap means quadrupling the vertex count, do the math. Quadrupling the heightmap means hexadupling (x16) the vertex count, etc. Also, if you use LOD, the costs are much smaller since the detail is only visible near the player and everything else is at incrementally lower resolution.

Ok great, my understanding is growing exponentially.  :lol:



I'll leave it there for now and experiment a little more for a while.



Thanks



Neilos