Easing functions and animation curves for smooth transitions.

9 functions

backIn

ease-in function that overshoots before settling.

Parameters

NameTypeDescription
tf32Input parameter (0-1).

Returns

f32value with back effect.
View WGSL code →

backOut

ease-out function that overshoots before settling.

Parameters

NameTypeDescription
tf32Input parameter (0-1).

Returns

f32value with back effect.
View WGSL code →

bezierCubic

a cubic Bezier curve and returns both value and derivative.

Parameters

NameTypeDescription
tf32Parameter along the curve (0-1).
p0f32First control point.
p1f32Second control point.
p2f32Third control point.
p3f32Fourth control point.

Returns

vec2<f32>value and derivative (tangent).
View WGSL code →

easeIn

ease-in function for smooth acceleration.

Parameters

NameTypeDescription
tf32Input parameter (0-1).
powerf32Easing power (higher = more pronounced curve).

Returns

f32value.
View WGSL code →

easeInOut

ease-in-out function for smooth acceleration and deceleration.

Parameters

NameTypeDescription
tf32Input parameter (0-1).
powerf32Easing power (higher = more pronounced curve).

Returns

f32value.
View WGSL code →

easeOut

ease-out function for smooth deceleration.

Parameters

NameTypeDescription
tf32Input parameter (0-1).
powerf32Easing power (higher = more pronounced curve).

Returns

f32value.
View WGSL code →

elasticIn

ease-in function with oscillating motion.

Parameters

NameTypeDescription
tf32Input parameter (0-1).

Returns

f32value with elastic effect.
View WGSL code →

elasticOut

ease-out function with oscillating motion.

Parameters

NameTypeDescription
tf32Input parameter (0-1).

Returns

f32value with elastic effect.
View WGSL code →

springPhysics

spring animation with configurable parameters.

Parameters

NameTypeDescription
tf32Time parameter.
targetPositionf32Target position for the spring.
initialPosf32Initial position.
initialVelf32Initial velocity.
stiffnessf32Spring stiffness coefficient.
dampingf32Damping coefficient.
massf32Mass of the spring system.

Returns

vec2<f32>and velocity at time t.
View WGSL code →

Color space conversion and palette generation functions.

5 functions

hslToRgb

HSL (Hue, Saturation, Lightness) color to RGB.

Parameters

NameTypeDescription
hslvec3<f32>HSL color values (hue: 0-1, saturation: 0-1, lightness: 0-1).

Returns

vec3<f32>color values.

Dependencies

View WGSL code →

hueToRgb

function for HSL to RGB conversion - converts hue component to RGB.

Parameters

NameTypeDescription
pf32First HSL conversion parameter.
qf32Second HSL conversion parameter.
tf32Hue value (adjusted).

Returns

f32component value.
View WGSL code →

linearToSrgb

linear RGB color values to sRGB color space.

Parameters

NameTypeDescription
colorvec3<f32>Linear RGB color values.

Returns

vec3<f32>color values.
View WGSL code →

palette

colors using cosine-based palette function for smooth color gradients.

Parameters

NameTypeDescription
tf32Input parameter (typically 0-1) for palette lookup.
avec3<f32>Offset values for RGB channels.
bvec3<f32>Amplitude values for RGB channels.
cvec3<f32>Frequency values for RGB channels.
dvec3<f32>Phase values for RGB channels.

Returns

vec3<f32>RGB color.
View WGSL code →

srgbToLinear

sRGB color values to linear RGB color space.

Parameters

NameTypeDescription
colorvec3<f32>sRGB color values.

Returns

vec3<f32>RGB color values.
View WGSL code →

Mathematical functions and general utilities for shader calculations.

8 functions

elasticWave

an elastic wave with exponential decay and sinusoidal oscillation.

Parameters

NameTypeDescription
xf32Input position along the wave.
amplitudef32Wave amplitude multiplier.
frequencyf32Wave frequency.
decayf32Exponential decay factor.
phasef32Phase offset for the wave.

Returns

f32wave value.
View WGSL code →

exponentialRamp

an exponential ramp function with derivative.

Parameters

NameTypeDescription
xf32Input value.
basef32Exponential base.
scalef32Scale factor.
offsetf32Vertical offset.

Returns

vec2<f32>value and derivative.
View WGSL code →

logisticCurve

a logistic (S-curve) function with derivative.

Parameters

NameTypeDescription
xf32Input value.
midpointf32Curve midpoint (inflection point).
steepnessf32Curve steepness factor.
minf32Minimum output value.
maxf32Maximum output value.

Returns

vec2<f32>value and derivative.
View WGSL code →

rotate2D

a 2D vector by a given angle.

Parameters

NameTypeDescription
vvec2<f32>Input 2D vector to rotate.
anglef32Rotation angle in radians.

Returns

vec2<f32>2D vector.
View WGSL code →

smoothStep

interpolation between two values with smooth acceleration and deceleration.

Parameters

NameTypeDescription
edge0f32Lower edge of interpolation range.
edge1f32Upper edge of interpolation range.
xf32Input value to interpolate.

Returns

f32interpolated value between 0 and 1.
View WGSL code →

smoothStepVec2

interpolation between two vectors with smooth acceleration and deceleration.

Parameters

NameTypeDescription
edge0vec2<f32>Lower edge of interpolation range.
edge1vec2<f32>Upper edge of interpolation range.
xvec2<f32>Input vector to interpolate.

Returns

vec2<f32>interpolated vector between 0 and 1.
View WGSL code →

stepSequence

a stepped sequence with optional smoothing between steps.

Parameters

NameTypeDescription
xf32Input value.
stepsf32Number of steps in the sequence.
smoothingf32Smoothing factor between steps (0-1).
minValuef32Minimum output value.
maxValuef32Maximum output value.

Returns

vec2<f32>value and current step index.
View WGSL code →

taylorInvSqrt4

series inverse square root approximation for Perlin noise.

Parameters

NameTypeDescription
rvec4<f32>Input 4D vector.

Returns

vec4<f32>square root approximation.
View WGSL code →

Noise generation and procedural pattern functions for textures and effects.

29 functions

fbm2D

Brownian Motion - combines multiple octaves of noise for complex patterns.

Parameters

NameTypeDescription
pvec2<f32>Input 2D coordinate.
octavesi32Number of noise octaves to combine.

Returns

f32noise value.

Dependencies

View WGSL code →

fbm3D

Brownian Motion - combines multiple octaves of noise for complex patterns.

Parameters

NameTypeDescription
pvec3<f32>Input 3D coordinate.
octavesi32Number of noise octaves to combine.

Returns

f32noise value.

Dependencies

View WGSL code →

hash1D

a 1D hash value from an input value for noise generation.

Parameters

NameTypeDescription
pf32Input value to hash.

Returns

f32value between 0 and 1.
View WGSL code →

hash22

a 2D hash from a 2D input vector for procedural generation.

Parameters

NameTypeDescription
pvec2<f32>Input 2D vector to hash.

Returns

vec2<f32>result as 2D vector.
View WGSL code →

hash31

a 1D hash value from a 3D input vector.

Parameters

NameTypeDescription
pvec3<f32>Input 3D vector to hash.

Returns

f32value between 0 and 1.
View WGSL code →

hash3D

a 3D hash vector from a 3D input for displacement effects.

Parameters

NameTypeDescription
pvec3<f32>Input 3D vector to hash.

Returns

vec3<f32>result as 3D vector with values between -1 and 1.
View WGSL code →

mod289

289 operation for Perlin noise.

Parameters

NameTypeDescription
xvec4<f32>Input 4D vector.

Returns

vec4<f32>of x mod 289.
View WGSL code →

noise2D

2D Perlin-style noise for procedural textures and patterns.

Parameters

NameTypeDescription
pvec2<f32>Input 2D coordinate.

Returns

f32value typically in range [-1, 1].

Dependencies

View WGSL code →

noise3D

3D noise using trilinear interpolation.

Parameters

NameTypeDescription
xvec3<f32>Input 3D position for noise generation.

Returns

f32value between 0 and 1.

Dependencies

View WGSL code →

pcg

and fast integer hash using PCG algorithm.

Parameters

NameTypeDescription
nu32Input unsigned integer to hash.

Returns

u32unsigned integer value.
View WGSL code →

pcg2d

PCG hash function for fast procedural generation.

Parameters

NameTypeDescription
pvec2<u32>Input 2D unsigned integer vector to hash.

Returns

vec2<u32>2D unsigned integer vector.
View WGSL code →

pcg3d

PCG hash function for volumetric procedural generation.

Parameters

NameTypeDescription
pvec3<u32>Input 3D unsigned integer vector to hash.

Returns

vec3<u32>3D unsigned integer vector.
View WGSL code →

pcg4d

PCG hash function for advanced procedural generation.

Parameters

NameTypeDescription
pvec4<u32>Input 4D unsigned integer vector to hash.

Returns

vec4<u32>4D unsigned integer vector.
View WGSL code →

perm4

function for Perlin noise.

Parameters

NameTypeDescription
xvec4<f32>Input 4D vector.

Returns

vec4<f32>4D vector.

Dependencies

View WGSL code →

rand11Sin

float from 1D input using sine (platform dependent).

Parameters

NameTypeDescription
nf32Input float value.

Returns

f32float between 0 and 1.
View WGSL code →

rand22Sin

float from 2D input using sine (platform dependent).

Parameters

NameTypeDescription
nvec2<f32>Input 2D vector.

Returns

f32float between 0 and 1.
View WGSL code →

simplexNoise2D

simplex noise implementation for efficient 2D procedural generation.

Parameters

NameTypeDescription
vvec2<f32>Input 2D coordinate.

Returns

f32noise value typically in range [-1, 1].
View WGSL code →

simplexNoise3D

simplex noise implementation for volumetric procedural generation.

Parameters

NameTypeDescription
vvec3<f32>Input 3D coordinate.

Returns

f32noise value typically in range [-1, 1].
View WGSL code →

valueNoise3D

value noise using permutation tables.

Parameters

NameTypeDescription
pvec3<f32>Input 3D coordinate.

Returns

f32value between 0 and 1.

Dependencies

View WGSL code →

warpNoise3D

3D warping noise using fractal Brownian motion.

Parameters

NameTypeDescription
xvec3<f32>Input 3D position.
seedValf32Random seed for variation.

Returns

vec3<f32>warp vector with values between -1 and 1.

Dependencies

View WGSL code →

xxhash32

integer hash using xxHash algorithm.

Parameters

NameTypeDescription
nu32Input unsigned integer to hash.

Returns

u32unsigned integer value.
View WGSL code →

xxhash322d

xxHash for strong integer hashing in 2D.

Parameters

NameTypeDescription
pvec2<u32>Input 2D unsigned integer vector to hash.

Returns

u32unsigned integer value.
View WGSL code →

xxhash323d

xxHash for strong integer hashing in 3D.

Parameters

NameTypeDescription
pvec3<u32>Input 3D unsigned integer vector to hash.

Returns

u32unsigned integer value.
View WGSL code →

xxhash324d

xxHash for strong integer hashing in 4D.

Parameters

NameTypeDescription
pvec4<u32>Input 4D unsigned integer vector to hash.

Returns

u32unsigned integer value.
View WGSL code →

Deformation and domain manipulation functions for SDFs.

7 functions

sdfBend

geometry along a specified axis creating a smooth curve.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
anglef32Bend angle in radians.
axisvec3<f32>Axis normal to the bending plane.
centervec3<f32>Center of the bend.

Returns

vec3<f32>position.
View WGSL code →

sdfDisplace

SDF using noise or other displacement functions.

Parameters

NameTypeDescription
positionvec3<f32>3D position to displace.
amountf32Displacement amount.
frequencyf32Displacement frequency.
seedf32Random seed for displacement.

Returns

vec3<f32>position.

Dependencies

View WGSL code →

sdfDomainRepeat

domain repetition with optional warping for complex patterns.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
cellSizevec3<f32>Size of each repetition cell.
warpAmountf32Amount of warping to apply.
warpScalef32Scale of the warping effect.
seedf32Random seed for warping.

Returns

vec3<f32>repeated position.

Dependencies

View WGSL code →

sdfFiniteRepeat

finite repetition with specified count along each axis.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
spacingvec3<f32>Spacing between repetitions.
countvec3<f32>Number of repetitions along each axis.

Returns

vec3<f32>repeated position.
View WGSL code →

sdfInfiniteRepeat

infinite repetition along all axes.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
spacingvec3<f32>Spacing between repetitions.

Returns

vec3<f32>repeated position.
View WGSL code →

sdfTaper

a linear taper effect along an axis.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
amountf32Taper amount (0 = no taper, 1 = full taper).
axisvec3<f32>Taper axis direction.
heightf32Height over which to apply the taper.
offsetf32Offset along the taper axis.

Returns

vec3<f32>position.
View WGSL code →

sdfTwist

a continuous rotation around an axis proportional to distance along that axis.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
anglef32Twist angle in radians per unit distance.
axisvec3<f32>Axis to twist around (should be normalized).

Returns

vec3<f32>position.
View WGSL code →

Boolean operations for combining and modifying signed distance fields.

9 functions

sdfChamferIntersect

two SDFs using chamfer operation.

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field.
radiusf32Chamfer radius for the edge.

Returns

f32intersection signed distance field.
View WGSL code →

sdfChamferSubtract

one SDF from another using chamfer operation.

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field to subtract.
radiusf32Chamfer radius for the edge.

Returns

f32subtraction signed distance field.
View WGSL code →

sdfChamferUnion

two SDFs using chamfer union operation with hard edges.

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field.
radiusf32Chamfer radius for the edge.

Returns

f32union signed distance field.
View WGSL code →

sdfOpIntersect

two SDFs (logical AND).

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field.

Returns

f32signed distance field.
View WGSL code →

sdfOpSubtract

one SDF from another (A - B).

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field to subtract.

Returns

f32signed distance field.
View WGSL code →

sdfOpUnion

two SDFs using union operation (logical OR).

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field.

Returns

f32signed distance field.
View WGSL code →

sdfSmoothIntersect

two SDFs with smooth blending.

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field.
smoothingf32Smoothing factor for the blend.

Returns

f32intersected signed distance field.
View WGSL code →

sdfSmoothSubtract

one SDF from another with smooth blending.

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field to subtract.
smoothingf32Smoothing factor for the blend.

Returns

f32subtracted signed distance field.
View WGSL code →

sdfSmoothUnion

two SDFs using smooth union operation with configurable smoothing.

Parameters

NameTypeDescription
distanceAf32First signed distance field.
distanceBf32Second signed distance field.
smoothingf32Smoothing factor for the blend.

Returns

f32combined signed distance field.
View WGSL code →

Basic SDF shapes and primitive geometry functions for ray marching.

26 functions

sdfBox

distance function for a rectangular box.

Parameters

NameTypeDescription
pvec2<f32>Point to evaluate distance from.
bvec2<f32>Box half-dimensions (width/2, height/2).

Returns

f32distance to box surface (negative inside, positive outside).
View WGSL code →

sdfBoxFrame

a signed distance field for a 3D box frame (hollow box).

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
sizevec3<f32>Half-extents of the box.
thicknessf32Wall thickness of the frame.

Returns

f32distance to the box frame surface.
View WGSL code →

sdfCappedTorus

a signed distance field for a capped torus.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
majorRadiusf32Major radius of the torus.
minorRadiusf32Minor radius of the torus.
anglef32Cap angle in radians.

Returns

f32distance to the capped torus surface.
View WGSL code →

sdfCapsule

a signed distance field for a capsule (cylinder with rounded caps).

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusf32Radius of the capsule.
heightf32Height of the cylindrical portion.

Returns

f32distance to the capsule surface.
View WGSL code →

sdfCircle

distance function for a circle.

Parameters

NameTypeDescription
pvec2<f32>Point to evaluate distance from.
rf32Circle radius.

Returns

f32distance to circle surface (negative inside, positive outside).
View WGSL code →

sdfCone

a signed distance field for a cone.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusf32Base radius of the cone.
heightf32Height of the cone.

Returns

f32distance to the cone surface.
View WGSL code →

sdfCylinder

a signed distance field for a cylinder.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusf32Radius of the cylinder.
heightf32Height of the cylinder.

Returns

f32distance to the cylinder surface.
View WGSL code →

sdfEllipsoid

a signed distance field for an ellipsoid.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusvec3<f32>Radii along each axis.

Returns

f32distance to the ellipsoid surface.
View WGSL code →

sdfGyroid

a signed distance field for a gyroid surface.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
scalef32Scale factor for the gyroid pattern.
thicknessf32Thickness of the gyroid surface.

Returns

f32distance to the gyroid surface.
View WGSL code →

sdfHexagonalPrism

a signed distance field for a hexagonal prism.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusf32Radius of the hexagon.
heightf32Height of the prism.

Returns

f32distance to the hexagonal prism surface.
View WGSL code →

sdfIcosahedron

a signed distance field for an icosahedron.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
sizef32Size of the icosahedron.

Returns

f32distance to the icosahedron surface.
View WGSL code →

sdfIntersection

two SDFs using intersection operation (overlapping area only).

Parameters

NameTypeDescription
d1f32Distance from first shape.
d2f32Distance from second shape.

Returns

f32distance representing intersection of both shapes.
View WGSL code →

sdfJulia

a signed distance field for a 4D Julia set fractal.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
cvec4<f32>Julia set parameter (quaternion).
iterationsf32Maximum number of iterations.
bailoutf32Bailout radius for iteration escape.

Returns

f32distance to the Julia set surface.
View WGSL code →

sdfOctahedron

a signed distance field for an octahedron.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
sizef32Size of the octahedron.

Returns

f32distance to the octahedron surface.
View WGSL code →

sdfPlane

a signed distance field for an infinite plane.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
normalvec3<f32>Normal vector of the plane (should be normalized).

Returns

f32distance to the plane surface.
View WGSL code →

sdfPyramid

a signed distance field for a pyramid.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
sizef32Base size of the pyramid.
heightf32Height of the pyramid.

Returns

f32distance to the pyramid surface.
View WGSL code →

sdfRhombus

a signed distance field for a rhombus.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
dimensionsvec3<f32>Dimensions of the rhombus.
sharpnessf32Sharpness factor for the edges.

Returns

f32distance to the rhombus surface.
View WGSL code →

sdfRoundBox

a signed distance field for a rounded box.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
sizevec3<f32>Half-extents of the box.
radiusf32Rounding radius for the edges.

Returns

f32distance to the rounded box surface.
View WGSL code →

sdfRoundedCone

a signed distance field for a rounded cone.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radius1f32Bottom radius of the cone.
radius2f32Top radius of the cone.
heightf32Height of the cone.
roundnessf32Rounding factor for the edges.

Returns

f32distance to the rounded cone surface.
View WGSL code →

sdfRoundedCylinder

a signed distance field for a rounded cylinder.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusf32Radius of the cylinder.
heightf32Height of the cylinder.
roundnessf32Rounding factor for the edges.

Returns

f32distance to the rounded cylinder surface.
View WGSL code →

sdfSphere

a signed distance field for a sphere.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusf32Radius of the sphere.

Returns

f32distance to the sphere surface.
View WGSL code →

sdfSubtraction

two SDFs using subtraction operation (first shape minus second).

Parameters

NameTypeDescription
d1f32Distance from shape to subtract from.
d2f32Distance from shape to subtract.

Returns

f32distance representing first shape with second subtracted.
View WGSL code →

sdfTetrahedron

a signed distance field for a tetrahedron.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
sizef32Size of the tetrahedron.

Returns

f32distance to the tetrahedron surface.
View WGSL code →

sdfTorus

a signed distance field for a torus.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
majorRadiusf32Major radius of the torus.
minorRadiusf32Minor radius of the torus.

Returns

f32distance to the torus surface.
View WGSL code →

sdfTriangularPrism

a signed distance field for a triangular prism.

Parameters

NameTypeDescription
positionvec3<f32>3D position to evaluate.
radiusf32Radius of the triangular base.
heightf32Height of the prism.

Returns

f32distance to the triangular prism surface.
View WGSL code →

sdfUnion

two SDFs using union operation (closest surface).

Parameters

NameTypeDescription
d1f32Distance from first shape.
d2f32Distance from second shape.

Returns

f32distance representing union of both shapes.
View WGSL code →

Spatial transformation functions for positioning and orienting SDFs.

7 functions

sdfCylindricalRepeat

cylindrical coordinate repetition.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
angleRepeatf32Angular repetition count.
heightRepeatf32Height repetition interval.
axisvec3<f32>Cylindrical axis (should be normalized).

Returns

vec3<f32>repeated position.
View WGSL code →

sdfMirror

an SDF across a plane defined by a normal vector.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
normalvec3<f32>Normal vector of the mirror plane.
offsetf32Distance offset of the mirror plane.

Returns

vec3<f32>position.
View WGSL code →

sdfPolarRepeat

polar repetition around an axis.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
countf32Number of repetitions around the circle.
axisvec3<f32>Axis to repeat around (should be normalized).

Returns

vec3<f32>repeated position.
View WGSL code →

sdfRotate

an SDF around a pivot point with Euler angles.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
anglesvec3<f32>Rotation angles in radians (x, y, z).
pivotvec3<f32>Point to rotate around.

Returns

vec3<f32>position.
View WGSL code →

sdfScale

an SDF uniformly or non-uniformly.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
scalevec3<f32>Scale factors for each axis.

Returns

vec3<f32>position.
View WGSL code →

sdfSphericalRepeat

spherical coordinate repetition.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
phiRepeatf32Azimuthal angle repetition count.
thetaRepeatf32Polar angle repetition count.

Returns

vec3<f32>repeated position.
View WGSL code →

sdfTranslate

an SDF by moving its position.

Parameters

NameTypeDescription
positionvec3<f32>3D position to transform.
offsetvec3<f32>Translation offset.

Returns

vec3<f32>position.
View WGSL code →

Utility functions for rendering and post-processing SDFs.

4 functions

sdfToSmoothSolid

a signed distance field to a smooth solid with anti-aliasing.

Parameters

NameTypeDescription
signedDistancef32Signed distance field value.
thresholdf32Threshold for solid determination.
smoothingf32Smoothing factor for anti-aliasing.

Returns

f32value between 0.0 and 1.0.
View WGSL code →

sdfToSmoothStroke

a signed distance field to a smooth stroke with anti-aliasing.

Parameters

NameTypeDescription
signedDistancef32Signed distance field value.
thicknessf32Stroke thickness.
centerf32Center distance for the stroke.
smoothingf32Smoothing factor for anti-aliasing.

Returns

f32stroke value between 0.0 and 1.0.
View WGSL code →

sdfToSolid

a signed distance field to a solid boolean value.

Parameters

NameTypeDescription
signedDistancef32Signed distance field value.
thresholdf32Threshold for solid determination.

Returns

f32if solid, 0.0 if not (as f32 for compatibility).
View WGSL code →

sdfToStroke

a signed distance field to a stroke/outline.

Parameters

NameTypeDescription
signedDistancef32Signed distance field value.
thicknessf32Stroke thickness.
centerf32Center distance for the stroke.

Returns

f32if within stroke, 0.0 if not.
View WGSL code →

Wave generation functions for oscillations and periodic patterns.

6 functions

chirpWave

a chirp wave with linearly changing frequency.

Parameters

NameTypeDescription
xf32Input position.
startFrequencyf32Starting frequency.
endFrequencyf32Ending frequency.
amplitudef32Wave amplitude.
periodf32Period over which frequency changes.

Returns

f32wave value.
View WGSL code →

noiseWave

a wave using interpolated noise for organic variation.

Parameters

NameTypeDescription
xf32Input position.
frequencyf32Wave frequency.
amplitudef32Wave amplitude.
seedf32Random seed for noise generation.

Returns

f32wave value.

Dependencies

View WGSL code →

pulseWave

a pulse wave with smooth falloff edges.

Parameters

NameTypeDescription
xf32Input position.
frequencyf32Wave frequency.
amplitudef32Wave amplitude.
phasef32Phase offset.
widthf32Pulse width (0-1).
fallofff32Smooth falloff duration.

Returns

f32wave value.
View WGSL code →

sawtoothWave

a sawtooth wave with linear ramp.

Parameters

NameTypeDescription
xf32Input position.
frequencyf32Wave frequency.
amplitudef32Wave amplitude.
phasef32Phase offset.

Returns

f32wave value.
View WGSL code →

squareWave

a square wave with configurable duty cycle.

Parameters

NameTypeDescription
xf32Input position.
frequencyf32Wave frequency.
amplitudef32Wave amplitude.
phasef32Phase offset.
dutyCyclef32Duty cycle (0-1) for wave on/off ratio.

Returns

f32wave value.
View WGSL code →

triangleWave

a triangle wave with configurable frequency and amplitude.

Parameters

NameTypeDescription
xf32Input position.
frequencyf32Wave frequency.
amplitudef32Wave amplitude.
phasef32Phase offset.

Returns

f32wave value.
View WGSL code →