Skip to main content

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.

Constructors​

MemberWhat it is
CutoutPathModifier()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

20 private and internal fields
MemberWhat it is
private AttributeSingleValue[] attributesNode attributes to add to cut-out nodes, scaled by their strength.
private float blurDrawWeight of neighbouring nodes' scores in each blur pass.
private int blurIterationsNumber of blur passes over the node scores.
private float blurSustainWeight of a node's own score in each blur pass.
private float bumpScaleScale of the noise added to the cut depth.
private float bumpStrengthStrength of the noise added to the cut depth.
private AnimationCurve depthCurveDepth falloff from the path centre (0) to the cut's edge (1).
private float extraRadiusAdded to the path's radius to get the cut's width.
private static Logger loggerNLog logger for this class.
private float maxIndentDeepest the terrain is lowered, at full strength.
private float maxRadiusNodes bigger than this are never cut out.
private float maxSurroundingsNodes whose maximum relative elevation is above this are never cut out.
private float minSurroundingsNodes whose minimum relative elevation is below this are never cut out.
private float nodeCutoffStrengthBlurred score a node needs to be cut out.
private Dictionary<Node, float> outputFinal cut-out strength per node.
private Random randomRandom seeded from the forest seed, used for attribute values.
private float sectionCutoffStrengthBlurred score a node needs to start a cut-out.
private float simplexScaleScale of the noise that varies the cut's width.
private float simplexWeightHow much noise varies the cut's width.
private Dictionary<Node, Vector2> strengthsWorking node scores during Modify. Cleared afterwards.

Methods​

MemberWhat 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
MemberWhat 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: