surfacePattern

Coordinates for a pattern that sticks to the shape's surface.

surfacePattern(frame: SurfaceFrame, field: SurfaceField, opts: {uv?: Expr} = {}): Expr

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

On a flat shape they are the placement coordinates centred on the shape (0,0 at its centre). On a 3D shape they follow the surface as it rotates, when the effect declares pattern: 'raw' or 'triplanar'.

Parameters

NameTypeNotes
frameSurfaceFrame
fieldSurfaceField
opts{uv?: Expr}Optional. Default {}.

Example

const pat = surfacePattern(frame, field)

See also

  • shapedSurface — Turns a shape prop into a surface your material shades.
  • rotationSensor — How far a 3D shape has rotated, as a 2D pan you can move content by.
  • surfaceNoiseAt — surfaceNoise at a 2D point you already hold.

Used by

BrushedMetal, CarbonFiber, Chrome, Crystal, Frost, Holographic, LiquidMetal, Obsidian, Plastic, Water