Skip to content
Voro
  1. Voro
  2. Authoring

Warp FX

Warp FX generates and changes geometry with kernels written in Python using import warp as wp. Declare the ports and state they use, then press Reload. Python compiles the source, and the resulting kernels run on the GPU.

Place Warp FX from the Geometry view of the Voro menu. The node arrives with a docked DAT named warp_source. The default source is an indexed wave grid with Width, Depth, Height and Phase as live controls, and the output is a mesh on grid. Wire it into a Geometry COMP in a Scene to see it.

Declarations come first as literal rows. Use PARAMS, INPUTS, OUTPUTS and STAGES, with STATE for persistent arrays. Other declarations include ROLE, OPTIONS, FIELDS, SPATIAL and SUBSTEPS. Then write the @wp.kernel and @wp.func functions. A stage names a kernel, its launch size, its arguments in order, and whether it runs only on reset. The launch size can be a port name or a bounded integer.

  • Geometry ports carry named per-point attributes. P is required. An output that deforms an input says from that input; generated geometry declares its own bounded points, indices and topology.
  • STATE arrays persist per instance and start at zero; a reset stage seeds them.
  • FIELDS declares 3D grids with a domain, and can publish them as density, velocity, temperature or colour fields, or as a dense tensor port.
  • SPATIAL declares owned hash grids, meshes, BVHs and volumes for queries inside kernels.
  • dt is the engine step. iterate repeats a stage or a group of stages, and SUBSTEPS repeats the whole step list at a smaller dt.

Start with the source already in warp_source. These lines are an excerpt from its vertices kernel:

i = wp.tid()
u = float(i % 101) / 100.0
v = float(i // 101) / 100.0
a = 6.283185307 * u + phase
b = 6.283185307 * v
wave = wp.sin(a) * wp.cos(b)
P[i] = wp.vec3((u - 0.5)*width, height*wave, (v - 0.5)*depth)

Each kernel invocation writes one point. wp.tid() gives its index, and u and v locate it in the 101 by 101 grid. The wave sets its height. The rest of the kernel writes normals, texture coordinates and the crest attribute; a second kernel writes the triangle indices.

Turn Height to change the wave amplitude and Phase to move it across the grid. These controls apply without recompiling. Phase is a control you change or animate; the kernel does not advance it by itself.

For a small source edit, replace crest[i] = wave with crest[i] = 0.5 + 0.5 * wave, then Reload. The geometry stays the same, while the crest attribute changes from a range of -1 to 1 to a range of 0 to 1. Keep the surrounding source. This excerpt is not a complete script.

Numeric PARAMS are hot: turn them and the kernels see the new value. Ports, counts, stages, fields and state change on Reload. A failed compile keeps the last valid declaration and artifact running and reports the error. Reset runs the reset stages again.

Save as Custom Module writes main.py and presets.json into a folder under voro_custom, and the module appears in the Custom column of the Geometry view. See Custom modules.

The reference page is Warp FX.