Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

core.normals.point (procNode)

The normal of the surface at every point: the normals of the primitives that use the point, summed with each weighted by its area, by the angle it spans at the point, or equally, and normalized, written as N on the point class.

Built from core.normals.face, attribute.promote (primitive to point, sum) for "area" and "uniform"; for "angle" the corner angle math.acos of the dot product of the two unit edges at each vertex, the face normal gathered to the vertex by its owner, scaled by that angle and scattered to the point.

Inputs

  • geometry (Geometry). The geometry whose points get normals.
  • weighting (one of area, angle, uniform). Default "area". How the primitives around a point count: "area" weights each by its size, "angle" by the angle it spans at the point, "uniform" counts each equally.
  • name (String). Default "N". The attribute the normals are written under on the point class.

Outputs

  • geometry: the geometry with a normal on every point.

Example

local grid = g.mesh.grid({ size = { x = 2, z = 2 }, cells = { x = 2, z = 2 } })
local shaded = g.core.normals.point({ geometry = grid, weighting = "angle" })

Every point of the flat grid has the normal (0, 1, 0).