diff --git a/crates/nodes/src/atomic/directional_blur.rs b/crates/nodes/src/atomic/directional_blur.rs index a9a13de9..136f9bd4 100644 --- a/crates/nodes/src/atomic/directional_blur.rs +++ b/crates/nodes/src/atomic/directional_blur.rs @@ -54,11 +54,11 @@ pub(super) fn blur(context: &CookContext, angle: f32) -> CookResult { let reach = (radius - 0.5) * major; if reach <= 1.0 { // Normalize the offsets in texture coordinates so the longer side keeps its texel scale. - // The first tap lies in the positive direction of the dominant image axis. let u = dx / context.w as f32; let v = dy / context.h as f32; - let dominant = if dx.abs() > dy.abs() { dx } else { dy }; - let span = -u.abs().max(v.abs()).copysign(dominant); + // Tap order affects the fused sum. A rectangular image can change which UV axis dominates. + let dominant = if u.abs() > v.abs() { u } else { v }; + let span = -dominant; return Ok(vec![box_filter::short_line(&input, reach, [u / span, v / span], tile, source_format)]); } if tile == [true; 2] && context.w == input.width() && context.h == input.height() { diff --git a/crates/nodes/tests/atomic_filter_parity.rs b/crates/nodes/tests/atomic_filter_parity.rs index 36db9079..db0cb705 100644 --- a/crates/nodes/tests/atomic_filter_parity.rs +++ b/crates/nodes/tests/atomic_filter_parity.rs @@ -471,6 +471,21 @@ fn rotated_axial_blurs_project_the_outer_texel_coverage() { } } +#[test] +fn short_diagonal_blur_orders_the_taps_in_texture_coordinates() { + let params = [("intensity", Value::Float(2.64)), ("angle", Value::Float(-0.125))]; + for (size, corner, interior) in [([64, 128], 0x3ec0b937, 0x3ebf5a70), ([128, 64], 0x3ed1f3e7, 0x3ebf5a71), ([64, 64], 0x3ee9db4a, 0x3ea1a134)] { + let input = Image::gray(size[0], size[1], |x, y| { + let level = (17 * x + 113 * y + 59 * x * y + 19) % 65536; + ((level * 7919) % 65536) as f32 / 65535.0 + }) + .with_integer_sampling(true); + let image = cook("directional_blur", &[Some(input)], ¶ms, size, true); + assert_eq!(image.get_gray(1, 0, false).to_bits(), corner, "{size:?}"); + assert_eq!(image.get_gray(6, 4, false).to_bits(), interior, "{size:?}"); + } +} + fn signed_modular_field(width: u32, height: u32) -> Image { Image::generate(width, height, Kind::Color, |x, y| { std::array::from_fn(|c| { diff --git a/docs/parity-fixes.md b/docs/parity-fixes.md index 9e6d768b..adf4e6da 100644 --- a/docs/parity-fixes.md +++ b/docs/parity-fixes.md @@ -582,6 +582,46 @@ At 256² with defaults and seed 0, repeat the original Gaussian Spots 2 six time | U16 | 6 | 65,532 · 1 | 65,535 | 1 | 1 | | F32 | 5 | 53,871 · 1.1920929e-07 | 61,912 | 3,565 | 1.1920929e-07 | +### Short directional blur tap order on rectangular inputs + +Fluid matches **25,969,920/25,969,920 final pixels across 121 distinct settings** through 2048 pixels per side. Both applications reopened the MaterialCraft package and reproduced every pixel of their originals over 28, 38 and 36 settings (498,688, 8,654,848 and 17,588,224 pixels). The three instrumented renders at 512×1024, 1024×512 and 1024² match 9,961,472/9,961,472 intermediate and final samples. [First differing stage and earlier settings](#fibers-1-and-fluid-through-1024-pixels-per-side) + +| Storage | Distinct settings | Exact pixels | Maximum error | +|---|---:|---:|---:| +| U8 | 19 | 4,848,896/4,848,896 | 0 | +| U16 | 41 | 8,206,592/8,206,592 | 0 | +| F16 | 19 | 4,848,896/4,848,896 | 0 | +| F32 | 42 | 8,065,536/8,065,536 | 0 | + +For the final 36 renders use the following (width×height, seed, d) tuples in order. Render U16 and F32 throughout, adding U8 and F16 at zero-based indices 0,3,4,6,9,11. + +| j | Dimensions | Seed | d | +|---:|---|---:|---:| +| 0 | 32×128 | 0 | .9375 | +| 1 | 128×32 | 42 | .34375 | +| 2 | 256×512 | 412351 | default | +| 3 | 512×256 | 402971 | .09375 | +| 4 | 512×1024 | 43016 | .6875 | +| 5 | 512×1024 | 0 | .90625 | +| 6 | 1024×512 | 42 | default | +| 7 | 256×1024 | 13441 | .40625 | +| 8 | 1024×256 | 67357 | .59375 | +| 9 | 512×2048 | 31121 | .25 | +| 10 | 2048×512 | 60149 | .796875 | +| 11 | 1024×1024 | 31973 | default | + +Use disorder d, warp intensity 53d, flow .34375−d, pattern length .78125−.625d and width .09375+.625d for the changed settings. At j=4 use the earlier 512×1024 settings (warp intensity 41.9375, flow .21875, length .5546875, width .359375). The third directional blur now matches 131,072/131,072 U16 pixels there. + +A three-tap directional blur reads its outer taps in the order set by the dominant **normalized texture coordinate**. At −.125 turns it starts toward increasing x on a tall image and increasing y on a wide image. Reading the taps in reverse changes the last bit of the fused sum. Generate a linear U16 field with level ((17x+113y+59xy+19)×7919) mod 65536, enable both tile axes, and use intensity 2.64 at 64×128. At (1,0) the F32 bits change from 0x3ec0b936 to the measured 0x3ec0b937. With the same strength and 128×64 the measured bits are 0x3ed1f3e7. + +| Original input series | Renders | Exact pixels before | Exact pixels after / total | Maximum error after by storage | +|---|---:|---:|---:|---| +| ±.125 turns | 70 | 3,780,865 | 3,956,736/3,956,736 | 0 / 0 / 0 / 0 | +| Seven other angles | 147 | 865,371 | 871,548/1,003,520 | 0 / 1 / 0.000122070312 / 1.1920929e-07 | +| Earlier rectangle and square controls | 174 | 923,423 | 923,423/1,622,016 | 192 / 49199 / 1.05664062 / 1.06214854 | + +The last column gives U8, U16, F16 and F32 in order. For the new series use radii .515625, .66, .875 and 1.32, with intensity equal to radius×256/min(width,height). Render F32 throughout, adding U8, U16 and F16 at radius .66. At ±.125 use 64×128, 128×64, 64², 256×512 and 512×256. At .375, −.375, .875, −.0625, .3125, −.1875 and .09375 turns use the first three sizes. For native RGBA input, import the grayscale field into the fixed U16 color input. At .375 turns and radius .875 on 64×128, and at .875 turns and radius 1.32 on 128×64, exact F32 counts decrease from 4,055 to 3,517 and 3,130 to 2,941. In both cases maximum error falls from 1.1920929e−7 to 5.96046448e−8. These short oblique angles remain open. [Earlier oblique controls](#short-oblique-directional-blur) + ### Fibers 1 and Fluid through 1024 pixels per side Fibers 1 matched 9,430,272/9,430,272 final pixels across 87 distinct combinations of dimensions, seed, parameter values and storage. Fluid matched 9,428,962/9,430,272 on the same matrix. The 655 differing locations in the 512×1024 Fluid render affect both the U16 and F32 outputs. Each application reproduced its original pixels when reopening the MaterialCraft package in the new 28 and 38 settings (498,688 and 8,654,848 pixels per root). diff --git a/docs/sbs-root-nodes.md b/docs/sbs-root-nodes.md index 48f5520b..1b0c9ad8 100644 --- a/docs/sbs-root-nodes.md +++ b/docs/sbs-root-nodes.md @@ -35,7 +35,7 @@ A graph may accept input pins and still be a root under the dependency criterion Statuses: **Not checked**, **In progress**, **Parity** (exact pixels or typed values for the linked measured cases), or **Too hard** (reason recorded). Function calls do not count as regular graph dependencies. -The first pass covered all **546 roots**, with **166 Parity** and **380 Too hard**. The current inventory has **398 Parity**, **148 In progress** and **0 Too hard**. The November 17–20 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) · [November 20 measurements](parity-fixes.md#2026-11-20-root-comparisons) +The first pass covered all **546 roots**, with **166 Parity** and **380 Too hard**. The current inventory has **399 Parity**, **147 In progress** and **0 Too hard**. The November 17–20 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) · [November 20 measurements](parity-fixes.md#2026-11-20-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) · [Five saved graphs reopened in the reference](parity-fixes.md#saved-filter-graphs-and-scalar-levels-controls) @@ -89,7 +89,7 @@ Crystal 2 now matches all 5,104,128 pixels across 99 distinct settings through 5 BNW Spots 3 matches all 3,159,552 final pixels across 118 distinct settings. Both apps reopened its saved graph and reproduced all 2,399,232 pixels in the 40-setting file check. One U16 difference remains inside its 256² pattern stage. BNW Spots 1 matches 3,177,940/3,177,984 final pixels across 125 settings. [Pixel-center measurements and remaining differences](parity-fixes.md#pixel-center-rounding-at-the-near-stamp-vertex) -Fibers 1 matched all 9,430,272 pixels across 87 settings. Fluid differed at one rectangular size. [Measurements and saved-file checks](parity-fixes.md#fibers-1-and-fluid-through-1024-pixels-per-side) +Fibers 1 matched all 9,430,272 pixels across 87 settings. Fluid now matches all 25,969,920 across 121. [Fiber settings](parity-fixes.md#fibers-1-and-fluid-through-1024-pixels-per-side) · [Fluid measurements and package reopens](parity-fixes.md#short-directional-blur-tap-order-on-rectangular-inputs) Directional Noise matches 40,572,160/40,572,160 pixels over 136 settings through 2048². BNW Spots 3 now matches every captured intermediate. [Coordinate measurements and round-trip checks](parity-fixes.md#interpolated-coordinates-on-clipped-squares-and-quarter-turns) @@ -252,7 +252,7 @@ Creased matches 10,947,840/10,947,840 pixels across 100 distinct settings throug | [flood_fill_2.sbs/flood_fill_to_random_color](../assets/sbs/flood_fill_2.sbs) | 1 | No | [Parity · 19 renders, 143,872 exact RGBA pixels](parity-fixes.md#packed-random-draws-in-flood-fill-color) | | [flood_fill_2.sbs/flood_fill_to_random_grayscale](../assets/sbs/flood_fill_2.sbs) | 1 | No | [Parity · 19 renders, 143,872 exact pixels](parity-fixes.md#scaled-random-draws-and-offsets) | | [floodfill_to_index.sbs/pass](../assets/sbs/floodfill_to_index.sbs) | 1 | Yes | [Parity: 4 cases](parity-fixes.md#verified-cases) | -| [fluid.sbs/fluid](../assets/sbs/fluid.sbs) | 0 | Yes | [In progress · 9,428,962/9,430,272 across 87 distinct settings](parity-fixes.md#fibers-1-and-fluid-through-1024-pixels-per-side) | +| [fluid.sbs/fluid](../assets/sbs/fluid.sbs) | 0 | Yes | [Parity · 25,969,920/25,969,920 pixels across 121 distinct settings](parity-fixes.md#short-directional-blur-tap-order-on-rectangular-inputs) | | [fractal_sum_base.sbs/fractal_sum_base](../assets/sbs/fractal_sum_base.sbs) | 0 | Yes | [Parity · 18 renders, 145,664 exact pixels](parity-fixes.md#stored-grayscale-stops-and-scalar-levels-controls) | | [fur_1.sbs/fur_1](../assets/sbs/fur_1.sbs) | 0 | Yes | [Parity · 9,250,048/9,250,048 pixels across 85 distinct settings](parity-fixes.md#fur-across-two-rectangular-render-series) | | [fur_2.sbs/fur_2](../assets/sbs/fur_2.sbs) | 0 | Yes | [In progress · 8,768,470/9,250,048 pixels across 85 distinct settings](parity-fixes.md#fur-across-two-rectangular-render-series) |