4
$\begingroup$

I need to create a height-map and pass it into a custom shader in Unity3D.

I can pass it into the shader as a greyscale texture.

I believe I can create a height-map in Blender by starting out with a 100x100 (say) grid, restricting movement to only the vertical axis, then I can use stock tools to mould the surface.

But now is there any tool that can export the resultant height-map as a greyscale texture?

Would I have to write my own using Python?

$\endgroup$
6
$\begingroup$

You can use Displacement baking.

  1. Create your base grid/plane, create a new blank image and UV unwrap the plane onto it, then duplicated it.

  2. Model/sculpt the plane (if you are using sculpting and not using dyntopo, you may want to use the multires modifier. See below).

  3. Select the sculpted/deformed plane and the duplicate (still just a flat plane), so that the flat plane is the active object.

  4. Enable Selected to active in Render settings > Bake and set the bake mode to Displacement. If your sculpted plane goes more than half a BU above or below the duplicated plane, you may want to enable Normalize.

  5. Press Bake. Note that currently have BI selected as the current render engine to bake textures, however this is will be available for cycles in 2.71.

Result:

enter image description here

Multires

If you are going to use sculpting, you could also use the Multires modifier. See This post.

  1. Add plane, create image, UV unwrap, and add multires modifier in simple mode.

  2. Sculpt details

  3. Set the Preview subdivision level to zero, then bake with Bake from multires enabled:

    enter image description here


Cycles baking

Even before 2.71 comes out, it is possible to do this in cycles by rendering your terrain top down (with an orthographic camera) and with the Z position mapped to a gradient.

See this post for details.

$\endgroup$
  • $\begingroup$ Heightmap seems to be inverted (usually it goes from black/low/(0,0,0), to white/high/(255,255,255)). Make sure the normals are pointing the right direction and select the other way around (sculpted and then the plane which is uv-mapped) :). $\endgroup$ – user2859 Apr 30 '14 at 22:38
  • $\begingroup$ Oops. You are right, thanks for the correction :) $\endgroup$ – gandalf3 May 1 '14 at 1:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.