Why does my cycles-rendered heightmap have wrong values? I've been trying to render a heightmap using cycles.

To that effect, i've set up:

1) A sculpted plane squeezed between -0.25 and 1.0 altitude (z-axis) in Blender.

2) An orthographic camera scaled to perfectly match the plane.

3) A cycles emission material set up in such a way that its final emission value is geometry.blue (z-axis position) -> math.add 0.25 -> math.multiply 0.8.




I render this to a 16-bit grayscale png image.




The issue is: The resulting heightmap's pixel values are slightly (or not so slightly) wrong - i.e, different from what the math should say.

For example, while math says that vertices at position ~0 in Blender should produce heightmap values around (0.0+0.25)*0.8 = 0.2 , in the resulting image, those areas are ~0.5; while math says that 0.94 should translate to 0.95, in Gimp when sampling those pixels i see their HSV Value as 0.89.

Upon some asking around in #blender, i've eliminated the following possible sources of trouble:


World (and its material)
Sky pass in render layers
Material color is set to 1,1,1
I've eliminated sections of the plane that violated the bottom boundary.


None of these fixed the problem.

If anyone feels like poking around instead of guessing around, i've also put the blend file to here.
This is probably due to blenders color management. You're expecting a linear relationship between the height of that part of the object and the colour of the pixel. However whilst the luminosity/emission strength of that pixel should be correct, when you render your image these values will be converted to an sRGB color space, and the values will not be correct. 



What you need to do is set your display device to "None" in your colour management settings. This will leave your rendered values as Linear Values and not convert them to sRGB.