shine

A specular highlight on any surface that gives you a normal.

shine(opts: {normal: Expr; light: Expr; gloss: Expr | number}): Expr

Import light from shaders/std and use light.shine.

Returns the raw 0–1 highlight, viewed straight on. Multiply it by your intensity and the shape's coverage yourself. light is a unit direction toward the light and gloss sets the highlight's tightness (8 is broad, 32 is a small hot spot). Works with domeNormal, a bevel, or a heightfield slope.

Parameters

NameTypeNotes
opts{normal: Expr; light: Expr; gloss: Expr | number}

Example

const highlight = mul(shine({normal, light: vec3(0.3, -0.5, 0.8), gloss: p('gloss')}), mask)

See also

  • domeNormal — The surface normals of a flat disc treated as a puffy dome, ready to light with shine.

Used by

Blob