mirror of
https://github.com/storytold/materialcraft.git
synced 2026-11-24 16:31:02 +01:00
Spread distance sources within the measured radius and metric
This commit is contained in:
1 parent
28f778ebfb
commit
cd1fd5e17a
7 files changed
+206
-112
No files matched your search
@@ -32,7 +32,7 @@ pub(super) const FILTERS: &[FilterMap] = &[
|
||||
sbs: "distance",
|
||||
def: "distance",
|
||||
inputs: &[("mask", "mask"), ("source", "source")],
|
||||
params: &[("distance", "distance"), ("combinedistance", "combine")],
|
||||
params: &[("distance", "distance"), ("combinedistance", "combine"), ("distancemode", "metric")],
|
||||
},
|
||||
FilterMap {
|
||||
sbs: "emboss",
|
||||
|
||||
@@ -364,6 +364,23 @@ fn native_function_fixture_retains_operation_types_and_ports() {
|
||||
assert_eq!(function.nodes[2].inputs, vec![Some(function.nodes[0].id), Some(function.nodes[1].id)]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn distance_metric_survives_a_package_round_trip() {
|
||||
let mut package = Package::new("Distances");
|
||||
let mut graph = Graph::new("Distances");
|
||||
for metric in [1, 2] {
|
||||
let node = graph.add_node("distance", [0.0; 2]);
|
||||
graph.node_mut(node).unwrap().params.insert("metric".into(), Value::Enum(metric));
|
||||
}
|
||||
package.graphs.push(graph);
|
||||
let bytes = write_sbs(&package).unwrap();
|
||||
let document = roxmltree::Document::parse(std::str::from_utf8(&bytes).unwrap()).unwrap();
|
||||
assert_eq!(document.descendants().filter(|n| n.has_tag_name("name") && n.attribute("v") == Some("distancemode")).count(), 2);
|
||||
let read = read_sbs(&bytes, "distances.sbs", &no_linked_files).unwrap();
|
||||
let metrics: Vec<_> = read.pkg.graphs[0].nodes.iter().filter_map(|n| n.params.get("metric").and_then(Value::as_i32)).collect();
|
||||
assert_eq!(metrics, [1, 2]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn image_output_types_follow_color_mode_and_blended_inputs() {
|
||||
let mut package = Package::new("Channels");
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
use super::ATOMIC;
|
||||
use crate::ops;
|
||||
use crate::{CookContext, CookResult, NodeDefinition, node};
|
||||
use craft_texture::Image;
|
||||
|
||||
mod mask_field;
|
||||
|
||||
@@ -12,6 +10,7 @@ pub(super) fn definition() -> NodeDefinition {
|
||||
.gray_in("mask", "Mask input")
|
||||
.any_in("source", "Source input")
|
||||
.float("distance", "Maximum distance", 10.0, 0.0, 256.0)
|
||||
.choice("metric", "Distance metric", &["Euclidean", "Manhattan", "Chebyshev"], 0)
|
||||
.boolean("combine", "Combine distance with source", true)
|
||||
.any_out()
|
||||
.cook(distance)
|
||||
@@ -19,34 +18,7 @@ pub(super) fn definition() -> NodeDefinition {
|
||||
|
||||
fn distance(context: &CookContext) -> CookResult {
|
||||
let mask = context.gray_or(0, 0.0);
|
||||
const BASE_RESOLUTION: f32 = 256.0;
|
||||
const MIN_DISTANCE_PIXELS: f32 = 1e-3;
|
||||
let strength = context.f("distance").max(0.0) / BASE_RESOLUTION;
|
||||
let Some(source) = context.sized(1) else {
|
||||
return Ok(vec![mask_field::render(&mask, strength * mask.width().min(mask.height()) as f32, context.tiling_axes())?]);
|
||||
};
|
||||
let maximum_distance = (strength * context.w as f32).max(MIN_DISTANCE_PIXELS);
|
||||
let data = mask.shared_data().clone();
|
||||
let inside = |i| data.get(i).copied().unwrap_or(0.0) > 0.5;
|
||||
|
||||
// Propagate the exact nearest site without gaps from gradient-walk stalls
|
||||
let (squared_distances, sites) = ops::distance_sq_with_sites(context.w, context.h, inside, context.tile);
|
||||
let combine = context.b("combine");
|
||||
Ok(vec![Image::generate(context.w, context.h, source.kind(), |x, y| {
|
||||
let i = y as usize * context.w as usize + x as usize;
|
||||
let site = sites.get(i).copied().unwrap_or(usize::MAX);
|
||||
let mut pixel = if site == usize::MAX {
|
||||
[0.0, 0.0, 0.0, if source.is_gray() { 1.0 } else { 0.0 }]
|
||||
} else {
|
||||
source.get((site % context.w as usize) as i64, (site / context.w as usize) as i64, false)
|
||||
};
|
||||
let d = squared_distances.get(i).copied().unwrap_or(f32::INFINITY).sqrt();
|
||||
if d > maximum_distance {
|
||||
pixel = [0.0, 0.0, 0.0, if source.is_gray() { 1.0 } else { 0.0 }];
|
||||
} else if combine {
|
||||
let falloff = (1.0 - d / maximum_distance).clamp(0.0, 1.0);
|
||||
pixel = [pixel[0] * falloff, pixel[1] * falloff, pixel[2] * falloff, pixel[3]];
|
||||
}
|
||||
pixel
|
||||
})])
|
||||
let source = context.sized(1);
|
||||
let radius = (context.f("distance").max(0.0) * (mask.width().min(mask.height()) as f32 / 256.0)).min(f32::MAX);
|
||||
Ok(vec![mask_field::render(&mask, source.as_ref(), radius, context.tiling_axes(), context.i("metric"), context.b("combine"))?])
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
use crate::{function::pixel_sqrt, ops::gray_from};
|
||||
use craft_texture::Image;
|
||||
use crate::function::pixel_sqrt;
|
||||
use craft_texture::{Image, Kind};
|
||||
use rayon::prelude::*;
|
||||
|
||||
type Site = [u16; 2];
|
||||
@@ -37,73 +37,126 @@ impl Axis {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn render(mask: &Image, radius: f32, tile: [bool; 2]) -> Result<Image, String> {
|
||||
struct Geometry {
|
||||
columns: Axis,
|
||||
rows: Axis,
|
||||
metric: i32,
|
||||
}
|
||||
|
||||
impl Geometry {
|
||||
fn squared_distance(&self, x: usize, y: usize, site: Site) -> f32 {
|
||||
let dx = self.columns.delta(x, site[0]);
|
||||
let dy = self.rows.delta(y, site[1]);
|
||||
match self.metric {
|
||||
1 => (dx + dy) * (dx + dy),
|
||||
2 => dx.max(dy) * dx.max(dy),
|
||||
_ => dy.mul_add(dy, dx * dx),
|
||||
}
|
||||
}
|
||||
|
||||
fn propagate(&self, mut sites: Vec<Site>, first_jump: u32) -> Vec<Site> {
|
||||
let width = self.columns.positions.len();
|
||||
let mut next = vec![EMPTY; sites.len()];
|
||||
let jumps = (0..=first_jump.ilog2()).rev().map(|power| 1i32 << power);
|
||||
// A final unit step fills missed sites on open fields. It changes measured winners on tiled fields.
|
||||
let refine = (!self.columns.tiled && !self.rows.tiled).then_some(1);
|
||||
for step in jumps.chain(refine) {
|
||||
let xs = self.columns.neighbors(step);
|
||||
let ys = self.rows.neighbors(step);
|
||||
next.par_chunks_mut(width).enumerate().for_each(|(y, output)| {
|
||||
for (x, dest) in output.iter_mut().enumerate() {
|
||||
let mut best = sites[y * width + x];
|
||||
if best != [x as u16, y as u16] {
|
||||
let mut nearest = if best == EMPTY { f32::INFINITY } else { self.squared_distance(x, y, best) };
|
||||
for &sx in xs[x].iter().flatten() {
|
||||
for &sy in ys[y].iter().flatten() {
|
||||
let candidate = sites[sy * width + sx];
|
||||
if candidate != EMPTY && candidate != best {
|
||||
let d = self.squared_distance(x, y, candidate);
|
||||
if d < nearest {
|
||||
nearest = d;
|
||||
best = candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*dest = best;
|
||||
}
|
||||
});
|
||||
std::mem::swap(&mut sites, &mut next);
|
||||
}
|
||||
sites
|
||||
}
|
||||
}
|
||||
|
||||
fn attenuate(mut pixel: [f32; 4], gray: bool, weight: f32) -> [f32; 4] {
|
||||
pixel[if gray { 0 } else { 3 }] *= weight;
|
||||
pixel
|
||||
}
|
||||
|
||||
pub(super) fn render(mask: &Image, source: Option<&Image>, radius: f32, tile: [bool; 2], metric: i32, combine: bool) -> Result<Image, String> {
|
||||
let (width, height) = (mask.width(), mask.height());
|
||||
// Reserve the final coordinate pair as the missing-site marker.
|
||||
if width == 0 || height == 0 || width > u32::from(u16::MAX) || height > u32::from(u16::MAX) {
|
||||
return Err("distance mask dimensions exceed the supported coordinate range".into());
|
||||
}
|
||||
let w = width as usize;
|
||||
let mut sites: Vec<Site> = mask.data().iter().enumerate().map(|(i, &v)| if v >= 0.5 { [(i % w) as u16, (i / w) as u16] } else { EMPTY }).collect();
|
||||
if radius == 0.0 || sites.iter().all(|s| *s == EMPTY) || sites.iter().all(|s| *s != EMPTY) {
|
||||
return gray_from(width, height, sites.into_iter().map(|s| if s == EMPTY { 0.0 } else { 1.0 }).collect());
|
||||
let empty = !mask.data().iter().any(|v| *v >= 0.5);
|
||||
let tiled = tile[0] || tile[1];
|
||||
if empty || radius == 0.0 {
|
||||
let result = match source {
|
||||
None => Image::filled(width, height, Kind::Gray, [0.0; 4]),
|
||||
Some(src) if empty && !tiled => Image::filled(width, height, src.kind(), src.get(0, 0, false)),
|
||||
Some(src) if combine => Image::generate(width, height, src.kind(), |x, y| attenuate(src.get(x.into(), y.into(), false), src.is_gray(), 0.0)),
|
||||
Some(src) => src.clone(),
|
||||
};
|
||||
return Ok(result);
|
||||
}
|
||||
let columns = Axis::new(width, tile[0]);
|
||||
let rows = Axis::new(height, tile[1]);
|
||||
let squared_distance = |x, y, site: Site| {
|
||||
let dx = columns.delta(x, site[0]);
|
||||
let dy = rows.delta(y, site[1]);
|
||||
dy.mul_add(dy, dx * dx)
|
||||
};
|
||||
|
||||
// At each jump every pixel reads the previous pass. An extra unit jump changes the winners
|
||||
// on sparse masks where a nearer site was never propagated into this pixel's neighborhood.
|
||||
let largest = (radius as u32).min(width.max(height)).max(1);
|
||||
let mut step = 1 << largest.ilog2();
|
||||
let mut next = vec![EMPTY; sites.len()];
|
||||
while step > 0 {
|
||||
let xs = columns.neighbors(step);
|
||||
let ys = rows.neighbors(step);
|
||||
next.par_chunks_mut(w).enumerate().for_each(|(y, output)| {
|
||||
for (x, dest) in output.iter_mut().enumerate() {
|
||||
let mut best = sites[y * w + x];
|
||||
if best != [x as u16, y as u16] {
|
||||
let mut nearest = if best == EMPTY { f32::INFINITY } else { squared_distance(x, y, best) };
|
||||
for &sy in ys[y].iter().flatten() {
|
||||
for &sx in xs[x].iter().flatten() {
|
||||
let candidate = sites[sy * w + sx];
|
||||
if candidate != EMPTY && candidate != best {
|
||||
let d = squared_distance(x, y, candidate);
|
||||
if d < nearest {
|
||||
nearest = d;
|
||||
best = candidate;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*dest = best;
|
||||
if mask.data().iter().all(|v| *v >= 0.5) {
|
||||
return Ok(source.cloned().unwrap_or_else(|| Image::filled(width, height, Kind::Gray, [1.0; 4])));
|
||||
}
|
||||
// With a subpixel radius no site can reach a neighboring texel. This also keeps a
|
||||
// tiny positive radius from overflowing its reciprocal at a site of distance zero.
|
||||
if radius < 0.5 {
|
||||
let weight = |x: u32, y: u32| if mask.get_gray(x.into(), y.into(), false) >= 0.5 { 1.0 } else { 0.0 };
|
||||
return Ok(match source {
|
||||
None => Image::gray(width, height, weight),
|
||||
Some(src) if combine => {
|
||||
Image::generate(width, height, src.kind(), |x, y| attenuate(src.get(x.into(), y.into(), false), src.is_gray(), weight(x, y)))
|
||||
}
|
||||
Some(src) => src.clone(),
|
||||
});
|
||||
std::mem::swap(&mut sites, &mut next);
|
||||
step >>= 1;
|
||||
}
|
||||
drop(next);
|
||||
|
||||
let w = width as usize;
|
||||
let initial = mask.data().iter().enumerate().map(|(i, &v)| if v >= 0.5 { [(i % w) as u16, (i / w) as u16] } else { EMPTY }).collect();
|
||||
let geometry = Geometry { columns: Axis::new(width, tile[0]), rows: Axis::new(height, tile[1]), metric };
|
||||
let first_jump = (radius.ceil() as u32).clamp(1, width.max(height)).next_power_of_two();
|
||||
let sites = geometry.propagate(initial, first_jump);
|
||||
let inverse_radius = radius.recip();
|
||||
let values = sites
|
||||
.into_par_iter()
|
||||
.enumerate()
|
||||
.map(|(i, site)| {
|
||||
let (x, y) = (i % w, i / w);
|
||||
if site == [x as u16, y as u16] {
|
||||
1.0
|
||||
} else if site == EMPTY || radius <= 0.0 {
|
||||
0.0
|
||||
} else {
|
||||
(-pixel_sqrt(squared_distance(x, y, site))).mul_add(inverse_radius, 1.0).clamp(0.0, 1.0)
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
gray_from(width, height, values)
|
||||
let site_distance = |x: u32, y: u32| {
|
||||
let site = sites[y as usize * w + x as usize];
|
||||
let distance = if site == [x as u16, y as u16] {
|
||||
0.0
|
||||
} else if site == EMPTY {
|
||||
f32::INFINITY
|
||||
} else {
|
||||
pixel_sqrt(geometry.squared_distance(x as usize, y as usize, site))
|
||||
};
|
||||
(site, distance)
|
||||
};
|
||||
let mask_weight = |distance: f32| (-distance).mul_add(inverse_radius, 1.0).clamp(0.0, 1.0);
|
||||
let Some(source) = source else {
|
||||
return Ok(Image::gray(width, height, |x, y| mask_weight(site_distance(x, y).1)));
|
||||
};
|
||||
Ok(Image::generate(width, height, source.kind(), |x, y| {
|
||||
let (site, distance) = site_distance(x, y);
|
||||
let pixel = if distance <= radius { source.get(site[0].into(), site[1].into(), false) } else { source.get(x.into(), y.into(), false) };
|
||||
if !combine {
|
||||
return pixel;
|
||||
}
|
||||
// The tiled path stores the complement after rounding the mask gradient.
|
||||
let weight = if tiled { 1.0 - (1.0 - mask_weight(distance)) } else { (1.0 - distance * inverse_radius).clamp(0.0, 1.0) };
|
||||
attenuate(pixel, source.is_gray(), weight)
|
||||
}))
|
||||
}
|
||||
@@ -5,8 +5,15 @@ use materialcraft_core::Value;
|
||||
use materialcraft_nodes::{CookContext, find, resolve_params};
|
||||
|
||||
fn cook(mask: Image, source: Option<Image>, tile: bool, combine: bool, distance: f32) -> Image {
|
||||
cook_metric(mask, source, tile, combine, distance, 0)
|
||||
}
|
||||
|
||||
fn cook_metric(mask: Image, source: Option<Image>, tile: bool, combine: bool, distance: f32, metric: u32) -> Image {
|
||||
let def = find("distance").unwrap();
|
||||
let params = resolve_params(def, &BTreeMap::from([("distance".into(), Value::Float(distance)), ("combine".into(), Value::Bool(combine))]));
|
||||
let params = resolve_params(
|
||||
def,
|
||||
&BTreeMap::from([("distance".into(), Value::Float(distance)), ("combine".into(), Value::Bool(combine)), ("metric".into(), Value::Enum(metric))]),
|
||||
);
|
||||
let (w, h) = (mask.width(), mask.height());
|
||||
let inputs = [Some(mask), source];
|
||||
let vars = BTreeMap::new();
|
||||
@@ -38,24 +45,40 @@ fn tiled_distance_spreads_source_across_stationary_gradient() {
|
||||
|
||||
#[test]
|
||||
fn distance_spreads_source_beyond_the_old_walk_limit() {
|
||||
let mask = Image::gray(1024, 1, |x, _| if x == 0 { 1.0 } else { 0.0 });
|
||||
let mask = Image::gray(512, 512, |x, y| if x == 0 && y == 0 { 1.0 } else { 0.0 });
|
||||
let output = cook(mask.clone(), Some(mask), false, false, 256.0);
|
||||
assert_eq!(output.get_gray(1023, 0, false), 1.0);
|
||||
assert_eq!(output.get_gray(511, 0, false), 1.0);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn distance_preserves_source_alpha_range_and_combine() {
|
||||
for tile in [false, true] {
|
||||
let mask = Image::gray(9, 3, |x, y| if x == 0 && y == 1 { 1.0 } else { 0.0 });
|
||||
let source = Image::generate(9, 3, Kind::Color, |x, y| if x == 0 && y == 1 { [0.8, 0.4, 0.2, 0.6] } else { [0.1, 0.1, 0.1, 1.0] });
|
||||
for combine in [false, true] {
|
||||
let output = cook(mask.clone(), Some(source.clone()), tile, combine, 512.0 / 9.0); // two pixels
|
||||
assert_eq!(output.get(0, 1, false), [0.8, 0.4, 0.2, 0.6]);
|
||||
let expected = if combine { [0.4, 0.2, 0.1, 0.6] } else { [0.8, 0.4, 0.2, 0.6] };
|
||||
assert_eq!(output.get(1, 1, false), expected);
|
||||
assert_eq!(output.get(4, 1, false), [0.0; 4]);
|
||||
assert_eq!(output.get(8, 1, false), if tile { expected } else { [0.0; 4] });
|
||||
}
|
||||
fn distance_spreads_rgb_and_attenuates_the_alpha_channel() {
|
||||
let mask = Image::gray(32, 32, |x, y| if x == 16 && y == 16 { 0.5 } else { 0.0 });
|
||||
let source =
|
||||
Image::generate(32, 32, Kind::Color, |x, y| std::array::from_fn(|c| ((13 * x + 7 * y + 5 * x * y + 19 * c as u32) % 127) as f32 / 64.0 - 0.375));
|
||||
let output = cook(mask.clone(), Some(source.clone()), true, true, 31.0);
|
||||
assert_eq!(output.get(17, 16, false).map(f32::to_bits), [0x3f50_0000, 0x3f8e_0000, 0x3fb4_0000, 0xbe55_a8ec]);
|
||||
assert_eq!(output.get(0, 0, false), [-0.375, -0.078125, 0.21875, 0.0]);
|
||||
let copy = cook(mask, Some(source.clone()), true, false, 31.0);
|
||||
assert_eq!(copy.get(17, 16, false), source.get(16, 16, false));
|
||||
assert_eq!(copy.get(0, 0, false), source.get(0, 0, false));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn alternative_distance_metrics_use_the_quantized_site_center() {
|
||||
let mask = Image::gray(64, 128, |x, y| if (x, y) == (1, 2) { 1.0 } else { 0.0 });
|
||||
for (metric, bits) in [(1, 0x3f29_5041u32), (2, 0x3f54_a816)] {
|
||||
let image = cook_metric(mask.clone(), None, false, true, 47.25, metric);
|
||||
assert_eq!(image.get_gray(3, 4, false).to_bits(), bits);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn zero_distance_and_a_positive_subpixel_distance_have_distinct_site_values() {
|
||||
let mask = Image::gray(32, 32, |x, y| if (x, y) == (1, 2) { 1.0 } else { 0.0 });
|
||||
for (strength, expected) in [(0.0, 0.0), (0.125, 1.0), (f32::MIN_POSITIVE, 1.0)] {
|
||||
let image = cook(mask.clone(), None, true, true, strength);
|
||||
assert_eq!(image.get_gray(1, 2, false), expected);
|
||||
assert_eq!(image.get_gray(2, 2, false), 0.0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +89,8 @@ fn distance_handles_empty_full_masks_and_no_source() {
|
||||
let full = Image::filled(7, 5, Kind::Gray, [1.0; 4]);
|
||||
let source = Image::generate(7, 5, Kind::Color, |x, y| [x as f32 / 7.0, y as f32 / 5.0, 0.4, 0.7]);
|
||||
|
||||
assert!(cook(empty.clone(), Some(source.clone()), tile, false, 256.0).data().iter().all(|&v| v == 0.0));
|
||||
let background = cook(empty.clone(), Some(source.clone()), tile, false, 256.0);
|
||||
assert_eq!(background.get(3, 2, false), if tile { source.get(3, 2, false) } else { source.get(0, 0, false) });
|
||||
assert_eq!(cook(full, Some(source), tile, true, 256.0).get(3, 2, false), [3.0 / 7.0, 2.0 / 5.0, 0.4, 0.7]);
|
||||
assert!(cook(empty, None, tile, true, 256.0).data().iter().all(|&v| v == 0.0));
|
||||
|
||||
|
||||
@@ -392,6 +392,34 @@ For each of the three shapes, repeat the linear sweep on each axis using these s
|
||||
| 64 | (.8125,1,.625) | .34375 | .375 | (0,0,.25) | 269 |
|
||||
| 32 | (1,.3125,.75) | .75 | .21875 | (.0625,−.125,.1875) | 312 |
|
||||
|
||||
### Connected distance sources and cellular patterns
|
||||
|
||||
A connected distance source supplies the nearest qualifying site's texel inside the radius and the current texel beyond it. With Combine enabled the gray channel or the alpha channel is attenuated. RGB remains the sampled site's color inside the radius and the current texel's color outside. The 120 gray and RGBA controls below previously matched 64,706/184,320 pixels. Maximum errors were 255 U8 levels, 65,535 U16 levels and 1.859375 in F16 and F32.
|
||||
|
||||
| Original distance controls | Renders | Exact pixels / compared | Maximum error |
|
||||
|---|---:|---:|---:|
|
||||
| Matching gray and RGBA source formats | 120 | 184,320/184,320 | 0 |
|
||||
| Three metrics and four tiling settings | 168 | 630,766/630,784 | 0.096614778 |
|
||||
| Empty, isolated and full masks at small distances | 54 | 202,752/202,752 | 0 |
|
||||
| Sparse-site radius sweep and connected-source cutoffs | 120 | 950,270/950,272 | 0.765625 |
|
||||
|
||||
Use both a grayscale source and a matching RGBA source. At pixel (x,y), use channel c=((13x+7y+5xy+19c) mod 127)/64−.375, with c=0 for luminance. Repeat the nine layouts and strengths from the [32² mask controls](#directional-distance-and-mask-propagation) with both axes tiled and Combine on and off. Also run 64×32 with both axes open and Combine on, and 32×64 with both tiled and Combine off. The two centered horizontal sites are at x=W/4 and 3W/4. Run each case in F32 at seed 431+29j from j=0, and repeat the single-center and sparse cases in U8, U16 and F16.
|
||||
|
||||
For the metric row use 64×128 mask-only, 64×32 RGBA and 32² grayscale. Combine is on. Use both open and both tiled with Euclidean, Manhattan and Chebyshev distance, then wrap each axis alone with Euclidean distance. Use F32, seed 197+29j, and strengths 31, 0, 47.25, 159.75, 41.375, 367 and 16. The masks are empty, a site at (1,2) twice, full, sparse, and centered twice. Use (13x+23y+11xy) mod 109=0 for the standalone sparse mask and (13x+11y+7xy) mod 67=0 for the sources. Two grayscale Manhattan cutoff pixels differ only in the sign of zero. The other 16 differences occur on sparse wrapped fields. All 114,688 RGBA pixels in this matrix match. For the small-distance row use both open and both tiled, the same three sizes, Euclidean distance and strengths 0, .125 and 2 at seeds 541, 578 and 615 for each mask.
|
||||
|
||||
For the last row, run the sparse standalone mask at radii 1.25, 2.875, 3.875, 4, 4.25, 5.5, 6.75, 7.875, 8, 8.125, 8.6875, 9.875, 10.34375, 11.5, 12.75, 14.125, 15, 15.875, 16, 16.125, 19.75 and 23.875 pixels at seeds 283+17j. Use 128² tiled Euclidean and 64×128 open fields for all three metrics. All 901,120 mask pixels match. The connected controls use Combine off on 64×32 RGBA and 32² gray, both open and both tiled. At seeds 653+17j use an empty mask at strength 31, a corner, empty and full mask at zero, a corner at 1, a sparse mask at 413 and .25, and a center at 4096. Two RGBA texels differ on the tiled rectangular sparse field at strength 413.
|
||||
|
||||
The open-field results require a final unit propagation step. The measured tiled square cases retain their original winners without it. At zero distance the mask gradient is black. For a positive subpixel radius, qualifying sites are white. When the source is connected and an open field is empty, the result copies its first texel. The 32 directional-distance root renders retain all 342,528 exact pixels.
|
||||
|
||||
| Cellular root | Renders | Exact pixels / compared | Maximum U8 / U16 / F16 / F32 error |
|
||||
|---|---:|---:|---|
|
||||
| Cells 4 | 17 | 19,151/173,312 | 231 / 65462 / 0.9066162109 / 1 |
|
||||
| Cells 4 v2 | 17 | 15,949/173,312 | 253 / 58223 / 0.8881835938 / 1 |
|
||||
|
||||
For the additional cellular controls use the eight [banded-input cases](#panoramic-line-light-and-horizon-across-the-seam). Use defaults at 16². At 64², 128² and with rectangular input, respectively, set scale to 9, 17 and 6, disorder to .21875, .75 and .4375, source selection to 1, 2 and 1 and the additional random seed to 17, 255 and 41. Disable non-square expansion only for the rectangular input. The second version also sets disorder speed to .75, 1.625 and .3125. The totals include the original defaults, changed parameters, four formats and independent 32² fields.
|
||||
|
||||
Read the input bridge and each reachable filter's first output. At 64² in U16 the first version's two grayscale FX-Maps each match 3,935/4,096 before Distance. Their maxima are 63,743 and 65,535 levels. At 128² the maps match 15,914 and 15,823 of 16,384, both with maximum 65,535 levels. The second version's RGBA16 FX-Map is the first difference at both sizes, with 3,941/4,096 and 15,811/16,384 exact and maximum 65,535 levels. The input bridges match. Both cellular roots remain in progress.
|
||||
|
||||
### Directional distance and mask propagation
|
||||
|
||||
Directional distance matches **342,528/342,528 pixels** in 32 renders across the value and UV outputs. The maximum error is zero in all four storage formats. The previous batch matched 342,473 pixels. Its first differing buffer was the distance primitive receiving a mask with its source disconnected.
|
||||
|
||||
@@ -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 **299 Parity**, **42 In progress** and **205 Too hard**. The November 17 and 18 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)
|
||||
The first pass covered all **546 roots**, with **166 Parity** and **380 Too hard**. The current inventory has **299 Parity**, **44 In progress** and **203 Too hard**. The November 17 and 18 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)
|
||||
|
||||
[Grayscale sampler measurements](parity-fixes.md#grayscale-sampling-of-color-inputs) · [Value sampling across 240 typed comparisons](parity-fixes.md#value-processor-texture-filtering)
|
||||
|
||||
@@ -293,8 +293,8 @@ The first pass covered all **546 roots**, with **166 Parity** and **380 Too hard
|
||||
| [noise_bnw_spots_3_v2.sbs/bnw_spots_3](../assets/sbs/noise_bnw_spots_3_v2.sbs) | 0 | No | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
| [noise_cells_1.sbs/cells_1](../assets/sbs/noise_cells_1.sbs) | 0 | Yes | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
| [noise_cells_1_v2.sbs/cells_1](../assets/sbs/noise_cells_1_v2.sbs) | 0 | No | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
| [noise_cells_4.sbs/cells_4](../assets/sbs/noise_cells_4.sbs) | 1 | Yes | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
| [noise_cells_4_v2.sbs/cells_4](../assets/sbs/noise_cells_4_v2.sbs) | 1 | No | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
| [noise_cells_4.sbs/cells_4](../assets/sbs/noise_cells_4.sbs) | 1 | Yes | [In progress · 17 renders, 19,151/173,312 exact pixels](parity-fixes.md#connected-distance-sources-and-cellular-patterns) |
|
||||
| [noise_cells_4_v2.sbs/cells_4](../assets/sbs/noise_cells_4_v2.sbs) | 1 | No | [In progress · 17 renders, 15,949/173,312 exact pixels](parity-fixes.md#connected-distance-sources-and-cellular-patterns) |
|
||||
| [noise_clouds_1.sbs/clouds_1](../assets/sbs/noise_clouds_1.sbs) | 0 | Yes | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
| [noise_clouds_1_v2.sbs/clouds_1](../assets/sbs/noise_clouds_1_v2.sbs) | 0 | No | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
| [noise_clouds_2.sbs/clouds_2](../assets/sbs/noise_clouds_2.sbs) | 0 | Yes | [Too hard: remaining pixel differences](parity-fixes.md#remaining-differences) |
|
||||
|
||||
Reference in new issue
Block a user