CutoutPathModifier
A class in Root.Township, Alta.Forests.
Forest generation modifier that sinks the terrain along paths between small nodes that sit low compared with their surroundings, making cut-out trenches, and paints them with splat layer 5.
- Listed in World generation
- Inherits or implements
NodeMapModifier,ITerrainModifier
Constructors
| Member | What it is |
|---|---|
CutoutPathModifier() | Unity makes components itself; use AddComponent or spawn a prefab instead of new. |
Fields
20 private and internal fields
| Member | What it is |
|---|---|
private AttributeSingleValue[] attributes | Node attributes to add to cut-out nodes, scaled by their strength. |
private float blurDraw | Weight of neighbouring nodes' scores in each blur pass. |
private int blurIterations | Number of blur passes over the node scores. |
private float blurSustain | Weight of a node's own score in each blur pass. |
private float bumpScale | Scale of the noise added to the cut depth. |
private float bumpStrength | Strength of the noise added to the cut depth. |
private AnimationCurve depthCurve | Depth falloff from the path centre (0) to the cut's edge (1). |
private float extraRadius | Added to the path's radius to get the cut's width. |
private static Logger logger | NLog logger for this class. |
private float maxIndent | Deepest the terrain is lowered, at full strength. |
private float maxRadius | Nodes bigger than this are never cut out. |
private float maxSurroundings | Nodes whose maximum relative elevation is above this are never cut out. |
private float minSurroundings | Nodes whose minimum relative elevation is below this are never cut out. |
private float nodeCutoffStrength | Blurred score a node needs to be cut out. |
private Dictionary<Node, float> output | Final cut-out strength per node. |
private Random random | Random seeded from the forest seed, used for attribute values. |
private float sectionCutoffStrength | Blurred score a node needs to start a cut-out. |
private float simplexScale | Scale of the noise that varies the cut's width. |
private float simplexWeight | How much noise varies the cut's width. |
private Dictionary<Node, Vector2> strengths | Working node scores during Modify. Cleared afterwards. |
Methods
| Member | What it is |
|---|---|
float GetScore(Node node) | The cut-out strength worked out for a node, 0 if it isn't cut out. |
override void Modify(ForestGeneration forest) | Scores each node from its relative elevation and radius, blurs the scores across normal paths, then cuts out nodes that pass sectionCutoffStrength. |
void ModifyHeight(ForestGeneration forest, ForestGenerator.NearestInfo nearestInfo, Vector2 position, ref float height) | Lowers terrain near a path between cut-out nodes, by up to maxIndent, shaped by depthCurve and noise. |
void ModifySplat(ForestGeneration forest, ForestGenerator.NearestInfo nearestInfo, Vector2 position, ref SplatData data) | Paints splat layer 5 near paths between cut-out nodes, at the path's cut-out strength. |
1 private and internal method
| Member | What it is |
|---|---|
private bool Flood(Node node) | Marks a node as cut out if its strength passes nodeCutoffStrength, and adds attributes to it scaled by that strength. |
Used in
Members of other types that take, return or hold a CutoutPathModifier: