insideShape

True inside the shape and up to two pixels outside it.

insideShape(sdf: Expr, pxH: Expr): Expr

Import materials from shaders/std and use materials.insideShape.

Pass the signed distance and pixel size from surfaceField. The two-pixel margin keeps the anti-aliased edge inside the shaded region. The usual condition for guarded.

Parameters

NameTypeNotes
sdfExpr
pxHExpr

Example

guarded(insideShape(field.sdf, field.pxH), shaded, vec4(0, 0, 0, 0))

See also

  • guarded — Evaluates an expression only where a condition holds, and a cheap fallback everywhere else.
  • silhouette — The shape's coverage at this pixel: 1 inside, 0 outside, soft across the edge.

Used by

BrushedMetal, CarbonFiber, Chrome, Frost, Hologram, Holographic, Irradiance, LiquidMetal, Nebula, Obsidian, Plastic, Water