Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

geometry.smooth_normals

Recompute shading normals with a crease angle: faces meeting within it share an averaged normal, faces beyond it split the point so the edge stays hard. The result holds one N per point, and a point is shared by exactly the corners that agree on the normal. The result is built on the points of the input: two points that stand at one place stay two, so weld a triangle soup first (geometry.weld) to smooth across it.

Inputs

  • geometry (Geometry). The geometry whose normals are computed.
  • angle (Float, default 30, 0 to 180). The crease angle: faces around a point whose normals differ from a corner's own by no more than this are smoothed into it; beyond it the edge stays hard. 0 keeps every crease hard and 180 averages every face at a point into one normal.
  • weighting (String, default "area", one of "area", "angle", "uniform"). How each face counts in the average: "area" by its size, "angle" by the angle it turns through at the point, which leaves the normal the same however the surface around the point is cut into triangles, "uniform" equally.

Outputs

  • geometry (Geometry). The geometry with one N per point, points split along hard edges and numbered by id. The points stand in the order of the points of the input they came from, the ones a point split into side by side.
  • stats (Data). creaseAngle, weighting, vertexCountBefore, vertexCountAfter, sharedVertices (input points more than one corner reads), splitVertices (input points that split into more than one) and triangleCount.
local shaded = g.geometry.smooth_normals({ geometry = g.mesh.sphere({}), angle = 60 })