I've seen several tutorials on how to use a displacement modifier and a texture to create a terrain from height map data, but I want to go the other way. Given that I have used sculpt tools to hand draw a landscape on a mesh in Blender, is there a way to generate a height map from it?
I've tried setting up an orthographic camera, going into compositing and sending the depth channel to my output layer, but this results in a distorted image with the peaks being much too high:
Using the assumption that the depth buffer is calculated the same way OpenGL does it, I tried piping the calculation through a 1/n math node:
This fixed the distortion, but I'm finding it very hard to set up my network since I have no real idea how the 'depth' values are actually calculated. I've used a bunch of math nodes to try and map the depth buffer onto height values, but I'm getting weird results that make me wonder how blender is actually calculating all of this. For example, simply doubling the resolution of the output gives me this:
Why is it so light? Shouldn't the Normalize node still transform the image to the full range of 0 to 1?
If anyone knows how to generate a height map, please let me know.