Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

geometry.set_position

Move each point by a per-point Vec3 field, or put it where the field says, then rebuild the point normals from the moved surface. Primitives, every other attribute and the material carry through; only the positions differ.

Inputs

  • geometry (Geometry). Whose points move.
  • offset (Field<Vec3>, optional). Evaluated at every point: how far that point moves, or with mode "set" where it goes. Left unwired the positions stand still, and the result differs only by what recompute_normals does.
  • scale (Float, default 1). Multiplies the vector before it is used, so one field drives a subtle and a violent version of the same shape. Under mode "set" it multiplies the new position itself.
  • mode (String, default "offset", one of "offset", "set"). "offset" adds the vector to where the point already is; "set" puts the point at it, so the field defines the shape outright and the input supplies the primitives.
  • recompute_normals (Bool, default true). true rebuilds the point normals from the moved surface (core.normals.point), so lighting follows the new shape; false keeps the normals the geometry arrived with.

Outputs

  • geometry (Geometry). The geometry with its points moved.
local sphere = g.mesh.sphere({})
local puffed = g.geometry.set_position({ geometry = sphere, offset = sphere.point.N, scale = 0.1 })