The W3C color-dodge formula keeps a black background black even under a
white foreground, and color-burn keeps a white background white even
under a black foreground. blend_channel checked the foreground first, so
both edge cases came out inverted.
Fixes#135
A hostile file or binding could supply an out-of-range enum or degenerate-range numeric value that reaches a cook unclamped, breaking the hard-limits guarantee for node parameters.
Make clamp_params bound enum values even with no options and bound numeric values even when min is not below max, using the same hard-span limits as other parameters.
Test: clamp_params_bounds_enum_without_options failed before the change and passes after.
Co-authored-by: eliets2 <287273517+eliets2@users.noreply.github.com>
Co-authored-by: FredApps <153173854+FredApps@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Replace the legacy Rust procedural library with clean-room native primitives, typed function execution and FX-Map graphs. Save supported content as native SBS and organize the model, evaluators, codecs and editors into focused modules.
Add shared graph editing behavior, flat filtered node menus, frame and comment editing, named Explorer outputs and an original atomic sample. Document the tested scope and remaining interoperability work.
Restore tracked files to 91bb53f07a, immediately before the batch, at the maintainer request. Preserve the existing history and earlier work, including PR #38. Revert the 50 reviewed PR merges and the version bump in 441092c. The published 0.1.2 release is unchanged.
Upstream's ResourceBytes and decode limits kept; decode keeps the linear flag, and the
decoded-image memo is now keyed by (content hash, linear) so sRGB and data reads of the
same file don't collide.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Kept this PR's O(1) horizontal Gaussian and upstream's non-finite sigma guard; dropped
upstream's pass/kernel caps, which the single pass makes redundant.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The multigrid solve divided the slope divergence by the level's scale where it
must multiply (one coarse pixel spans `scale` full-size pixels), so the coarse
levels contributed almost nothing and the broad shape was lost. A Gaussian bump
round-tripped through Height to Normal now correlates 0.99+ at 256 and 1024 px
(0.86 at 256 before).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
resolve_params only checked types, so a hand-edited file, a binding to an
exposed input or a dynamic function could pass any float or int to a cook
(including NaN and 1e30). Clamp Float, Int and Float2 parameters to the
declared min/max in resolve_params (new clamp_params; non-finite values fall
back to the default; angles are left alone) and again in eval after bindings
and functions have run.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Each used one noise period for both axes while the cell counts differed per
axis, leaving a seam. Add noise::value_xy (separate period per axis) and use
whole-number cell counts. The noises_tile test now checks the top/bottom edge
too, compares against the mean neighbour difference, and covers the three nodes.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
decode() sRGB-decoded every 8/16-bit color bitmap, so an RGB normal map
(0.5, 0.5, 1) became (0.214, 0.214, 1). decode now takes a linear flag. The
Bitmap node gets a Color space choice (sRGB by default, so existing files cook
the same) and graph input preview images can be bound as linear data maps
(graph.input.bind linear: true, stored in input_images_linear).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The grid-bin span was unbounded, so a large size or length visited billions of
bins per item, and Splatter also scanned each bin with contains. Cap the span
to one turn of bins per axis (as fx_map does), drop the contains scan, and
clamp Splatter's count to its declared maximum of 2000.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
blur_xy made ceil(extra/2) full-image passes with an unclamped sigma, so a
large intensity at high resolution took ~1e11 ops and a hostile one never
ended. Clamp both sigmas to the image size and do the extra horizontal blur
as one Gaussian (new ops::gaussian_h, three box passes, O(1) per pixel).
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Selecting a Levels node now shows a visual editor above its sliders: a
histogram of the node's input (256 bins; red, green and blue overlaid for a
color input; scaled to the tallest bin between pure black and white) with
the clipped ranges shaded and the levels transfer curve on top, draggable
input low/mid/high handles under it and output low/high handles under a
black-to-white bar.
Fixes in how Levels is edited: Level in mid is relative to the input range,
and its handle now sits where it acts and moves with the range; the input
low and high handles cannot cross. Parameters bound to inputs or driven by
functions keep their handles locked. Every drag is a graph.node.param
command, one undo step per handle. levels_fn no longer propagates NaN.
Tests cover the histogram, the handle constraints and the remap math; the
snapshots UI test renders the editor. Documented in docs/levels-editor.md.
Clean-room implementation.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clean-room implementations, all tileable when they generate:
- fx_map (Atomic): grid / random / random-quadtree instancer of up to three
patterns with scale, rotation, position and luminance jitter and Max / Add /
Alpha-over blending, on a shared binned splatting engine.
- svg (Atomic): SVG path data parser (M L H V C S Q T Z, absolute and relative,
errors instead of panics) with even-odd / non-zero fill (exact horizontal
coverage on 4 sub-scanlines) and anti-aliased stroke.
- text (Atomic): original single-stroke vector font rendered as capsules,
with alignment, spacing, multi-line, rotation and edge wrapping.
- perlin_noise_3d, worley_noise_3d (periodic 3D lattice, z scrubs) and
simplex_noise_3d (4D simplex on a flat torus).
- shape_splatter, paint_strokes, scratches_generator, cracks, rust, moss,
leaks, edge_damage, tile_random, ambient_occlusion_fast,
normal_from_height_hq, histogram_select, quantize_color, pixelate_color.
Every new node cooks under 100 ms at 1024x1024 in release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clean-room implementations from public algorithms, all tileable and size-independent:
- Filters/Flood fill: tile-wrapping connected-component labeling into an index map, plus
random grayscale/color, gradient, bbox size, position and sample-at-center nodes.
- Noises: value, ridged/voronoi/cells fractals, directional, fibers, messy fibers, leather,
microscope, gaussian spots, crackle, sand dunes, wood grain, marble, stones, ripples,
concrete, bark (per-axis lattice periods keep stretched noise seamless).
- Patterns: grid lines, dots, diamonds, herringbone, basketweave, chevron, fish scales,
triangles, spiral, rings, axial/circular gradients, cross, rounded rectangle, ring,
arc pavement, octagon tiles, planks, tread plate.
- Filters: remap, smoothstep, S-curve, per-channel levels/auto levels/invert/clamp, color
variation (per flood fill region), lerp and two-input math, median, unsharp mask, Sobel,
outer glow, inner/drop shadow, curvature from height, outline, whiteout normal combine,
normal rotate, Sobel normals.
- Material filters: material blend and height blend (renormalized normals), edge wear,
dirt and dust masks, base color adjust, measured metal base colors.
Tests: flood fill labeling and edge wrap, material blend picks material 2, pattern tiling,
new ids in the noise tiling test; catalog now has 203 nodes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The egui front end in its own crate: docked explorer, library with live node
previews, the node graph editor (thumbnails, typed ports, wiring, box select,
frames, comments, pins, node search, library drag and drop), properties with
curve and gradient editors, 2D view and a CPU PBR 3D preview with parallax
and image-based lighting. Every edit is an engine command; the control channel
adds synthetic mouse/keyboard input for agents. Adds the MCP server, the
JSON-lines RPC, the headless CLI (render, cook, export, run, batch, mcp, serve),
the desktop app, an original placeholder icon and an offscreen snapshot test.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A clean-room, pure-Rust foundation for MaterialCraft's node-based material
authoring: the package/graph/node model, float image planes, the node
library (atomic nodes, tileable noises, patterns, filters, PBR utilities,
function graphs for the pixel processor), a content-addressed cooking cache,
.mcraft packages and texture export, and the command-driven session with
snapshot undo. Infrastructure (xtask, CI, packaging) copied from TextureCraft.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>