Builtin Library
- ..
- README.md1.0 KB
- bindings.yaml349 B
- shader.wgsl4.7 KB
README.md
particle_update_world
The sprite update shader with the scene's geometry as a collider. Same
simulation as particle_update — it shares particle_sim — plus a fourth
binding: a distance field covering the scene, which is what a world collider
in the emitter's collider list consults.
Bindings (see bindings.yaml): particles (read_write array<f32>, 16 f32 per
particle), vertices (read_write array<u32>), params (read_write
array<f32>), pw_field (texture_3d<f32>, r32f — world-space distance to the
nearest surface per voxel).
The grid the field covers is described by the params buffer's world block, which the particles module writes from the field's own settings. With the block's flag clear the world collider reports no contact, so an emitter whose field has gone away keeps simulating against its analytic colliders.
Contact is resolved where the field reads the collider record's radius, so accuracy follows the field's voxel size — a coarser grid rests particles further from the surface.