# Using TerraRoad

## Quick Start

{% embed url="https://youtu.be/tF4_IzExQv8" %}
Quickstart Video Guide
{% endembed %}

## Input files

TerraRoad requires two input files.

*   The first is a heightfield in .exr format.  This can be obtained in Terragen&#x20;

    by connecting a terrain to the Shader input of the 'Heightfield Generate Node',&#x20;

    generating a heightfield, and then right clicking the node and saving as EXR.

    I recommend starting out with a 1 pixel/meter resolution, since all TerraRoad measurements are

    in pixels.

{% content-ref url="workflow/preparing-terrain-exr" %}
[preparing-terrain-exr](workflow/preparing-terrain-exr)
{% endcontent-ref %}

*   The second input is an SVG file with a single path (for now) defining the road shape.  I created

    mine in Affinity Photo.  First I converted my heightfield EXR to a JPEG so I could see it better,

    then I used the Pen tool in "Smart Mode" to create a path along the terrain.  I then hid all the layers

    except for the path (not sure if this is necessary), and saved as an SVG file.

{% content-ref url="workflow/preparing-road-path-svg" %}
[preparing-road-path-svg](workflow/preparing-road-path-svg)
{% endcontent-ref %}

## Using TerraRoad

Once the input files are ready, launch TerraRoad using its python script as described in [Installation](installation). You should see a window appear with some buttons and sliders. Use the buttons to select your EXR and SVG, and then select a folder where the output files will be placed. Click 'Create Road', and wait for your road to build. This can take several minutes depending on your settings and heightfield resolution. The output folder should open automatically when complete.

![](https://2833661647-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MiHhDWOB_KNBDxRh-Cp%2F-MiHmmcEmxQQgGcr8Gio%2F-MiHmrve3ivrcB6Uh5Jj%2FUI.PNG?alt=media\&token=529d28e6-2772-41ef-a9a2-7287f20a0c5a)

### Output Files

Eventually there will be docs with some pictures explaining these better.

* terrain\_with\_road.tif - Heightfield with road added, ready for import into Terragen.
* masks\_road - Mask of road surface
* masks\_shoulder - Mask of road surface and shoulder
* masks\_shoulder\_fade - Soft mask of road surface, and shoulder with gradient reaching only to the road
* masks\_road\_and\_shoulder\_fade - Soft mask of road and shoulder with gradient reaching all the way to the center
* masks\_center\_line - Mask for center paint line
* masks\_center\_line\_with\_dashes - Mask for dashed version of center paint line
* masks\_side\_lines - Mask for two lines on side of road
* masks\_cut - Mask for shoulder area above the road surface
* masks\_fill - Mask for shoulder area below the road surface

## Example Files

There are some example files included, a sample road SVG, and a basic Terragen scene showing some ideas for using the resulting masks. To generate a heightfile from the sample scene, open the node 'Heightfield generate 01', and click Generate Now. Then right click on the node, and click 'Save file as' and save as an EXR image. For more help on exporting terrains from Terragen, see the [Preparing Terrain Guide](workflow/preparing-terrain-exr), or [this video](https://www.youtube.com/watch?v=NTlhqIs89ZI\&ab_channel=TerraTuts).

![](https://2833661647-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MiHhDWOB_KNBDxRh-Cp%2F-MiHoJe8Q6IdWXlx77-J%2F-MiHpFeWv_cNdPWphrwZ%2FTutorial1.PNG?alt=media\&token=721d1239-cf64-41a5-8fdc-b2818649ec9d)
