Files
craft-libs/crates/material-graph/tests/rules/pattern_shape.tsv
T
Valentin Klein c3155aad96 Share the material graph runtime and WGSL pixel compiler (#3109)
* Extract the material graph runtime from TextureCraft

Preserve its evaluator, compiler, existing verification, and format reference from TextureCraft #777 at 22a37c29.

Original TextureCraft importer author: xilefenko (TextureCraft #521).

* Adapt graph helpers to the shared workspace lints

Preserve node evaluation and version tracking while splitting long dispatch branches. Update the EXR doctest and rule table references for the shared crate.

* Read the format reference with LF endings in its test

* Test that the format reference example reads the same with CRLF line endings

* Make the kind versions follow module attributes, arm order, raw strings, includes and the epoch

* Fix graph cache keys, publish, import and subgraph extraction; harden the graph tests

* Keep the cubic sampler from panicking on NaN texels; say what RGBE drops; check NaN halves by their bits

* Lower vector inputs of f_to_bool and f_vec to valid WGSL; tighten the FX-map error and pattern coverage tests; document clamping and the splatter data cutoff

* Say which composite glyph placements the font reader lacks; fail the y-up text test on a blank render

* Leave publish as it was; unit-test the WGSL vector lowering; document EPOCH and keep_outputs results

* Satisfy clippy in the version scanner and the WGSL lowering; compare cache hits by relation
2026-11-23 08:55:49 -05:00

132 lines
3.1 KiB
Plaintext

# Rule: the built-in fx-map patterns, at local coordinates x, y in (-1, 1] of the pattern's box, r = sqrt(x^2 + y^2),
# variation v limited to 0..1 (waves: not limited). S(t) = 3t^2 - 2t^3 on t limited to 0..1, F(t, s) = 1 - S(t/s) (0 for s <= 0).
# 0 square 1; 1 disc (r <= 1); 2 1 - r^2; 3 (1 - r^2)^4; 4 gaussian exp(-11.1 r^2) - exp(-11.1) inside the disc; 5 (1 - r)^4;
# 6 1 - max(|x|, |y|); 7 brick S((1 - |x|)/v) S((1 - |y|)/v), 1 at v = 0; 8 (x + 1)/2 (1 - v); 9 (1 - r^2) cos^2((1.5 + 6v) pi x);
# 10 (1 - r^2)^4 F(x, 1 - v) for x > 0; 11 (1 - r^2)^4 (1 - |x|)^2; 12 6.75 r^2 (1 - r^2)^2 F(x + 1, 2(1 - v));
# 13 1 - 20 d^2, d^2 = max(|x| - 0.7698 v, 0)^2 + y^2; 14 1 - r; 15 min(1, (x + 1)/2 + v); 16 min(1, sqrt(1 - r^2) + v) inside
# the disc. Negative results are 0. Outside the box (x or y <= -1 or > 1) nothing is drawn.
# Source: measurement "Fx-map drawing" ("Patterns (V)"); the gaussian: "One-effect projects" > "Node rules" and "What nodes
# hold and how they read" (exact in 16 bits).
# Tolerance: 1e-6 absolute.
# Columns: pattern = its number; x, y; variation = v; value = the pattern's value, or none outside its box.
pattern x y variation value
0 0 0 0 1
0 0.5 0 0 1
0 0.3 0.4 0.5 1
0 -0.7 0.2 1 1
0 0.9 -0.9 0.25 1
0 1 1 0.5 1
0 -1 0 0 none
1 0 0 0 1
1 0.5 0 0 1
1 0.3 0.4 0.5 1
1 -0.7 0.2 1 1
1 0.9 -0.9 0.25 0
1 1 1 0.5 0
1 -1 0 0 none
2 0 0 0 1
2 0.5 0 0 0.75
2 0.3 0.4 0.5 0.75
2 -0.7 0.2 1 0.47000003
2 0.9 -0.9 0.25 0
2 1 1 0.5 0
2 -1 0 0 none
3 0 0 0 1
3 0.5 0 0 0.31640625
3 0.3 0.4 0.5 0.31640625
3 -0.7 0.2 1 0.04879682
3 0.9 -0.9 0.25 0
3 1 1 0.5 0
3 -1 0 0 none
4 0 0 0 0.99998486
4 0.5 0 0 0.06233436
4 0.3 0.4 0.5 0.06233436
4 -0.7 0.2 1 0.0027713014
4 0.9 -0.9 0.25 0
4 1 1 0.5 0
4 -1 0 0 none
5 0 0 0 1
5 0.5 0 0 0.0625
5 0.3 0.4 0.5 0.0625
5 -0.7 0.2 1 0.005472751
5 0.9 -0.9 0.25 0
5 1 1 0.5 0
5 -1 0 0 none
6 0 0 0 1
6 0.5 0 0 0.5
6 0.3 0.4 0.5 0.6
6 -0.7 0.2 1 0.3
6 0.9 -0.9 0.25 0.100000024
6 1 1 0.5 0
6 -1 0 0 none
7 0 0 0 1
7 0.5 0 0 1
7 0.3 0.4 0.5 1
7 -0.7 0.2 1 0.19353603
7 0.9 -0.9 0.25 0.12390408
7 1 1 0.5 0
7 -1 0 0 none
8 0 0 0 0.5
8 0.5 0 0 0.75
8 0.3 0.4 0.5 0.325
8 -0.7 0.2 1 0
8 0.9 -0.9 0.25 0.7125
8 1 1 0.5 0.5
8 -1 0 0 none
9 0 0 0 1
9 0.5 0 0 0.37499997
9 0.3 0.4 0.5 0.15458034
9 -0.7 0.2 1 0.23500043
9 0.9 -0.9 0.25 0
9 1 1 0.5 0
9 -1 0 0 none
10 0 0 0 1
10 0.5 0 0 0.15820313
10 0.3 0.4 0.5 0.111375
10 -0.7 0.2 1 0.04879682
10 0.9 -0.9 0.25 0
10 1 1 0.5 0
10 -1 0 0 none
11 0 0 0 1
11 0.5 0 0 0.07910156
11 0.3 0.4 0.5 0.15503906
11 -0.7 0.2 1 0.004391714
11 0.9 -0.9 0.25 0
11 1 1 0.5 0
11 -1 0 0 none
12 0 0 0 0
12 0.5 0 0 0.14831543
12 0.3 0.4 0.5 0
12 -0.7 0.2 1 0
12 0.9 -0.9 0.25 0
12 1 1 0.5 0
12 -1 0 0 none
13 0 0 0 1
13 0.5 0 0 0
13 0.3 0.4 0.5 0
13 -0.7 0.2 1 0.19999987
13 0.9 -0.9 0.25 0
13 1 1 0.5 0
13 -1 0 0 none
14 0 0 0 1
14 0.5 0 0 0.5
14 0.3 0.4 0.5 0.5
14 -0.7 0.2 1 0.27198905
14 0.9 -0.9 0.25 0
14 1 1 0.5 0
14 -1 0 0 none
15 0 0 0 0.5
15 0.5 0 0 0.75
15 0.3 0.4 0.5 1
15 -0.7 0.2 1 1
15 0.9 -0.9 0.25 1
15 1 1 0.5 1
15 -1 0 0 none
16 0 0 0 1
16 0.5 0 0 0.8660254
16 0.3 0.4 0.5 1
16 -0.7 0.2 1 1
16 0.9 -0.9 0.25 0
16 1 1 0.5 0
16 -1 0 0 none