pixfx

Parity and tests

Two checks keep the pixels honest: parity compares ports with pixelfx itself, and the determinism test pins native and wasm builds to one set of frame hashes.

Parity against pixelfx

Parity renders an effect with pixelfx (under Node) and with its pixfx port, then compares every pixel of every frame of both layers. It needs Node and a pixelfx checkout:

git clone https://github.com/patch-gg/pixelfx /tmp/pixelfx
git -C /tmp/pixelfx checkout 044e12a
cargo run -p pixfx-cli -- parity fire/candle --pixelfx /tmp/pixelfx --out target/parity

Output:

fire/candle: colour 0.00% differ, light 0.00% differ → PASS

The reference render comes from tools/pixelfx-ref.mjs, which runs pixelfx's own renderFrames with no backdrop and no stand-in actor, at the effect's default options, edge fade applied.

Current results

Against pixelfx commit 044e12a (version 0.3.1). A later pixelfx may have changed an effect.

EffectColourLightResult
fire/candle0 pixels0 pixelsPASS
fire/campfire0 pixels0 pixelsPASS
fire/brazier0 pixels0 pixelsPASS

The ledger

An effect that ships below the gate must be listed in parity/LEDGER.md, one line each: <id> · <date> · colour x% light y% · approved by owner, after the owner has approved it by eye. The ledger is empty.

Determinism

Frame hashes of each effect, for seeds 1, 2 and 7 and frames first, second, middle and last, are checked against crates/pixfx-effects/tests/goldens/frame_hashes.json, natively and in wasm. A hash is FNV-1a 64 over every colour word then every light word.

cargo test -p pixfx-effects --test determinism
wasm-pack test --node crates/pixfx-effects --test determinism

Record new goldens on a native target only, after a deliberate change:

PIXFX_BLESS=1 cargo test -p pixfx-effects --test determinism

A failure prints the first line that differs.

Other tests

WhereCovers
crates/pixfx-core/testsPainter, instances and time steps, compositing, simulation helpers.
crates/pixfx-effects/tests/fire.rsFire effects' behaviour.
crates/pixfx-export/testsSheet layout and JSON, GIF output.
crates/pixfx-cli/testsCommands, exit codes, the parity comparison.
crates/pixfx-wasm/tests/web.rs, crates/pixfx-canvas/testsThe JS bindings and stage, under wasm-pack test --node, plus the stage's decisions natively.
packages/pixfx-phaser/testsThe Phaser plugin under bun test, including pixel checks against the engine.

Whole-repo check

cargo fmt --check && cargo clippy --workspace --all-targets -- -D warnings && cargo test --workspace
wasm-pack test --node crates/pixfx-wasm
wasm-pack test --node crates/pixfx-canvas
cd packages/pixfx-phaser && bun run check