# Paint with mask

No, this isn’t about painting in a costume! It’s about applying textures to the terrain without using the Paint tool in the World Editor, by using texture masks instead.  
  
**By Tanin69**

# Why this tutorial

There are several cases where this process is beneficial, either to save time or because there’s simply no other way. Here are a few typical scenarios:

1. ****Creating Geometrically Perfect Textures****:  
    Some areas, like airports, require nearly perfect geometric surface textures. Airport ground textures, for instance, are usually composed of geometric shapes.  
    [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/N20image.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/N20image.png)
2. ****Mass Texture Generation****:  
    If you need to create large areas without manually painting each one individually, like agricultural field checkers, this process is invaluable. Doing this by hand over half your terrain would be a massive task!  
    [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/HnJimage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/HnJimage.png)
3. ****Specific Road Textures****:  
    For textures under road generators, especially for “runway” types, the standard road generation method (exporting surface masks, generating the satmap, importing with “generate roads” enabled) doesn’t support this particular texture type. Unfortunately, there’s currently no straightforward way to draw perfectly geometric shapes with the Paint tool. If I’m wrong, please correct me!

In these cases, the “least bad” solution is to work with surface masks.

# Warning

Please note, this is the “least bad” solution I’ve found so far, as it has a significant drawback: it requires re-importing one or more surface masks, which usually modifies tiles you didn’t intend to change. This has two side effects:

1. ****Material Limit Errors****: When importing a surface mask, you may encounter errors related to the material limit per tile. In our current project, this affects dozens of tiles, sometimes even over a hundred.  
    [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/b3Dimage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/b3Dimage.png)  
    
    - ****Only click “Yes” if you’re fully aware of what you’re doing!****
2. ****Satmap Regeneration****: To clearly see the result of your work, you’ll need to generate a new satmap and re-import it. This, too, will modify all tiles. If you’re working alone, that’s fine. But if you’re working with others, you’ll be modifying your colleagues’ tiles (specifically their textures), which is highly discouraged and could potentially ruin their work.

We’ll cover how to work around these issues later, but this involves multiple steps with significant calculation times. If you’re working with an older graphics card or have a slow connection, be prepared for lengthy processing times (generating a new satmap, for instance, can take several minutes to even an hour).

# Overview of the Process

- ****Define Texture Zones with Polylines****:  
    Use polylines to outline the areas where you want to apply textures.
- ****Export to SVG****:  
    Export these areas as an SVG file.
- ****Import SVG into an Image Editor (e.g., GIMP)****:  
    Open the SVG in an image editor and apply two simple transformations, in a specific order.
- ****Modify the Surface Mask****:  
    Import the surface mask into the image editor, make the necessary adjustments, and export the updated mask.
    - ****If working solo, make a backup of your project before proceeding!****
    - ****If working with a team on a remote repository, follow the guide carefully****<span style="white-space: pre-wrap;"> to ensure smooth collaboration.</span>
- ****Import the Mask into Enfusion****:  
    After all modifications, import the updated mask into Enfusion.
- ****Generate and Re-import the Satmap****:  
    Generate a new satmap to reflect your changes, then re-import it.
- ****Update Sources with a Semi-Manual Process****:  
    Apply only the modified tiles, preserving your teammates' textures by avoiding overwrites.

# Creating Masks with Polylines

To create masks, define all the areas with polylines for which you want to generate texture masks. Then, export these polylines in SVG format. It’s helpful to create a dedicated layer for this purpose, as you’ll need to select only the specific polylines to export.

****Example****: I need to cover certain areas with the Concrete01 texture.

- First, I create a new layer and place all the export-ready polylines there.  
    [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/R6simage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/R6simage.png)
- Then, I draw the polylines, adjusting their colors as needed to differentiate them.  
    [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/GrXimage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/GrXimage.png)

#### Tips

- ****Creating Polylines from Existing Splines or Polylines****:
    - <span style="white-space: pre-wrap;">Switch to the </span>**Vector Tool**, select points from an existing polyline or spline.
    - <span style="white-space: pre-wrap;">If you want to select all points, use the </span>**Select All**<span style="white-space: pre-wrap;"> button.</span>
    - <span style="white-space: pre-wrap;">Click </span>**New Polyline from Selected**<span style="white-space: pre-wrap;"> to create a new polyline from the selection.</span>  
        [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/4Gjimage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/4Gjimage.png)
- ****Creating Rectangles, Squares, or Circles****:
    - Start by creating a polyline with at least two points.
    - <span style="white-space: pre-wrap;">Convert this polyline into a </span>**Polyline Area**.  
        [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/HFHimage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/HFHimage.png)
- ****Experimenting with Parameters and Buttons****:  
    Adjust parameters and explore available options to get the desired results.  
    [![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/f2Yimage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/f2Yimage.png)

****Examples of Results****: This technique isn’t limited to creating masks; it can also be used for roundabouts, soccer fields, etc.  
[![image.png](https://wiki.nabla.sh/uploads/images/gallery/2024-11/scaled-1680-/Qrximage.png)](https://wiki.nabla.sh/uploads/images/gallery/2024-11/Qrximage.png)

### Limitation

Currently, I haven’t found a straightforward solution for creating masks for curved runway generators. After all, who needs curved runways, right? 😂 The default road generator lacks a Concrete (non-transparent) material, so until someone develops it, the only workaround is approximating curved roads with carefully placed polylines.

# Exporting Polylines in SVG Format

1. In the hierarchy, select the polylines you wish to export.
2. <span style="white-space: pre-wrap;">Click on the </span>**Export Geographic Data**<span style="white-space: pre-wrap;"> tool.</span>  
    ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXesVKyJhh2drc3xbcSQj8OMbM8bVPgcA6ErmxKBUqD0GfWVWAH260munpy1SsXpaf-Tu2leJrqS2floOLE-FUztqGEJ-LplQeH_jOpX8KLL_XS57kEHAdHJhau6pXAuvzPP376Oc61Rrs-is0FHMAZRmWDx?key=Azqbz8W2dMbskhcAWWOcVA)
3. <span style="white-space: pre-wrap;">Choose the appropriate options and click </span>**Export**.  
    ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXeKEHlOc_FO_-pYs6a4BMlaRXWFyFr4bgg-8EOBsxQ8aKoUr0nVllf_5tJxihJVRQTW7VtHFxUBhT13hlSuQ9X6QIVkKL8gofIgSNoHRcalR9bxFHD-AVbfU2EaVGeoaFdf2VhJIrwKaW7xON5hqRfLjZzk?key=Azqbz8W2dMbskhcAWWOcVA)

> ****Note****<span style="white-space: pre-wrap;">: With this setup, the generated file will be named </span>`<span class="editor-theme-code">export.svg</span>`<span style="white-space: pre-wrap;"> and saved in the </span>**profile**<span style="white-space: pre-wrap;"> folder within your default </span>**Workbench**<span style="white-space: pre-wrap;"> directory.</span>  
> ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXevys2YxboV1F1Wtflx2D3Gy0t1J_nHFzrwn0xBAvtGB3sGwqXbxWrgMdqDJnq5QJhBQJDMvGKdG4w9J0EyTSCOSvums2QAQpsHYgK8lyuK2MHu6w2SCqNGHr74QRiq4c-XqS-VMHlCz8wtXerpOAeHkmH9?key=Azqbz8W2dMbskhcAWWOcVA)

# Importing the SVG into GIMP

****Important****: SVG exports are not exactly the same size as the surface masks. To avoid misalignment between the SVG masks and Enfusion’s surface mask, follow these steps in the exact order:

1. ****Import the SVG into GIMP****.
2. <span style="white-space: pre-wrap;">Apply a </span>****vertical mirror transformation****<span style="white-space: pre-wrap;"> to the image.</span>
3. ****Resize the image****<span style="white-space: pre-wrap;"> to match the exact dimensions of Enfusion’s surface masks.</span>

After completing these steps, you can continue working in GIMP without alignment issues.

# Importing Existing Enfusion Textures into GIMP

<span style="white-space: pre-wrap;">For those familiar with surface masks, this process will be straightforward. If not, I recommend watching this video: </span>[Surface Mask Tutorial](https://youtu.be/pJ1QKCz-f3M?si=-IA5FTm06qWLhr5u).

1. ****Export the Surface Mask****<span style="white-space: pre-wrap;"> corresponding to the texture you want to modify.</span>
2. ****Import this mask into GIMP****. I recommend adding it as a new layer in the SVG image you previously imported, but there are other methods as well.
3. ****Modify the Mask****:
    - The main task is to paint white over the areas of the surface mask layer that correspond to the SVG mask layer.
    - My approach:
        - On the SVG layer in GIMP, select all painted areas.
        - Switch to the surface mask layer.
        - Paint the selected areas white.
4. ****Export the Image as PNG****<span style="white-space: pre-wrap;">: It’s highly recommended not to overwrite the original Enfusion mask, so you can revert changes if needed. Use a clear naming convention for your modified mask, e.g., </span>`<span class="editor-theme-code">Concrete01-mod1.png</span>`.

# Importing the Modified Surface Mask into Enfusion

<p class="callout warning">****Warning****: Importing the texture mask will modify all tiles and will likely trigger errors (see the previous warning). If you’re working alone, be sure to make a backup of your terrain before importing the mask.</p>

If you’re working in a shared environment with a remote repository, you’ll need to retrieve the latest repository state and perform a “semi-manual” update (explained in upcoming steps).

1. ****In Enfusion, import the modified mask file****<span style="white-space: pre-wrap;"> (e.g., </span>`<span class="editor-theme-code">Concrete01-mod1.png</span>`) into the appropriate texture slot.  
    ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXdw3TQvmhEiNZl1k-wTsetSXa03cEXT7p685yeFIZaeqODcekEqBl6uyfJjZSeIwLgXLmCHRaU_US495uLySqX1XvZboQLcF0FMN4XKOLbkEpaPQo0VgIQiUN-zZE-6HiXDCM8Wm72hyX-E6P6R8K1Z3-eJ?key=Azqbz8W2dMbskhcAWWOcVA)
2. ****Repeat as Needed****<span style="white-space: pre-wrap;">: You can repeat these steps as many times as needed to refine your texture adjustments, smoothing, shapes, etc. However, before re-importing a modified texture, it’s recommended to first import the base texture of your terrain to reset previous changes (e.g., in our project, we use the </span>`<span class="editor-theme-code">Grass03</span>`<span style="white-space: pre-wrap;"> texture as the base).</span>

This will help keep previous modifications clean and maintain consistency across your terrain.

# Updating the Satmap

It’s hard to accurately assess the results of these modifications without generating a new satmap. Since we’re working with large areas, a high-altitude camera view is often required, where only the satmap textures are visible. Therefore, updating the satmap is frequently necessary to see the final quality of your work.

<p class="callout warning">****Warning****: Updating the satmap, followed by refreshing all terrain textures, can be very time-consuming. In our 256 km² project, on a modest setup (like an Nvidia 1060 GPU), these steps take a minimum of 45 minutes</p>

#### Steps to Update the Satmap

1. ****Export All Surface Textures****: Export the updated surface textures.  
    ![](https://lh7-rt.googleusercontent.com/docsz/AD_4nXed14IdqNWdd919uQot5kSOLoL8GrlZUTXRB2t_q4GS2Wj6_hWrQajsiH-wD3B0NpXyWsPjZuuS2RHCJysqXoNH93y5u82Kj-xoYa_A7u44mUf9KLCtu7akQa-Tr7uOWQ5Jo6R0rPL9pSIiY6l8vgwAfSSg?key=Azqbz8W2dMbskhcAWWOcVA)
2. ****Generate a New Satmap****:  
    <span style="white-space: pre-wrap;">Our team uses the </span>[<span style="white-space: pre-wrap;">ReforgerSatGenerator </span>](https://github.com/granQ/ReforgerSatGenerator)Python script by Daniel Granquist, which has saved us substantial time (a big thanks to him!).
3. ****Import the New Satmap****: Import the newly generated satmap into Enfusion.
4. ****Save and Wait for Tile Updates****: Save your project and wait for all tiles to update, which can take 20–30 minutes on similar configurations.

This update is essential for evaluating how your modifications look across large areas of terrain.

# Updating Sources

If you’re working solo, you should have backed up the terrain before the first surface mask import. Simply follow Step 3 to update without overwriting any changes.

If you’re working with a remote repository, follow these steps:

##### Create a Backup:

Rename your project folder, adding a suffix like -MOD to create a backup (e.g., project\_name-MOD).

Retrieve Sources from the Remote Repository:

Initialize the remote repository as if it’s a fresh local setup. For example, using the command line, run:

git init &lt;remote\_repository\_url&gt;

##### Copy Modified Files to the Local Repository:

- From your backup (e.g., project\_name-MOD), copy the following into the local repository folder you just retrieved:
- The layer you’re working on.
- All modified tile files.

Tile File Locations:

##### Locate modified tiles in both:

- project\_name-MOD\\...\\Terrain\\.Data
- project\_name-MOD\\...\\Terrain\\.Editor data
- Copy any files with the tile numbers you modified. For example, if you changed tiles 156 and 157, copy all files containing 156 and 157 from both .Data and .Editor Data directories.

Since this is time-consuming manually (each tile has eight associated files across two folders), I recommend using a Python script to automate the process.

1. Update and Push Changes:

Once the files are copied, update your local repository and push the changes to the remote repository.

This ensures only the intended tile modifications are uploaded without affecting the work of others in your team.