Ctrl+Enter Compile   Ctrl+S Save   Ctrl+E Toggle Editor

SDF Primitives

sdCircle(p, r)Circle
sdBox(p, b)Rectangle (b=half size)
sdRoundedBox(p, b, r)Rounded rect
sdTriangle(p, a, b, c)Triangle
sdEquilateral(p, r)Equilateral triangle
sdSegment(p, a, b)Line segment
sdRing(p, r, w)Ring

Boolean Ops

opUnion(d1, d2)Union
opSubtraction(d1, d2)Subtract
opIntersection(d1, d2)Intersect
opSmoothUnion(d1, d2, k)Smooth union
opSmoothSubtraction(d1, d2, k)Smooth subtract
opSmoothIntersection(d1, d2, k)Smooth intersect
opOnion(d, r)Outline

Pattern Helpers

patUnion(a, b)Union w/ color
patSmoothUnion(a, b, k)Smooth w/ color blend
Pattern(d, color)Construct Pattern

Transforms

rotate2d(p, angle)Rotate
translate2d(p, offset)Translate
scale2d(p, s)Scale
mirror(p, axis)Mirror on axis
mirrorX(p)Mirror X
mirrorY(p)Mirror Y
mirrorXY(p)Mirror both

Repeat / Tiling

repeat(p, spacing)Infinite grid
repeatLimited(p, s, count)Finite grid
repeatPolar(p, count)Radial repeat
repeatOffset(p, s, off)Brick offset
repeatId(p, spacing)Cell ID

Noise / Hash

hash21(p)2D → 1D hash
hash22(p)2D → 2D hash

Color

hsl2rgb(hsl)HSL to RGB
rgb2hsl(c)RGB to HSL
oklch2rgb(L, C, H)OKLCH to RGB
gradient(t, c1, c2)2-color lerp
gradient3(t, c1, c2, c3)3-color lerp
palette(t, a, b, c, d)IQ cosine palette

Uniforms

iResolutionvec2 canvas size
iTimefloat elapsed time
iMousevec4 (xy: pos, zw: click)
iBgColorvec3 background
iScalefloat global scale
iRotationfloat global rotation
| 0.00s | f:0