shellRefract

Coordinates for what sits inside a glass shell, bent where the shell curves.

shellRefract(frame: SurfaceFrame, n: Expr, amount: Expr): {
    x: Expr
    y: Expr
    centered: {x: Expr; y: Expr}
}

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

Returns x and y centred on the shape and displaced by the normal's tilt times amount, plus the unbent centered pair for anything fixed to the container. The bend is strongest at bevels and silhouettes, where real glass bends its interior.

Parameters

NameTypeNotes
frameSurfaceFrame
nExpr
amountExpr

Example

const interior = shellRefract(frame, n, u.bend)

See also

  • rotationSensor — How far a 3D shape has rotated, as a 2D pan you can move content by.
  • refract — The direction i bent through a surface with unit normal n.

Used by

Nebula