I'd like to generate a height map from my scene that goes from -50m to +50m (the idea is to use that height map to flatten out ocean waves as they get nearer to the shore, and possibly more advanced effects later).

My problem is that my height map values are not in the expected range. I get near-black, but no white, even in parts where there is nothing in front of the camera (actually, this only happens in the center of the depth image, where the near clipping plane "cuts off" the top of the terrain; that terrain actually has a square base that is somewhat higher up than -50m - see the attached screenshot - so I do not expect white pixels anywhere except in the clipped-off area).

The camera is orthographic, looking straight down from a height of 51m, with the near clipping plane at 1m and the far clipping plane at 101m. I was expecting this to cover the range from +50m to -50m I mentioned above.

In the compositor, I use the Depth output of the Render Layers node, which I plug into a Map range that maps the range 1..101 to 0..1. And that's my output.

But like I said, there is no white on it. The brightest pixel that I get is a CECECE.

Can someone tell me what I'm doing wrong?

Compositor setupScene + Camera setup

  • 1
    $\begingroup$ The issue is likely due to color management because you're not saving as OpenEXR (or setting the view transform to Raw). You also don't need the Map Range node, you can use the Mist render pass which is already normalized. If that is the case I can add this as an answer. $\endgroup$
    – Robert Gützkow
    Nov 28, 2019 at 8:23
  • $\begingroup$ @RobertGützkow I think this is on the right track, but I can't get it to work completely right. Whatever I try, the height map is always somewhat off - I can't seem to calibrate things so that my shader (Godot) really gets height 0 where height is supposed to be 0. If you're willing to write a complete answer, can I ask you not to skip any steps, and to make sure all settings are mentioned - I've played with Blender for a long time, but never seriously, and never for compositing before this. $\endgroup$ Nov 29, 2019 at 23:01
  • $\begingroup$ What image format do you need for Godot? $\endgroup$
    – Robert Gützkow
    Nov 29, 2019 at 23:52
  • $\begingroup$ @RobertGützkow No particular format, though when I tried EXR, it didn't seem to contain what I expected. I actually think a simple PNG might be best for now, especially if I want to add more info later on - I can then simply use the three remaining channels. $\endgroup$ Nov 30, 2019 at 12:40

1 Answer 1


In order to save a render as image, the scene linear values have to be transformed into the chosen display color space. This is what the Display Device and View Transform settings are for in the Color Management panel. However depth information are non-color data that shouldn't be transformed (except for mapping to the value range the image format can store). Therefore you either need to save the image as OpenEXR, which will store the scene linear values or you can choose another format, but then you will have to set the View Transform to Raw. You can find more information about the color management settings in Blender's manual.

Color management

Since you don't want to store the actual depth values, but rather normalized values in the range $\left[0,1\right]$ (or $\left[0,255\right]$) you will have to normalize the depth pass. Switch to the compositor and enable Use nodes. Add a Normalize node (Add > Vector > Normalize) and connect the Depth socket with its input Value socket. Connect the output Value socket to the Image socket of the Composite node.

Compositing nodes

With these settings you should get the expected values in your saved image.

  • $\begingroup$ Thank you! The Color Management is what I was missing: setting it to "raw" now gives me the full range. The Normalize node doesn't seem to make a difference, which hopefully indicates I set up my camera correctly. It's not that I don't want to use OpenEXR - in fact it seems Godot has at least some degree of support - but I might need the option to export to a more classical format. $\endgroup$ Dec 3, 2019 at 23:12

You must log in to answer this question.

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