gridCellDisplace

Move the child by a displacement field your own simulation produces, one grid cell at a time.

gridCellDisplace(slots: {gridSize: ArgSpec; output: string}): UvMapSource

Import warps from shaders/std and use warps.gridCellDisplace.

output names the simulation output (the same name you gave the field), gridSize the number of cells across the shorter side of the canvas. Every pixel in a cell moves together, by at most a tenth of the canvas. Add uvRemapIdentityWhen: ({computeOutputs}) => !computeOutputs?.<output> to the definition so the warp does nothing until the field exists.

Parameters

NameTypeNotes
slots{gridSize: ArgSpec; output: string}

Example

map: warps.gridCellDisplace({gridSize: p('gridSize'), output: 'displacement'}),
uvRemapIdentityWhen: ({computeOutputs}) => !computeOutputs?.displacement,

See also

  • liquidDisplace — Move the child smoothly by a displacement field your own simulation produces.

Used by

GridDistortion