diff options
| author | Valentin Popov <valentin@popov.link> | 2026-02-19 04:02:26 +0300 |
|---|---|---|
| committer | Valentin Popov <valentin@popov.link> | 2026-02-19 04:02:26 +0300 |
| commit | 18d4c6cf9fabc18282b29d103c8d30024f66e49b (patch) | |
| tree | 7f9adfa0dcae5653f378c14b32a238c6771c1602 /parity | |
| parent | 0e19660eb5122c8c52d5e909927884ad5c50b813 (diff) | |
| download | fparkan-18d4c6cf9fabc18282b29d103c8d30024f66e49b.tar.xz fparkan-18d4c6cf9fabc18282b29d103c8d30024f66e49b.zip | |
feat(render-parity): add deterministic frame comparison tool
- Introduced `render-parity` crate for comparing rendered frames against reference images.
- Added command-line options for specifying manifest and output directory.
- Implemented image comparison metrics: mean absolute difference, maximum absolute difference, and changed pixel ratio.
- Created a configuration file `cases.toml` for defining test cases with global defaults and specific parameters.
- Added functionality to capture frames from `render-demo` and save diff images on discrepancies.
- Updated documentation to include usage instructions and CI model for automated testing.
Diffstat (limited to 'parity')
| -rw-r--r-- | parity/README.md | 20 | ||||
| -rw-r--r-- | parity/cases.toml | 27 | ||||
| -rw-r--r-- | parity/reference/.gitkeep | 0 |
3 files changed, 47 insertions, 0 deletions
diff --git a/parity/README.md b/parity/README.md new file mode 100644 index 0000000..dd338bc --- /dev/null +++ b/parity/README.md @@ -0,0 +1,20 @@ +# Render Parity Dataset + +This folder stores parity-test input for `crates/render-parity`. + +- `cases.toml`: list of deterministic render cases. +- `reference/*.png`: baseline frames captured from the original renderer. + +Expected workflow: + +1. Capture baseline PNG frames from original game/editor for each case. +2. Add entries to `cases.toml`. +3. Run: + +```bash +cargo run -p render-parity -- \ + --manifest parity/cases.toml \ + --output-dir target/render-parity/current +``` + +On failure, diff images are saved to `target/render-parity/current/diff`. diff --git a/parity/cases.toml b/parity/cases.toml new file mode 100644 index 0000000..62bb0e3 --- /dev/null +++ b/parity/cases.toml @@ -0,0 +1,27 @@ +[meta] +# Global defaults for all cases. +width = 1280 +height = 720 +lod = 0 +group = 0 +angle = 0.0 + +# Per-pixel change threshold for the "changed pixel ratio" metric. +diff_threshold = 8 + +# Allowed thresholds (case fails if any limit is exceeded). +max_mean_abs = 2.0 +max_changed_ratio = 0.010 + +# Add one block per model. +# +# [[case]] +# id = "animals_a_l_01" +# archive = "../testdata/Parkan - Iron Strategy/animals.rlb" +# model = "A_L_01.msh" +# reference = "reference/animals_a_l_01.png" +# lod = 0 +# group = 0 +# angle = 0.0 +# max_mean_abs = 2.0 +# max_changed_ratio = 0.010 diff --git a/parity/reference/.gitkeep b/parity/reference/.gitkeep new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/parity/reference/.gitkeep |
