0
$\begingroup$

I am able to render and save a height map from Blender using the nodes:

Render Layers (Out: Depth) > Normalize > ColorRamp (In: Fac, Linear, Out: Image) > Composite (In: Image)

However, the height map treats the lowest point on the mesh as 0 (RGB 0,0,0), and the highest point on the mesh as 1 (RGB 255,255,255). Can I generate the height map using the world coordinates of the vertices instead? My mesh origin is at (0,0,0).

Example - a vertex with a height of 50 should have a height map (RGB) value of (50,50,50).

Thanks!

$\endgroup$

1 Answer 1

1
$\begingroup$

Connect the depth output to a viewer node, then open an UV/Image window and select the viewer node as display.

If you click on the image (which seems generally totally white) you can read the values of every pixel.

enter image description here

So, you can directly save as image using a format that can handle theese "super white" values, like openEXR.

Just remember that Depth pass is not world height but distance from camera, so you will have to add a simple math node, subtracting the Depth value from the Z location of the camera (in my example 5 Blender Units)

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks, Josh! However, I may not have been clear in what I’m looking to do. I am looking to create a regular heightmap with RGB values 0-1.0. However, I’m having an issue where the vertex height doesn’t match the heightmap value. For example, a vertex with a height of 50 seems to lead to a heightmap color of (100,100,100), for some reason. The generated heightmap colors are inconsistent. I would like the heightmap colors to directly match the height of each vertex. $\endgroup$ Commented Feb 4, 2019 at 16:58
  • $\begingroup$ You can try to put the normalize node after the subtract node, so to map all values between 0.0 and 1.0. $\endgroup$ Commented Feb 4, 2019 at 17:39
  • $\begingroup$ You can read also this interesting answer; blender.stackexchange.com/questions/52328/… $\endgroup$ Commented Feb 4, 2019 at 18:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .