Builtin Library
- ..
- README.md4.2 KB
- convert.luau22.2 KB
- curve.luau1.7 KB
- erosion.luau7.2 KB
- init.luau5.9 KB
- lanes.luau5.8 KB
- mask.luau8.2 KB
- modes.luau1.8 KB
- noise.luau3.1 KB
- project.luau3.3 KB
- scatter.luau34.8 KB
- scene.luau26.0 KB
- shape.luau11.1 KB
- surface.luau11.9 KB
- water.luau20.9 KB
- write.luau41.0 KB
README.md
terrainOps
The terrain.* procgen op family: a whole landscape (a valley, a mountain
range, an island ending in a coastline, a plateau cut into terraces) built as
a procgen graph.
M.ops is the family, keyed by registry id. procPacks/terrain.procPack
returns it, and that asset's registration is what puts every op in the proc
registry, the same .procPack path any author outside this package uses to
contribute a family. The procgen toolbox's searchNodes lists them and describeNode
gives one's inputs, params and outputs. The nodes a graph calls as g.terrain.<name>
are this package's terrain.nodebox.
| Movement | Ops |
|---|---|
| source | terrain.source: the rect of ground, in metres, at a resolution |
| shape | terrain.fbm · terrain.cone · terrain.ridge · terrain.ramp · terrain.flatten · terrain.terrace · terrain.stamp · terrain.layer · terrain.project · terrain.erode · terrain.coast · terrain.sea · terrain.lake · terrain.river |
| mask | terrain.mask writes a named layer; every raster kernel op reads one through mask / maskMode / maskGain |
| bake | terrain.write: the whole landscape as a .terrainData: heightfield, control textures, holes mask, layer table |
| carry | terrain.to_texture · terrain.from_texture: one layer in and out of a .texture |
| stand | terrain.scatter · terrain.drape: points onto the surface, and anyone else's points back down onto it |
The value every op takes and returns is a proc.raster Raster: a tiled
GPU grid carrying named scalar layers (height, water, waterMask, and
whatever terrain.mask names).
What is in here
| File | Role |
|---|---|
init.luau | Assembles the family into M.ops. Owns terrain.source. |
shape.luau | The placed shapes: flatten, cone, ridge, ramp, terrace. |
noise.luau | terrain.fbm: multi-octave, optionally domain-warped fractal relief. |
mask.luau | terrain.mask: a soft band over one feature, written to a named layer. |
project.luau | terrain.project: a curve driving the ground by distance to its polyline. |
surface.luau | layer, stamp, coast: an external source blended into height. |
water.luau | lake, sea, river: one water body over three regions. |
erosion.luau | terrain.erode: droplet and thermal erosion batched over the tiles. |
convert.luau | to_texture, from_texture: a raster layer and a texture are the same field in two carriers. |
write.luau | terrain.write: the whole landscape as one .terrainData container. |
scatter.luau | terrain.scatter, terrain.drape: a point cloud off the ground, and points put back on it. |
scene.luau | terrain.ground: the ground the scene's Terrain entities stand on, which drape sets points on. |
curve.luau | A Curve's control points flattened for the payload binding, shared by project and mask. |
lanes.luau | The eight vec4 dispatch lanes a placed-shape kernel's numbers are packed into. |
modes.luau | The shader numberings the ops declare. |
M.packers and M.payloads expose each kind's dispatch numbers with no GPU
dispatch and no readback, which is what a test verifies the maths through.
Out of the graph
A landscape leaves as a .terrainData: the heightfield, the control textures
saying which surface covers where, the holes mask, the water surface and the
table of what those surfaces are, held together as one asset. terrain.write
takes the raster, a name, and the layers (the mask layer names holding each
surface's coverage, in channel order), and answers the reference to the container.
Its children are ordinary .texture assets written inside the container, so
nothing here is a private format and a material samples a control texture the
way it samples any texture. A Terrain component standing an entity on that
container is what puts the ground in a scene.
terrain.to_texture carries ONE layer out on its own, for a raster that is
feeding something other than a landscape; terrain.from_texture is the way back
in, and it is how a heightmap made anywhere else becomes ground these ops can
carve.