From BlenderWiki

Jump to: navigation, search
Blender 2.41+
This tutorial tries to show how you can render heightmaps (greyscale images where dark shows the 'lowest' and white the 'highest' points) in Blender.
->

[edit] Set up the geometry

<span id="01"/>(1) Basic geometry
  • Add a plane (Space >> Add >> Mesh >> Plane) in Top view (NumPad 7) and transform it into your desired height-field. For easier handling later on I suggest to use a size that is exactly 2x2 Blender units (the default size of the plane) or a bit greater, so we don't need to correct the output image ;)
Note
You can get some information on how to do that in


  • Set the plane smooth by selecting Set Smooth in the Link and Materials panel in the Editing context (F9)
  • Delete the lamp and the current camera by selecting them  RMB Image:Template-RMB.png and hit Del or X. We don't need them as they are.
Note for the "material" way
If you are importing a mesh and/or have rotated the mesh in ObjectMode you need to apply this transformation in ObjectMode by pressing Ctrl A->Apply scale and rotation. This is needed because the black->white gradient we'll create below (or use from the blend file) is applied to the local axes of the mesh and is therefore rotated as well in ObjectMode.



[edit] Using materials

[edit] Set up the material

<span id="02"/>(2)
<span id="03"/>(3)
  • Go to Shading context F5 >> Material buttons
  • Material panel >> Add New
  • Toogle the Shadeless button in the Material panel.
  • Texture buttons F6 (or Shading context F5 >> Texture buttons)
  • Texture panel >> Add New
  • Texture Type >> Blend

<span id="04"/>(4)
<span id="05"/>(5)
  • Colors panel >> activate the Colorband button
  • Change the alpha value of the black color to 1 (drag the A-slider to the right)
  • Change to the second color-point (default color = cyan) by clicking on the right marker in the 'colorband' or by clicking on the right arrow beside the cur:0 text (this text shows you what point ogf the colorband is currently selected}}
  • Change the color fron cyan to white. You can do this by dragging the R, G and B sliders tot he left or by clicking in the color-field and selecting the white color with the mouse.
  • Go back to the Material buttons press F5 until they show again (or press F6+F5 ... or you can select the icons of course)
  • Select the Map Input panel and change all the mappings in the lower left to Z / Z / Z


[edit] Render settings + render

<span id="06"/>(6) Camera settings.
  • Make sure you are still in Top view (NumPad 7).
  • Add a new camera by pressing Space >> Add >> Camera
  • Switch to Editing context by pressing F9
  • Enable the Orthographic button in the Camera panel.
  • Change the Scale value of the camera to 2 (equals 2x2 blender units)

<span id="07"/>(7) Moving the camera.
  • Move the camera upwards the z-axis by pressing G + Z and dragging it upwards. Since it is an orthographic camera it doesn't matter much how far you move it up.

<span id="08"/>(8) Scene settings.
  • Switch to Scene context (F10)
  • Change the SizeX and SizeY values to 512 (or any other square size you need as an output-format) in hte Format panel.

<span id="rendermesh"/>(9) Mesh that will be rendered
  • Hit F12 to render the heightmap and hit F3 to save it when finished.
<span id="render"/>(10) Render


[edit] Download example .blend file

Tutorials-Heightfield.blend

[edit] Links & Related Content

Related forum threads

Related Content

Links

[edit] Using composition nodes

TODO

See this thread and Reference/Windows/Nodes/Composite Nodes#Map_Value (as used in a DOF nodetree) for some hints.