Commit Graph
58 Commits
Author SHA1 Message Date
chasse20 442edf310a Auto: Integrate main and preserve generator review repairs 2026-11-15 19:26:39 +00:00
chasse20 6825aac7e4 Auto: Integrate main and reduce compositor buffer lifetimes
Preserve filter lookahead alongside main image-cache invalidation and input
bounds. Move HeldFields into its own module and finish scoped cleanup.
Charge repeated USD path names before allocating retained strings.
Reuse the blur transpose-back buffer and release scattered texels before
allocating filter temporaries.

Validated compose/engine release tests, Clippy, layering, wasm and formatting.
2026-11-15 07:14:57 +00:00
chasse20 7bfcf3fc27 Auto: Integrate main and reuse decoded material maps
Preserve main's decoder, atomic-save, material-payload, and USDC limits.
Bound material reads by the remaining payload budget and trim retained
buffers. Replace quadratic image-name searches with map lookups, and
cache validated linked-material maps before synchronization so they
are not decoded twice.

Add import/undo/redo and payload-boundary regressions, extract
ImageIdentity, remove the unchecked scratch example, and complete
scoped cleanup. Correct the integrated style guide's product name.

Validated 546 release tests, Clippy, layering, wasm, formatting, and
focused allocation and lifetime probes.
2026-11-15 04:16:43 +00:00
Morion 74d213272d Release kept filter fields when a stroke begins during a sliced pass (#475)
Fields kept for the coming composites stayed allocated for as long as a
stroke lasted while tiles still followed, because the end-of-pass cleanup only
runs when none do. A stroke already kept them from being used; now it also
drops them. The test keeps fields first, then starts the stroke.
2026-11-13 14:20:27 -05:00
Morion 1a742d3fa4 Frame-sliced recomposites filter a run of tiles once (#475)
A stack with a neighbourhood filter (blur, high pass, bevel, glow...) made a
recomposite spread over frames many times slower than the same recomposite in
one call: every chunk filtered its own surroundings again, and on a machine
with many threads the filter's per-texel parallel steps cost more to hand out
than to run on a region of a few tiles.

- Neighbourhood filters split their per-texel work into tasks of at least
  16384 texels. Each texel is computed on its own, so results do not change.
- Session::update_for tells the compositor which dirty tiles follow the chunk
  in its block (up to 64). The compositor filters the chunk and those tiles at
  once and keeps the fields for the composites that follow, compared by
  everything the stack reads, and drops them at the end of the pass, after an
  edit, and under a live stroke.

Results are identical to the one-call composite: tests cover cold, warm and
partly evicted hot-layer caches, an edit mid-pass and a live stroke.
perf::bench_sliced_filters_4k times both paths.
2026-11-13 12:38:58 -05:00
Morion d5675e090b Keep cached layer composites across unrelated image imports 2026-11-13 09:38:39 -05:00
Morion Tutoriales b982d66008 fix(compose): retain curvature cache layout variants (#459) 2026-11-13 08:28:43 +01:00
Rebornim 7bd6c0ef2b Generators: global adjustments, output resolution and image inputs
- Global blur, balance and contrast on every generator (GeneratorGlobal).
  The blur blurs only the generator's own value, up to a 64-texel radius
  at 2K, weighted by mesh coverage; balance picks the input range that is
  stretched to 0..1 and contrast narrows it; invert stays last.
- Output resolution (OutputResolution, ResolutionMode): Auto or UV tile,
  Texture set or a custom size, times a factor from 1/8 to x8, never
  coarser than one value per 64 texels. Below the UV tile's resolution
  the generator is averaged over cells and read back bilinearly.
- Image inputs: each mesh map a generator reads can read an image, a
  uniform value or an anchor point instead. Generator inputs count as
  anchor and image readers (compositing order, paste, remove unused).
- Blur and resolution run as a neighbourhood stage of the mask, listed
  the same way by every caller and only in masks.
- Commands: blur, balance, contrast, resolution, customResolution,
  resolutionFactor on effect.add.generator / effect.set, and input with
  inputImage / inputValue / inputAnchor / inputBaked on effect.set.

New fields are skipped when they hold their defaults and neutral settings
return the value untouched, so saved projects load, save and render as
before.
2026-11-12 04:39:32 +00:00
BFlat b1806e4010 Merge pull request #231 from vangel76/fix/217-generator-offset
Add an offset slider to mesh-map generators
2026-11-12 08:52:04 +07:00
chasse20 77a03ddcb3 Merge main and fix decal placement and input handling 2026-11-10 18:29:43 -05:00
Chris Hassebrook d664dc239c Revert "Show a whole material at once: coarse first look, then the exact result" 2026-11-10 16:08:27 -05:00
Chris Hassebrook 783cbdcb27 Merge pull request #381 from SteamSmith/perf/material-loading
Show a whole material at once: coarse first look, then the exact result
2026-11-10 16:07:09 -05:00
FredApps 26ddc8c256 Merge main and keep nested thumbnail controls accessible 2026-11-10 20:10:52 +01:00
SteamSmithandClaude Sonnet 5.5 208c645d0c Show a whole material at once: coarse first look, then the exact result
Applying a material filled the model in tile by tile, and each apply made the
next one slower. Now:
- a big recomposite first draws a coarse look of every tile (sampled texels
  repeated across blocks), then refines to the exact result;
- layers hidden behind an opaque layer are skipped (not when anchors or height
  masks are involved);
- compositing and upload budgets adapt: larger when idle, smaller while the
  user is interacting, and uploads reserve time for conversion;
- no coarse pass during a live stroke or with neighbourhood filters;
- blending at full weight returns the blended value exactly.

Tests: coarse-then-exact, hidden-layer culling gives identical pixels, coarse
pass covers every tile, no coarse pass while a stroke is live.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 06:40:11 -05:00
chasse20 2d0b8e6a48 Fix thumbnail previews and cache retention 2026-11-10 06:37:12 -05:00
chasse20 368731f7a4 Fix Clippy checks and clean up affected functions 2026-11-10 05:33:20 -05:00
MistyMystery 424ab64ce8 Merge upstream main into layers-panel-redesign 2026-11-09 23:54:51 +04:00
vangel76andClaude Opus 5.5 df86375a16 Merge upstream/main into fix/clippy-chunks-exact-to-as-chunks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 12:18:59 +01:00
vangel76andClaude Opus 5.5 07e94e1c86 Merge upstream/main into fix/217-generator-offset
Keep the curvature mode and detail sizes from upstream and route the
finished generator value through Generator::shape so the offset applies
to every generator kind. A non-finite offset now counts as 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 09:18:34 +01:00
Chris Hassebrook e8145421c3 Fix curvature detail handling and merge main 2026-11-08 07:31:13 +00:00
vangel76andClaude Opus 5.5 6c3e2f9625 Merge upstream/main into fix/217-generator-offset
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-08 08:17:31 +01:00
Rebornim cbe3c86acb Curvature detail: full-strength block borders, neutral raw curvature, stricter sizes
Divide each blurred detail size by the share of the blur window inside its
UV tile block, so texels near a block or map edge keep their strength
instead of fading toward zero. Raw mode reads mid gray when there is no
curvature to sample. The size cache keeps one layout per curvature map.
Mask previews of hidden layers build their sizes once before the tiles run
in parallel. effect.set rejects a sizes array with a non-numeric entry.
2026-11-08 01:38:20 +00:00
vangel76 d8ecfb7d42 Merge upstream/main into fix/clippy-chunks-exact-to-as-chunks 2026-11-08 02:27:35 +01:00
Rebornim 508c4bb2aa Keep the click that dismisses the image drop menu from painting
The views don't paint while a dropped image waits for its menu pick, so a click
on the mesh outside the menu only closes it. Also document Texel::source and
DecalDrop::menu_id.
2026-11-08 00:11:02 +00:00
Rebornim 1a0fc5fec8 Curvature detail: build only the sizes in use, map coverage on all cores 2026-11-08 00:10:40 +00:00
Rebornim 906dcf324e Curvature detail: name the tuned weights, clean up the effect plans and blur 2026-11-08 00:10:40 +00:00
Rebornim a1d010ccb2 Curvature generators: mode and detail sizes
Curvature and edge wear generators read the baked curvature map one
texel at a time, so they only marked the sharpest edges. They now take a
mode (edges, cavities, both, raw) and seven detail size weights: the map
itself and the map blurred at 1 to 32 texels at 2K, padded past the UV
islands and built once per map and layout. Each size's edges and
cavities combine like a screen blend.

New curvature and edge wear generators use detail sizes. Generators saved
without them, and smart masks, read the map exactly as before.
2026-11-08 00:10:40 +00:00
Rebornim c827d1b910 Drop a shelf image on the texture set under the cursor, as a channel or a mask
An image dragged over the 3D view highlights the texture set under the
cursor, as materials do. A drop opens a menu at the drop point: Mask, then
that set's channels. A pick selects the set and places the decal there
with the image in the picked channel, or as the gray mask of a new fill
layer. A click elsewhere places nothing; the background opens no menu.

layer.add.decal takes channel (a channel id, default baseColor, or
"mask") and adds the decal to the set under the point, selecting it, as
one undo step. layer.decal.set takes effect to edit a mask decal, so the
view's frame and handles work on it too, and a new image stays in the
channel the decal was placed in. One-value channels and masks read an
image's gray instead of its red.
2026-11-08 00:10:09 +00:00
Chris Hassebrook 30414caa6b Merge pull request #298 from Rebornim/feat/mask-filter-chain
Masks and content stacks run every neighbourhood filter
2026-11-06 10:40:45 -05:00
RebornimandClaude Opus 5.5 f6b2010109 Run every neighbourhood filter of a mask or content stack
Only the last neighbourhood filter of a stack ran; any below it was
skipped silently, so Blur then Warp gave the same result as Warp alone.
field() now runs each one in turn, continuing from the previous field,
over a region widened by what the filters above it read. Stacks with a
single neighbourhood filter are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 06:46:26 +00:00
chasse20 747068dbdf Fix bake settings and UV tile controls 2026-11-05 22:39:42 -05:00
chasse20 476d5ecc8b Guard preview inputs and optimize sparse mask reads 2026-11-05 18:54:07 -05:00
RebornimandClaude Opus 5.5 adcc43b077 Smart mask previews that show the mask
Shelf thumbnails now show each smart mask applied with mask.smart.apply to a
baked preview shape (geom::primitives::preview_orb) and read back from the
compositor (compose::mask_at, a sparse read sharing mask_image's per-tile
code), shaded flat white over a softly lit near-black surface. The shape bakes
once on a worker; preview::smart_mask's world-noise approximation is removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-05 20:44:48 +00:00
MistyMystery 11d889dbf5 Redesign the Layers panel rows with live thumbnails
Layer rows are 48 points tall with alternating shades, hover, an accent edge on the selected
row and a divider under each layer. Each row shows its content thumbnail (the layer's own result
in the displayed channel) and its mask thumbnail, each selectable on its own; a subtitle names
the layer type and effect count; blend mode and opacity stack on the right. Effects hang under
their layer on tree lines in "Content effects" and "Mask effects" groups that fold without
touching the document, each with a thumbnail of the stack up to and including it (a hidden
effect shows what it bypasses, struck through). Folder contents indent with lines.

Paint and fill thumbnails show their own coverage over a checkerboard; folders composite their
children. Every size derives from layer_panel::layer_preview_size, so a preview size setting
plugs in there. New strings are translated in every shipped language.
2026-11-05 06:53:21 +04:00
MistyMystery d4ea67703d Add an asynchronous thumbnail service for layer contents, masks and effect stages
The compositor renders a one-layer cut of the stack at 64 px (content in a channel, mask, or
the stack up to an effect); the engine keeps an immutable snapshot, a worker thread, an LRU
cache and stale-result rejection.
2026-11-05 06:53:21 +04:00
vangel76andClaude Sonnet 5.5 81281c1a0a Merge upstream/main into fix/clippy-chunks-exact-to-as-chunks
Upstream removed bake/maps.rs, engine/tests/auto_rebake.rs and read_skew
(moved elsewhere); take the deletions. Convert two new chunks_exact uses in
bake/test/setting.rs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-05 00:06:23 +01:00
chasse20 18a3c98176 Implement clean-room bake settings and improve map accuracy 2026-11-04 03:57:46 -05:00
vangel76andClaude Sonnet 5.5 715baf4760 Use as_chunks where the chunk size is a constant
Clippy 1.99 flags chunks_exact and chunks_exact_mut with a constant
chunk size (chunks_exact_to_as_chunks). Switch those call sites to
as_chunks / as_chunks_mut. Behaviour is unchanged: the trailing partial
chunk was already dropped.

Fixes #233

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 01:36:12 +01:00
vangel76andClaude Sonnet 5.5 e59bf5569e Add an offset to mesh-map generators
The generator panel had level, softness and noise but no way to lift or lower the finished mask. The new offset is added to the result and clamped to 0..1. The thresholding now lives in Generator::shape, shared by the compositor and the preview.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 23:36:50 +01:00
bflatastic 6dabe66324 Filter radii and height slopes follow each UV tile's own resolution
A UV tile with a lower resolution than its atlas block fills the block's
corner, so it has fewer texels per UV unit. Neighbourhood filters (blur,
sharpen, warps, bevel, glow, ...) and height-to-normal slopes used the block's
texel density for every tile, so such a tile blurred twice as wide and showed
twice as steep slopes in UV space.

TextureSet::block_scales gives each block's share; the compositor filters each
block at its tile's radius, texture export and the CPU path tracer scale the
slope by it, and the display packs it into the Extra texture's alpha for the
viewport and GPU path tracer shaders (parallax too).
2026-11-02 21:08:35 +07:00
bflatastic fe02cd266d Fill normal images can be marked DirectX: their green flips where a normal channel samples them 2026-11-02 17:52:31 +07:00
Justin JohnandClaude Opus 5.5 07b5aaa0c1 Make paths non-destructive with path sublayers (#113)
Committed paths are stored in a new path sublayer (EffectKind::Path) on the
layer content or mask and the sublayer is repainted from its paths whenever one
is added, edited or removed. path.edit loads a path (with its brush and
material) into the Path tool; changes repaint live as one merged undo step.
path.remove deletes one. Manual strokes are refused on path sublayers, so they
can't be painted over by accident. The sublayer properties list its paths.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 10:30:59 +05:30
bflatastic 332cfa4070 Levels histogram: bound the neighbourhood work under a filter
A neighbourhood field covers the bounding box of its tiles, and a
scattered sample spans the whole set, so on an 8K set a blur below the
levels effect evaluated everything. With such a filter below, each
sampled tile now builds its own field.
2026-11-02 10:00:24 +07:00
bflatastic 83b8a13131 Levels histogram: sample every column, and read masks of empty layers
An odd tile stride: a power of two divides the row length on
power-of-two sets and read the same few columns. A mask is planned on
its own, so a paint layer with nothing painted still shows its mask's
histogram.
2026-11-02 09:44:28 +07:00
bflatastic d736ffa9af Levels: a histogram of what the effect reads
The Levels effect's properties now show a histogram of its input, the
mask below it or (on layer content) a channel picked above it, with the
input range marked. effect.histogram {effect, channel?, bins?} gives
agents the same counts. Large sets are sampled (at most 256 tiles), so
the cost stays flat up to 8K.
2026-11-02 09:23:59 +07:00
bflatastic 3fea0f6c62 Materials: twill for denim and carbon fiber, a pile for velvet
Carbon Fiber, Fabric Cotton, Denim and Velvet were all the same plain
weave in different colours. A new Twill weave pattern (2/2: diagonal
ribs, the weft darker than the warp) now gives Denim its diagonal and
Carbon Fiber its light and dark tows under a clear coat; Velvet is a
soft pile with no weave under its sheen; Fabric Cotton keeps the plain
weave. Twill weave is also a fill pattern, translated into all nine
other UI languages.

Fixes #97.
2026-11-02 07:53:46 +07:00
bflatastic 056a089551 Viewport: show the baked normal map
The viewport's normal texture held only the painted Normal channel, so
a baked normal map changed the export but not the view. Display tiles
now re-orient the painted normal onto the baked one, as export does
(core::blend::rnm, now public).

Fixes #54.
2026-11-02 06:11:11 +07:00
bflatastic 56a3a655ee Replace Color filter
Colors near a chosen color shift towards a new one, keeping their shading and texture.
27 -> 28 library filters.

- Filter::ReplaceColor {from, to, tolerance, softness}: each color within the tolerance (RGB
  distance 0..1) moves by to - from, fading out over the softness (smoothstep); far colors and
  scalar channels are untouched; content only (Adjustments)
- effect.add.filter / effect.set take from and to as linear RGB or "#rrggbb"; Properties has a
  swatch per color and the two sliders; translations in all eight UI languages
- tests: near, far and halfway colors, scalars; the engine filter library test adds it
2026-11-01 16:57:50 +07:00
bflatastic e56022230b Geometry masks: layers on chosen mesh parts
A layer or folder can show only on the mesh parts you pick: right-click a layer > Geometry mask
lists the parts of its texture set as checkboxes; Show on all parts clears it.

- Layer.geometry_mask (part names, serde default); the compositor zeroes the layer's mask on
  texels whose triangle (UV G-buffer) lies in another part, so it combines with painted masks,
  mask with height, folders and anchors; an instance keeps its own
- layer.set {geometryMask: [names] | null} (unknown parts refused), textureSet.parts {ts?};
  inspect shows geometryMask per layer and parts per set
- translations for the menu labels in all eight UI languages
- tests: compositor split of one material into two parts; engine commands on a two-object OBJ
  (parts, masked composite, refused input, inspect, undo, clear)
2026-11-01 14:00:16 +07:00
bflatastic 5dd12041c8 Baked Lighting filter
Paints a light into the base color for hand-painted and mobile looks: base color x (ambient x
ambient occlusion + light x max(n.l, 0)) on the mesh normals, with the light set by azimuth and
elevation. 26 -> 27 library filters.

- Filter::BakedLighting {azimuth, elevation, light, ambient, occlusion} and baked_light()
- the compositor reads the texel's normal and the baked AO (none baked: no occlusion) and
  lights the base color only; content only (Adjustments)
- effect.add.filter / effect.set / filter.list; property sliders; translations in all eight UI
  languages
- tests: lit from the normal side the color stays, from behind only ambient remains, roughness
  untouched; occlusion weighting
2026-11-01 13:15:47 +07:00