Table of Contents

Flatten At Node

  • Category: General
  • Edition: All editions
  • Output type: Height
  • Typical place in a graph: after the main terrain height and a position generator, before erosion or Height Output

Flatten At creates a rectangular level pad around every valid position. Each pad samples the existing terrain height at its center and blends the surrounding area toward that sampled level.

Noise terrain, Scatter positions, and a Radial Gradient mask feeding Flatten At

When to use it

  • Prepare level sites beneath scattered buildings, rocks, trees, or other objects.
  • Create several pads that follow the local elevation instead of sharing one global target height.
  • Stamp repeated landing areas, foundations, or clearings from a position buffer.
  • Vary pad rotation and size with maps.
  • Not for leveling one continuous region to a chosen constant elevation. Use Flatten for that.

Inputs

Slot Type Required What to connect
Height Height No The terrain to modify. The node also samples this input at every position to obtain that pad's target level. An empty input uses zero height.
Positions Position buffer Yes for any effect Centers of the flattening pads. Invalid positions are ignored. Without positions, Output is an unchanged copy of Height.
Mask Mask No Shape repeated inside every pad. White reaches the sampled level, black preserves Height, and gray blends. An empty input uses white and makes solid rectangular pads.
Rotation Mask No Map sampled at each position to vary pad orientation between Min Rotation and Max Rotation.
Scale Mask No Map sampled at each position to vary pad size. Its value is multiplied by Scale Multiplier.

Mask is mapped from 0 to 1 across each individual pad; it is not sampled in terrain coordinates. One Radial Gradient therefore produces the same soft circular shape inside every rectangular pad.

Rotation and Scale are sampled once at each position in terrain coordinates. They can give different settings to different pads.

Outputs

Slot Type What it holds
Output Height Height with one locally leveled pad drawn around every valid position.

Properties

Property Default Range What it does
Size 0.1 0 or greater Width and length of every square pad before Scale is applied. With Size In World Space off, 1 spans the biome width. With it on, Size is measured in meters.
Size In World Space Off On or off Changes Size from a fraction of the biome width to meters.
Min Rotation -360° Any angle up to Max Rotation Orientation used when the effective Rotation value is 0.
Max Rotation 360° Any angle at least Min Rotation Orientation used when the effective Rotation value is 1.
Rotation Multiplier 0 0 to 1 Multiplies the Rotation input before mapping it between Min Rotation and Max Rotation. Without a Rotation input, this setting directly chooses one point in that range.
Scale Multiplier 1 0 to 1 Multiplies Size for every pad. When Scale is connected, the sampled map value is multiplied by this setting. A value of 0 collapses the pads to zero size.

The default rotation is -360 degrees, which has the same visible orientation as 0 degrees.

Common properties

Property What it does
Id The node's unique name in this graph, shown for reference. You cannot edit it. Scripts and the AI workflow CLI use it to find the node.
Resolution Sets the output size. Relative To Main Input (default) follows Height when connected; otherwise it uses the graph's Canvas Resolution. Relative To Graph follows Canvas Resolution. Absolute sets an exact size. Absolute is limited to 32 to 512 in Vista Personal and 32 to 4096 in Vista Indie and Pro.
Split Execution Lets the node run in a separate step when Allow Split Execution is on. Flatten At also generates pad geometry and samples Height once per position, so cost depends on both output resolution and position count.
Bypass Skips all pads and forwards Height unchanged.

How each pad is created

For every valid position, Flatten At:

  1. Samples Height at the position to obtain the target level.
  2. Builds a square centered on the position.
  3. Applies the effective scale and rotation.
  4. Maps the optional Mask across that square.
  5. Blends each covered height toward the sampled target:

output = blend(current height, height at pad center, mask)

Because every position samples its own target, pads at different elevations remain at different levels. Flatten At does not use the position buffer's Y value as the target height.

Examples

The sample uses 300 meter Perlin Noise as Height. Scatter provides a sparse set of positions, and Size is 220 meters.

Original terrain

Mountainous Noise terrain before local pads are created

The source contains steep and uneven terrain with no prepared placement sites.

Solid pads

Square flat regions visible in the Flatten At 2D output

With Mask disconnected, every pad is solid white internally. Each square reaches the height sampled at its center.

Several flat pads with sharp edges cut into mountainous terrain

The result clearly shows why an unconnected Mask is useful for exact foundations but often too abrupt for natural terrain.

Soft pads

Radial masks blending each pad gradually in the 2D output

A Radial Gradient repeats inside every pad. Its white center approaches the sampled target, while its gray edge fades into the original terrain.

Soft local pads blended into mountainous terrain

The softened pads are less obvious from a distance, but they avoid the vertical walls produced by solid squares.

Recipes

  • Scattered building foundations: feed the same positions used for object placement into Flatten At, use a pad slightly larger than the building footprint, and connect a mask with a white center and soft edge.
  • Different foundation sizes: connect a Scale map whose value reflects the object footprint, then use Scale Multiplier as the overall size control.
  • Oriented rectangular context: set Min Rotation and Max Rotation to the intended range and connect the same Rotation map used by the placed instances.
  • Naturalized sites: create the pads before light thermal or hydraulic erosion so their boundaries settle into the terrain.
Tip

Reuse the same Positions, Rotation, and Scale sources for both Flatten At and object placement. The terrain pads then stay aligned with the spawned objects.

Note

The current pad geometry is square. Rotation changes its orientation, but a square looks identical after quarter turns unless the Mask itself is directional.

Warning

Overlapping pads can compete because each one uses its own sampled target height. Keep positions far enough apart or reduce Size when crossings produce steps or unexpected overwrites.

Performance

Flatten At first copies Height, then generates six vertices per position, samples one target height per position, and draws all pads into the output. Cost grows with output resolution and valid position count. Avoid dense position buffers when only a few placement sites need leveling.

  • Flatten: levels one masked region toward a constant target height.
  • Scatter: creates procedural positions for repeated pads.
  • Radial Gradient: gives every pad a soft center and edge when connected to Mask.
  • Blur: softens a custom pad mask.
  • Height Output: sends the prepared terrain height to the terrain.

For AI agents

  • Type name and graph command type: FlattenAt; runtime class: FlattenAtNode.
  • Input slot 0 = Height, Mask used as height.
  • Input slot 1 = Positions, Buffer.
  • Input slot 2 = Mask, Mask.
  • Input slot 3 = Rotation, Mask.
  • Input slot 4 = Scale, Mask.
  • Output slot 100 = Output, Mask used as height.
  • size is clamped to 0 or greater; default = 0.1.
  • sizeInWorldSpace default = false. When true, normalized pad size is size / worldBounds.width.
  • minRotation cannot exceed maxRotation; defaults are -360 and 360 degrees.
  • rotationMultiplier and scaleMultiplier are clamped from 0 to 1; defaults are 0 and 1.
  • Effective scale is scaleMultiplier, additionally multiplied by Scale sampled at the position when connected.
  • Effective rotation is rotationMultiplier, additionally multiplied by Rotation sampled at the position when connected, then mapped from Min Rotation to Max Rotation.
  • Mask is sampled in local pad UV coordinates. Empty Mask uses white.
  • Target height is sampled from Height at each position. Empty Positions returns Height unchanged.
  • Bypass forwards Height unchanged.
  • Sample graph: Assets/_DocSamples/NodeGraphs/FlattenAtNode_Doc.asset.