What's the best way to implement a detail feature, like a road, on a heightmap-based terrain?
Update: It's a bit hard to see in the image, but the road descends from the top of the quarry to do its base.
What is great with images is that they usually embed up to 4 channels (red, green, blue and alpha). As an height map needs only one dimension, you could just use the red channel to store the height informations (you still have 256 levels for the height), and then use other channels for other purposes (like using the green channel to map the roads, blue channel for water / moisture) etc...
Like this you could make sure that when you're building your terrain, the zones where a road should be built will appear flat instead of following the height gradient.
|show 2 more comments|
The way I do it is to separate the heightmap (I use floats for example, 513*513) and splatmap (the "control-texture") that often needs a bigger resolution (I use 32bit bmps, 512x512).
The heightmap creates the mesh (the terrain, the triangles).
The control-map spans the whole terrain and each of its layers (RGBA) says how much say Stone,Dirt,Road etc. you should see On the terrain.
This way you can use an editor to a) create the terrain and b) Paint the terrain (with Rock,Dirt,Road etc.)
Do a quick goolge on 'painting heightmap', 'heightmap splatmap' and such for a more thorough explanation or download say Unity3D to check out how it might work in 'reality'.