AnswerBun.com

How to render height map in Blender?

Blender Asked by kitfox on November 16, 2020

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?

enter image description here
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:

enter image description here

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:

enter image description here

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:

enter image description here

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.

One Answer

I don't know the method you're using, here is one that seems to work and that is close to the one explained here by CGMatter as linked by @NascentSpace:

  • Create the 3D object you want to bake, put an Orthographic camera over it, give your object the following node setup: Texture Coordinate (Generated Output) > Separate XYZ > ColorRamp (if you need to tweak the highest and lowest) > Emission > Material Output:

enter image description here enter image description here

  • In the Render panel, choose a good Sampling resolution. In the Output panel choose OpenEXR as File Format, otherwise you'll have artifacts. Keep the other settings as they are and render the image.

enter image description here enter image description here

  • Create a plane, subdivide it, give it a new material with an Image Texture (in Non-Color mode) that you plug into the Height of a Displacement node that you plug into the Material Output Displacement socket. Load the OpenEXR image in the Image Texture node. In the Material panel > Settings > Surface > Displacement, choose Displacement Only. It should work:

enter image description here

Correct answer by moonboots on November 16, 2020

Add your own answers!

Related Questions

Move empty as parent so that children follow (python)

0  Asked on December 31, 2020 by jirara

 

Weird UV maps and textures not aligning

1  Asked on December 30, 2020 by icebo

   

Switching beetween UV sets across multiple objects

3  Asked on December 30, 2020 by jzk

 

Geometry data is coming instead of geometry

1  Asked on December 28, 2020 by captain

   

Creating floorplans with blender?

1  Asked on December 27, 2020 by kwinten-blender

 

Why are some images not showing the preview icons?

0  Asked on December 27, 2020 by noob-cat

     

Get same bump from a photo to a model

1  Asked on December 26, 2020 by opponent019

     

Is it possible to edit the size of a Sun lamp in Blender 2.8

2  Asked on December 26, 2020 by neutronprime

   

Blender energy effects

1  Asked on December 26, 2020 by mugen893

   

Eevee fire and smoke issues

1  Asked on December 25, 2020

   

UV map only using half of the texture

0  Asked on December 23, 2020 by kaii

     

Ask a Question

Get help from others!

© 2022 AnswerBun.com. All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP, SolveDir