diff --git a/crates/engine/tests/it/sbs_functions.rs b/crates/engine/tests/it/sbs_functions.rs index b27eab7..c1629bd 100644 --- a/crates/engine/tests/it/sbs_functions.rs +++ b/crates/engine/tests/it/sbs_functions.rs @@ -43,24 +43,28 @@ fn imported_expression_cooks_follows_inputs_and_survives_undo_and_save() { s.cooked.image(levels, 0).unwrap().mean()[0] }; - assert!(mean(&mut s).abs() < 1e-5); + // The default swizzle places the scalar in red. Grayscale Levels averages RGB, + // so the lower endpoints are (0.75 - 0.25) / 3 and (0.5 - 0.25) / 3. + let original_mean = 2.0 / 5.0; + let changed_mean = 5.0 / 11.0; + assert!((mean(&mut s) - original_mean).abs() < 1e-5); execute(&mut s, "graph.exposed.set", &json!({"id": "amount", "value": 0.5})).unwrap(); - assert!((mean(&mut s) - 1.0 / 3.0).abs() < 1e-5); + assert!((mean(&mut s) - changed_mean).abs() < 1e-5); execute(&mut s, "edit.undo", &json!({})).unwrap(); - assert!(mean(&mut s).abs() < 1e-5); + assert!((mean(&mut s) - original_mean).abs() < 1e-5); execute(&mut s, "edit.redo", &json!({})).unwrap(); - assert!((mean(&mut s) - 1.0 / 3.0).abs() < 1e-5); + assert!((mean(&mut s) - changed_mean).abs() < 1e-5); let saved = sbs::write_sbs(&s.pkg).unwrap(); s.pkg = sbs::read_sbs(&saved, "saved.sbs", &|_| None).unwrap().pkg; s.cache.lock().unwrap().clear(); - assert!((mean(&mut s) - 1.0 / 3.0).abs() < 1e-5); + assert!((mean(&mut s) - changed_mean).abs() < 1e-5); assert!(s.graph().unwrap().nodes.iter().find(|node| node.def == "levels").unwrap().functions.contains_key("in_low")); } diff --git a/docs/parity-fixes.md b/docs/parity-fixes.md index 15e7854..a7b9212 100644 --- a/docs/parity-fixes.md +++ b/docs/parity-fixes.md @@ -231,6 +231,12 @@ For the 256² ramp, use U16 code 256y+x or store (256y+x)/65535 through an F16 b For the tiling control, enlarge a 4² grayscale word field with code (4y+x)×4096 to 8². Use a neutral Levels or a foreground-only Blend at full opacity. In mask order 0,1,2,3, the top-left U16 levels are 0, 3072, 12288 and 15360 in both operations. Four regression tests cover source filtering, half precision before the curve, grayscale control conversion and independent tiling axes through the evaluator and its cache. +### Saved filter graphs and scalar Levels controls + +A grayscale Levels graph with an exposed scalar expression matches **4,096/4,096 pixels in 16 renders**, maximum zero. Bind a uniform .5 F32 input at 16². Set the lower input control to a float4 swizzle of (amount−.25). With the default swizzle, the expression occupies red and the other RGB components are zero. At amounts .75 and .5, the raw F32 outputs are .40000003576278687 and .4545454680919647. An explicit (0,0,0,0) swizzle instead broadcasts the scalar and produces 0 and .3333333432674408. Repeat both graphs at amounts .9375 and .25. Use seeds 9217 through 9220 in that order and render both U16 and F32. The engine regression also changes the input, undoes it, redoes it and reloads the saved package. + +Five original graphs saved through MaterialCraft's file commands reopened in the reference with **52,224/52,224 pixels identical to the reference renders of the source files**, maximum zero. Both the imported and written packages use schema 1.1.0.202502. Compare the seven gray Y-only and seven RGBA X-only [custom-region square renders](#tiling-axes-and-pattern-copy-bounds), seven box blur renders at index 0 and seven directional renders at index 15 and .25 turns in the [input-resize matrix](#stored-input-precision-in-box-and-directional-blur), and the eight default-swizzle Levels renders above. The original procedural fields, exposed values, output formats and dimensions were the same on both sides of each comparison. + ### Repeated seeds in dirt and pattern generators At 16² F32 and seed 9802, Dirt 5 produces two reference values at pixel (12,4) on repeated evaluations of the same graph. The other 255/256 pixels agree in all eight observations. With the intermediate images included, the output was 0.21309643983840942 three times and 0.21314725279808044 five times. With only the output observed, the counts were seven and one. The maximum difference in both series is 0.0000508129597. The U16 FX-Map at that coordinate alternates between levels 36,829 and 36,830. The directly connected F32 Levels image also alternates. In the original 16² MaterialCraft render the pixel is 0.21309643983840942. The recorded overall root counts still include the comparison against the original reference observation. [Square and rectangular pattern generators](#square-and-rectangular-pattern-generators) diff --git a/docs/sbs-root-nodes.md b/docs/sbs-root-nodes.md index 181b7a0..803b7ef 100644 --- a/docs/sbs-root-nodes.md +++ b/docs/sbs-root-nodes.md @@ -37,7 +37,7 @@ Statuses: **Not checked**, **In progress**, **Parity** (exact pixels or typed va The first pass covered all **546 roots**, with **166 Parity** and **380 Too hard**. The current inventory has **354 Parity**, **71 In progress** and **121 Too hard**. The November 17–19 comparisons include raw counts, output formats and remaining differences. [November 17 measurements](parity-fixes.md#2026-11-17-root-comparisons) · [November 18 measurements](parity-fixes.md#2026-11-18-root-comparisons) · [November 19 measurements](parity-fixes.md#2026-11-19-root-comparisons) -[Pattern tiling axes and copy bounds across 215 renders](parity-fixes.md#tiling-axes-and-pattern-copy-bounds) · [Grayscale sampler measurements](parity-fixes.md#grayscale-sampling-of-color-inputs) · [Value sampling across 240 typed comparisons](parity-fixes.md#value-processor-texture-filtering) +[Pattern tiling axes and copy bounds across 215 renders](parity-fixes.md#tiling-axes-and-pattern-copy-bounds) · [Grayscale sampler measurements](parity-fixes.md#grayscale-sampling-of-color-inputs) · [Value sampling across 240 typed comparisons](parity-fixes.md#value-processor-texture-filtering) · [Five saved graphs reopened in the reference](parity-fixes.md#saved-filter-graphs-and-scalar-levels-controls) [Unconnected function arguments](parity-fixes.md#unconnected-function-arguments) records the measured difference between open ports and authored defaults.