warpStep
One step of a chained warp: pushes a 2D position by two noise reads and hands them back.
warpStep(opts: {
at: Expr
scale: number
z: Expr | number
offsets: [[number, number], [number, number]]
reach: number
strength: Expr | number
}): Expr
Import paint from shaders/std and use paint.warpStep.
Returns a vec4: xy is the warped position, zw the two noise values, useful for shading later. Chain steps by feeding one step's xy into the next. scale sets the noise frequency, z is a time or seed slice, offsets two fixed 2D offsets that keep the reads apart, and the push distance is reach times strength.
Parameters
| Name | Type | Notes |
|---|---|---|
opts | `{ |
at: Expr
scale: number
z: Expr \| number
offsets: [[number, number], [number, number]]
reach: number
strength: Expr \| number
}` | |
Example
const level1 = warpStep({at: uv, scale: 1.2, z: math.mul(t, 0.5), offsets: [[5.2, 1.3], [1.7, 9.2]], reach: 0.4, strength: uniformOf(p('warp'), params)})
const level2 = warpStep({at: level1.member('xy'), scale: 2.4, z: t, offsets: [[8.3, 2.8], [2.1, 6.4]], reach: 0.25, strength: uniformOf(p('warp'), params)})
See also
warpedPoint— A 3D position pushed around by moving noise, for reading several fields at one warped spot.quadBlend— A four-color blend on a square:atobacross the top,ctodacross the bottom, then top to bottom.