How can an accurate height map be created in Blender? We have been working to create a height map output with the shader editor. We have a plane that has been sculpted into a terrain. 



We have applied a material with the following node setup to get the correct white to black shading according to height:



The middle color stop in the color ramp has its color set to HSV and the H is 0, S is 0, and V is 0.5. 

The shading this applies to the object is then recorded by a camera directly above it, with all rotation axes set to 0. Under the camera tab, its lens type is set to orthographic and the scale was set up so it would frame the object correctly.



However, when I import the height map this makes into Godot and set it up, there is a crease where the grayscale has changed color way too quickly, and the high points of the map are squished down.

What else needs to be adjusted here in order for this to work?
I've just looked into your way of making a height map, which seems a bit snappier than a Mist pass for something like this - I'd never thought of doing it this way...

So long as you keep the color-space linear all the way through, it works fine, as far as I can see.



In the Render > Color Management panel, set the View Transform to 'Raw'... Using EEVEE, here, but Cycles would work, too.. image saved as 16-bit RGB PNG. When used as a texture in a Displacement modifier, the Color Space in the texture must be set to 'Linear', too.



I didn't make a fuss about smoothing and subdivision, but the results seem accurate. Original on the left, displacement with EEVEE image &amp; displacement with Cycles image on the right, with the Displacement modifier set to a Strength of the Z dimension of the original object.