Author Topic: Exporting heightfields (or alpha brushes for Unreal) using orthographic renders  (Read 260 times)

Offline Matt

  • Planetside Staff
  • *
  • Posts: 3578
  • I'm the crazy one
Hey everyone,

Someone recently asked me if it's possible to use Terragen to generate "alpha brushes" to use in Unreal's landscape sculpting system. Basically these are just texture maps which are usually black at the edges. You might want to generate these from heightfields in Terragen. You can also generate them from procedural terrains.

So basically the problem is: how do we export a heightfield (or height map) from a terrain in Terragen?

There are lots of ways to do this. If you work only with Heightfield nodes in Terragen, then you can right-click on a heighfield node (green node), save it an EXR file and convert it to an 8-bit (or 16-bit) format in Photoshop or some other image editing tool. Or you could save to .TER and use third party tools to convert the .TER to an 8-bit or 16-bit image. But it might be difficult to converting EXR or TER files to something you can use.

If you work with procedural terrains, you can convert them to heightfields using the Heightfield Generate node. Then you can export them like any other heightfield, but you still have the problem of converting them to the image format you want.

There is another way that may be easier: Render an orthographic view of the landscape, and use a shader that maps the altitude (or Y coordinate) to luminosity.

I created a project (TGD file) which shows you how to do this. The TGD is attached below so you can try it yourself. Here are some notes on how the TGD is set up:

- Set diffuse colour to 0 and use luminosity only. This makes it independent of lighting conditions; this is important for a raw capture of the heightfield.
- The orthographic camera's rotation is (-90, 0, 0). This points it directly downwards.
- The orthographic camera is positioned at (0, 10000, 0). If your terrain reaches a height above 10000 then you will need to increase the Y position.
- The orthographic camera has an "ortho width" of 1000. This renders at 1km x 1km area.
- The renderer's gamma correction is set to 1.0 and tonemapping is turned off. This allows you to get a raw capture of the heightfield.
- You can render at whatever resolution you need for your intended use. I decided on 512 x 512 so it renders in the free version.

« Last Edit: June 20, 2019, 03:48:42 AM by Matt »
Just because milk is white doesn't mean that clouds are made of milk.

Offline WASasquatch

  • Member
  • *
  • Posts: 3416
Great share, to add to this, I'd like to add two previous shares for the same purposes. One to export terrain, and the other to export cloud fractals.

Offline Stormlord

  • Member
  • *
  • Posts: 234
    • Dirk Kipper fresh art and new grafics for your computer
Great Share

Thank you both!


Offline bobbystahr

  • Member
  • *
  • Posts: 10414
  • Turn, and face the Strange Ch Ch Changes...D Bowie
something borrowed,
something Blue.
Ring out the Old.
Bring in the New
Bobby Stahr, Paracosmologist

Offline zaxxon

  • Member
  • *
  • Posts: 1129
Hmmmmm.... Thanks Matt!