pointerSplatField
A field the cursor smears: cells near the pointer move with it, then fade back to rest.
pointerSplatField(slots: {
gridSize: PropRef
decay: PropRef
intensity: PropRef
radius: PropRef
output: string
}): (params: GpuFragmentParams, root: GridRoot) => GridSimConfig
Import effects from shaders/std and use effects.pointerFields.pointerSplatField.
Spread it with ...sim.grids.gridSim(...). gridSize is the cells per side (8 to 128, see clampSplatGridSize). decay (about 0 to 10) is how fast the smear fades; intensity (about 0 to 5) how hard the cursor pushes; radius the brush size (1 is about 5% of the canvas). The field is published under output for a warp map such as warps.gridCellDisplace.
Parameters
| Name | Type | Notes |
|---|---|---|
slots | `{ |
gridSize: PropRef
decay: PropRef
intensity: PropRef
radius: PropRef
output: string
}` | |
Example
...sim.grids.gridSim(pointerSplatField({gridSize: p('gridSize'), decay: p('decay'), intensity: p('intensity'), radius: p('radius'), output: 'displacement'}))
Tip. Add
uvRemapIdentityWhen: ({computeOutputs}) => !computeOutputs?.displacementso the warp is a no-op before the field exists.
See also
springLatticeField— A cloth of springs the cursor pushes: it stretches, rings and settles like fabric.clampSplatGridSize— The grid sizepointerSplatFieldreally uses for a prop value: floored, then held to 8–128.