Terrain Painter
Here we will break down each public parameter of the TerrainPainter component
Last updated
Here we will break down each public parameter of the TerrainPainter component
Last updated
TerrainPainter
- the component of TerraForge 2 designed for procedural terrain painting. It allows you to apply complex layer-based textures and effects to terrains dynamically, offering tools for creating detailed and customizable landscapes with minimal manual effort.
Starting with TerraForge 2 version 2.0.2, serialization bugs have been fixed and presets have been added
"Terrain Layers" Window
- an array consisting of elements of the Terrain Layer
type with additional modifiers. It also has separate buttons for creating and deleting individual layers. The order of the layers matters - the bottommost layer is considered the base layer and cannot have modifiers applied to it, as it is applied to the entire terrain area. Layers can be enabled and disabled using the activity button
(shaped like an eye) next to each layer.
"Modifiers" Window
- an array of modifiers for the active terrain layer. These are needed to adjust and add various rules for layer application on the terrain surface. To open the Modifiers
window, select one of the layers in the "Terrain Layers"
window.
Each element in the modifiers array has various parameters:
Activity
- controls the influence of this modifier on the layer. It is toggled on and off using the activity button
(shaped like an eye).
Name
- the name of the layer. It should never be changed. It serves as a tag for correct operation of the system, in particular for creating and loading presets.
Blend Type
- there are 3 types of blending: Multiply
, Add
, Subtract, Min, Max
.
Modifier Type
- there are 6 types of modifiers: Curvature
, Direction
, Height
, Noise
, Slope
, Texture Mask
.
Let's go over the parameters for each modifier type
:
Curvature
- Adds the ability to use curvature-based effects for the selected layer.
Parameters:
Min Max
- The minimum and maximum curvature values for the modifier.
Radius
- The radius of the curvature effect.
Min Falloff
- The minimum falloff value for the curvature effect.
Max Falloff
- The maximum falloff value for the curvature effect.
Direction
- Adds the ability to control the overlay direction of a particular layer.
Parameters:
X Angle
- The x angle of the directional modifier, ranging from 0 to 90.
Y Angle
- The y angle of the directional modifier, ranging from 0 to 360.
Add Sun Direction
- Whether the sun's direction is added to the angle calculations.
Levels
- The levels for controlling the intensity of the directional effect, with a minimum of 0.
Height
- Adds the ability to adjust the minimum and maximum application heights with smooth transitions.
Parameters:
Min
- The minimum height value.
Min Falloff
- The falloff value at the minimum height.
Max
- The maximum height value.
Max Falloff
- The falloff value at the maximum height.
Noise
- Adds the ability to create a mask for the layer in the form of noise with smooth edges, etc.
Parameters:
Noise Type
- there are 2 types of noise available: Simplex
and Gradient
.
Noise Scale
- controls the noise scale.
Noise Offset
- the offset of the current noise.
Levels
- the levels of the noise represented as a range.
Slope
- Adds the ability to adjust the minimum and maximum application angles with smooth transitions.
Parameters:
Min Max
- The minimum and maximum slope angles to be affected by the modifier.
Min Falloff
- The falloff range for the minimum slope.
Max Falloff
- The falloff range for the maximum slope.
Texture Mask
- Adds the ability to apply a texture mask based on the selected channel.
Parameters:
Texture
- The texture to be used as a mask on the terrain.
Channel
- The channel of the texture to apply for the mask.
Span Terrains
- Whether the mask should span across multiple terrains.
Tiling
- The tiling factor for the mask texture.
Procedural Painting Application Window:
Auto Repaint
- Automatically repaint the terrains if their heightmap is modified. When enabled, it adds a special component to the assigned terrains - Terrain Change Listener
.
"Apply Texture Layers"
Button - Triggers a complete repaint operation. Typically needed if the terrain was modified in some way, yet no changes are made in the TerrainPainter
component.
Window for saving and loading presets for TerrainPainter:
Save the Preset: In the Inspector panel of the TerrainPainter
component:
Click the Save Layer Settings Data button.
Choose a location and name for the preset file (saved as LayerSettingsData
).
Prepare the Terrain Painter Ensure the TerrainPainter component is active on the desired terrain.
Load the Preset
Click the Load Layer Settings Data button in the TerrainPainter Inspector.
Select the saved LayerSettingsData
file from the file explorer.
The preset will automatically be applied to the terrain layers.
If you need to apply presets at Runtime, use the following example script
Terrain Assignment Window:
Terrains
- an array of assigned terrains to which procedural painting will be applied.
Add terrain from this object
- Automatically assigns the current GameObject's Terrain component to the script.
Assign child terrains
- Adds all Terrain components found in the current GameObject's child objects to the script.
Assign all terrains in scene
- Adds all active terrains in the scene to the script's terrain list.
Clear
- Removes all terrains from the script's terrain list.
Additional Settings:
Splatmap Resolution
- The resolution of the splatmap for the terrains (from 64 to 1024
).
Color Map Resolution
- The color/base map is a pre-rendered texture for the terrain color (resolution from 16 to 2048
). This is shown on the terrain in the distance. High resolutions usually have little benefit.
Recalculate bounds
- If the terrain size has changed, the bounds must be recalculated. The white box must encapsulate all terrains.
Refresh Modifiers
- Reapplies and updates all modifiers currently assigned to the terrain layers.
Important Note:
The Terrain Painter
component cannot be copied or moved to other scenes. Doing so may lead to broken references, loss of data, or unexpected behavior.
To work across scenes:
Save your settings as a preset using the Save Layer Settings Data
button.
In the target scene, add a new Terrain Painter
component to your terrain.
Load the preset using the Load Layer Settings Data
button to restore your configuration.
This ensures proper transfer of settings while maintaining stability and avoiding errors.