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.