Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

mesh.grid

A flat subdivided rectangle centred on the origin in the XZ plane, facing +Y: cells.x by cells.z quads cut into triangles. The subdivision feeds displacement and per-point field nodes, so use it for terrain patches, water and cloth.

It holds (cells.x + 1) times (cells.z + 1) points and two triangles per cell; every normal is +Y. A cell count is rounded down and is at least 1. uv runs 0 to 1 along X and along Z.

Inputs

  • size (Vec2, default { x = 1, z = 1 }). Its width along X and its depth along Z, in metres, written { x = <width>, z = <depth> }, the form its default takes.
  • cells (Vec2, default { x = 1, z = 1 }). How many quads it is divided into along X and along Z, written { x = ..., z = ... }; each is at least 1.

Outputs

  • geometry (Geometry). Triangles with P, N and uv on their points; primitives carry vstart and vcount.
local patch = g.mesh.grid({ size = { x = 10, z = 10 }, cells = { x = 32, z = 32 } })