Preserve wide pattern tiling intervals

This commit is contained in:
chasse20 committed 2026-11-20 23:59:12 -05:00
1 parent f9fc19f299
commit 76e90bcc42
4 files changed
+44 -3

No files matched your search

+2 -1
View File
@@ -54,7 +54,8 @@ pub fn clamp_params(definition: &NodeDefinition, params: &mut BTreeMap<String, V
("levels", "in_low" | "in_high" | "out_low" | "out_high")
| ("transformation", "matrix" | "offset")
| ("directional_warp", "intensity")
| ("fx_map", "roughness" | "opacity")
// The pattern renderer bounds copy count and pixel work using the resolved region.
| ("fx_map", "roughness" | "opacity" | "tiling_region")
);
let ranged = parameter.min < parameter.max && !unbounded;
let span = parameter.max - parameter.min;
+21
View File
@@ -63,6 +63,27 @@ fn expanding_the_render_window_preserves_the_tiling_region() {
assert_eq!(wider.mean()[0], 0.125);
}
#[test]
fn wide_tiling_regions_place_and_wrap_stamps_at_the_authored_period() {
for vertical in [false, true] {
let region = if vertical { [-15.5, 16.5, -31.5, 32.5] } else { [-31.5, 32.5, -15.5, 16.5] };
for (center, size, columns, rows) in
[([26.0, 2.0], [3.0, 4.0], 56..=58, 31..=38), ([-24.0, -3.0], [3.0, 5.0], 6..=8, 20..=29), ([35.0, 4.0], [4.0, 3.0], 1..=4, 36..=41)]
{
let orient = |[x, y]: [f32; 2]| if vertical { [y, x] } else { [x, y] };
let offset = orient(center).map(|v| v - 0.5);
let image = render_stamp(region, region, 3, offset, orient(size)).unwrap().remove(0);
for y in 0..64 {
for x in 0..64 {
let (column, row) = if vertical { (y, x) } else { (x, y) };
let expected = if columns.contains(&column) && rows.contains(&row) { 1.0 } else { 0.0 };
assert_eq!(image.get(x, y, false)[0], expected, "center {center:?}, pixel ({x},{y}), vertical {vertical}");
}
}
}
}
}
#[test]
fn a_stamp_repeats_on_each_enabled_axis_inside_the_tiling_region() {
let unit = [0.0, 1.0, 0.0, 1.0];
+19
View File
@@ -917,6 +917,25 @@ Set disorder, disorder speed, disorder anisotropy, angle random and pattern amou
Both Gaussian Noise outputs are exact at the default 256² and 512² settings. The 128 × 512 test at scale 32 with non-square expansion differs at all 65,536 F32 pixels in the first version, with maximum error 1.93185183. The 512 × 128 test at scale 19 with expansion disabled differs at 2,432 pixels, with maximum 1.49011612e-7. The earlier stage comparisons locate differences in the pattern generator. The scratch and spots counts also retain nonzero errors. All six roots remain open.
### Tiling periods on rectangular Gaussian noise graphs
A single square stamp exposed the displacement at the edge of a wide tiling region. The parameter resolver clipped each tiling coordinate to the catalog slider range extended by 16 units. A 64-unit interval centered on .5 became a 33-unit interval, which moved repeated stamps. The resolver now passes the finite coordinates to the pattern renderer. The renderer bounds visited stamps, copies and sampled pixels.
Center the render and tiling rectangles on (.5,.5). Use (render width, render height, tile width, tile height) of (32,32,32,32), (38,19,33,19), (19,38,19,33), (64,32,33,32), (32,64,32,33), (44,11,33,11), (32,64,32,64), (64,32,64,32), (33,33,33,33), (34,17,34,17) and (32,64,32,33). Enable both tiling axes except in the last case. Place the root branch at (−.5,−.5) with zero rotation, zero variation and additive blending. Use a single square for zero-based indices 1, 4, 7 and 10, and a horizontal ramp for the others. Render at 128 × 64 F32 when the render width is at least the height, and 64 × 128 otherwise. Set (X offset, Y offset, X size, Y size) to (0,0,5.75,6.25), (9,.5,7,11), (−14.5,−5,3.25,2.25), (17,2,5,3), (26,−14,3,4), (−31,1,3.75,3), (.25,22,8,6), (1,−19,7,9) and (.5,−27,4,2). Use seed `457591 + 11j + h` for interval index `j` and stamp index `h`.
The independent 64² controls use identical render and tile intervals 64 × 32, repeated with the axes exchanged. Set (center X, center Y, width, height) to (26,2,3,4), (−24,−3,3,5), (14.5,−1,5,3) and (35,4,4,3), with seeds 458293 through 458296. In the first orientation the first stamp covers columns 56–58 and rows 31–38 inclusive. The last wraps into columns 1–4 and rows 36–41. The transposed masks exchange rows and columns. Across the 99 rectangular and eight square cases, **841,920/843,776** F32 pixels previously matched, maximum error 1. The full intervals match **843,776/843,776**, maximum error zero.
The same 79 [whole-root settings](#scaled-scratch-and-gaussian-noise-and-spot-generators) were compared again for each version, including defaults, varied scale, non-square expansion, seeds, resolutions and four storage formats. Each version also reproduced the raw pixels of both 30-setting series after a save and reopen in each application. The table counts the original settings once.
| Root (inventory index) | Distinct settings | U8 exact / total · max | U16 exact / total · max | F16 exact / total · max | F32 exact / total · max |
|---|---:|---:|---:|---:|---:|
| Gaussian Noise (281) | 79 | 507,392/507,392 · 0 | 917,296/917,504 · 1 | 507,390/507,392 · 0.000244140625 | 825,603/907,520 · 3.57627869e-07 |
| Gaussian Noise v2 (282) | 79 | 540,160/540,160 · 0 | 884,582/884,736 · 1 | 507,392/507,392 · 0 | 839,170/907,520 · 2.38418579e-07 |
Four additional file pairs isolate the region setting. Use scale 19 with disorder .8125, non-square expansion enabled and 64 × 32 F32 or 32 × 64 U16. Use seeds 87892 and 87893 in the first version and 87899 and 87900 in v2. In v2 set disorder speed to 1.375, anisotropy to .625, anisotropy angle to −.3125 and tile offset to (−.4375,.0625). Reopen files with the authored tiling expression and with the full render interval assigned directly. Both reproduce every original reference pixel. Assigning the clipped interval instead changes 797 and 774 pixels in the first version and 2,048 and 1,390 in v2. The maximum F32 errors are .668966413 and 1.01086843 respectively. The corresponding U16 maxima are 43,886 and 51,197 levels.
Across all inventory settings, both versions now agree on every U8 pixel. The first version retains two F16 differences, and both retain one-level U16 differences and small F32 discrepancies in the pattern generator. The wide-stamp regression failed before the interval change. All 318 node release tests, strict workspace Clippy, formatting, dependency layers and WebAssembly checks passed.
### 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)
+2 -2
View File
@@ -380,8 +380,8 @@ Creased matches 10,947,840/10,947,840 pixels across 100 distinct settings throug
| [noise_fur_1.sbs/fur_1](../assets/sbs/noise_fur_1.sbs) | 0 | No | [In progress · 122,549/178,432 exact pixels in 21 renders](parity-fixes.md#stored-opacity-across-pattern-depths) |
| [noise_fur_2.sbs/fur_2](../assets/sbs/noise_fur_2.sbs) | 0 | No | [In progress · 130,666/178,432 exact pixels, first difference in FX-Map](parity-fixes.md#fur-pattern-sources-and-downstream-filters) |
| [noise_fur_3.sbs/fur_3](../assets/sbs/noise_fur_3.sbs) | 0 | No | [In progress · 132,982/178,432 exact pixels, first difference in FX-Map](parity-fixes.md#fur-pattern-sources-and-downstream-filters) |
| [noise_gaussian_noise.sbs/gaussian_noise](../assets/sbs/noise_gaussian_noise.sbs) | 0 | Yes | [In progress · 2,434,722/2,839,808 pixels across 79 distinct settings](parity-fixes.md#scaled-scratch-and-gaussian-noise-and-spot-generators) |
| [noise_gaussian_noise_v2.sbs/gaussian_noise](../assets/sbs/noise_gaussian_noise_v2.sbs) | 0 | No | [In progress · 2,361,789/2,839,808 pixels across 79 distinct settings](parity-fixes.md#scaled-scratch-and-gaussian-noise-and-spot-generators) |
| [noise_gaussian_noise.sbs/gaussian_noise](../assets/sbs/noise_gaussian_noise.sbs) | 0 | Yes | [In progress · 2,757,681/2,839,808 pixels across 79 distinct settings](parity-fixes.md#tiling-periods-on-rectangular-gaussian-noise-graphs) |
| [noise_gaussian_noise_v2.sbs/gaussian_noise](../assets/sbs/noise_gaussian_noise_v2.sbs) | 0 | No | [In progress · 2,771,304/2,839,808 pixels across 79 distinct settings](parity-fixes.md#tiling-periods-on-rectangular-gaussian-noise-graphs) |
| [noise_gaussian_spots_1.sbs/gaussian_spots_1](../assets/sbs/noise_gaussian_spots_1.sbs) | 0 | Yes | [In progress · 2,782,637/2,793,472 pixels across 67 distinct settings](parity-fixes.md#scaled-scratch-and-gaussian-noise-and-spot-generators) |
| [noise_gaussian_spots_1_v2.sbs/gaussian_spots_1](../assets/sbs/noise_gaussian_spots_1_v2.sbs) | 0 | No | [In progress · 2,778,715/2,793,472 pixels across 67 distinct settings](parity-fixes.md#scaled-scratch-and-gaussian-noise-and-spot-generators) |
| [noise_gaussian_spots_2.sbs/gaussian_spots_2](../assets/sbs/noise_gaussian_spots_2.sbs) | 0 | Yes | [In progress · 132,670/174,336 exact pixels · 2 additional cases exceeded the traversal limit](parity-fixes.md#gaussian-pattern-sources-and-repeat-limits) |