Repository navigation
Description
Summary
Add an opt-in Auto-paint option, off by default, that lets each color region use its own filament stack instead of the first N layers of one shared sequence. Regions could then be built on the same layers with different filaments, and each region only prints the layers its own color needs.
It works for normal relief and for Flat Paint. Flat Paint benefits as a side effect: its slab only needs to be as tall as the tallest region's own stack.
The problem today
Auto-paint picks one filament sequence for the whole print, and every region gets the first N layers of it. Flat Paint keeps that rule: it takes each region's layer count, reverses the column (face-down) or keeps its order (face-up), and fills the rest with foundation (src/lib/flatPaint.ts).
That has a cost when only a small part of the image needs something unusual:
- If one pixel or one small patch needs a color that only a long stack can make, the shared sequence has to include that stack. Every region that sits higher in the sequence then prints those extra layers too, even though they don't need them.
- Two patches that need unrelated stacks can't be built at the same time on the same layers. One of them has to go first in the sequence.
- In Flat Paint, the slab thickness is set by the tallest column of that shared sequence, so one demanding patch makes the whole slab thicker and adds foundation backing behind every shorter region.
Related work
- Multi-head mode (Request: multi-head printing? #30, Feature: multi-head calibration #58, merged in Multi-head 1/7: 3MF export and combined-mask meshing #96–Multi-head 4/7: head schedule and plan conversion #99) already lets regions use different filaments on the same layer. It works inside the existing sequence: run thicknesses stay fixed and it only changes which filament each region uses inside a window. It never makes a print thinner, and it can't be combined with Flat Paint.
- Flat mode #13 Flat mode is the current Flat Paint, which allows several filaments per layer but still uses the shared sequence.
Proposal
- Choose a stack per region. For each target color, pick the best stack from the short stacks the loaded filaments can make, scored with the same appearance model and CIEDE2000 error as today. Each region is a small search that doesn't depend on the others, so this does not have to make Auto-paint much slower.
- Pack the stacks into layers. Align the stacks to the layer height and first-layer height, the same way the current layer snapping does. In relief, each region's column ends at its own stack's height. In Flat Paint, fill each column with foundation (face-up: below; face-down: behind) so all stacks end at the same height and every layer still covers the whole footprint. The slab is as tall as the tallest stack actually used.
- Limit the work per layer. Every extra filament on a layer is another tool change, which means a purge on a single-nozzle AMS or CFS. Add a cap such as "at most K filaments per layer", or a small cost for each filament added to a layer, so the optimizer only splits regions when the color gain is worth it. Show the estimated number of tool changes.
- Export. One 3MF object per physical filament, with physical filament colors, as Flat Paint does today.
A cheaper first step
Keep a shared foundation and lower layers, and let regions split only in the top few layers, where the visible color is mostly decided. This is close to how multi-head windows work, but without fixed run thicknesses and with Flat Paint allowed. It limits both the search and the extra tool changes.
Constraints
- Opt-in. Off by default; the shared-sequence behavior stays unchanged when it is off.
- Multi-material only. Several filaments on one layer need an AMS, CFS, or toolchanger. Manual filament swaps can't do it.
- Printability first. A region with its own stack becomes a column in a filament that its neighbors don't use. Tiny islands (a pixel or a few) may not print cleanly, so this needs a minimum region size, similar to "Omit isolated color specks", or a fallback that merges small regions into a neighbor's stack.
- Topology. Separate stacks next to each other create more shared side walls. They must stay closed and manifold, with no T-junctions or overlaps. Reuse the topology checks in the mesh and 3MF regression tests, and keep Smooth Meshing working.
- Deterministic. The same image and settings give the same stacks.
- Relief print instructions. In relief, a layer can hold several filaments, so the manual swap list no longer applies. Print instructions need the multi-material guidance Flat Paint already uses.
Open questions
- How should it relate to multi-head routing: replace it, extend it, or stay separate?
- How should regions be grouped? Per palette color, per connected area, or per merged color group like the multi-head "Color grouping" options?
- How much thinner do real images get, and how much does color error drop? Measure model height and tool changes on the existing fixtures before and after, in relief and Flat Paint.
- How do layer cuts in Layer Preview and the print instructions show a layer that has many filaments on it?
Done when
- Auto-paint has an opt-in option that gives each region its own stack, with a per-layer filament cap, in both relief and Flat Paint.
- On the test fixtures, the model is thinner or the color error is lower than the shared sequence with the same filaments, and the tool-change count is reported.
- The mesh and 3MF regression tests cover regions with different stacks next to each other.
- The docs in
src/docsexplain when to use it and what it costs in tool changes.
Activity
Address council review of per-region stacks (#151)
Address council round 2 on per-region stacks (#151)
Address council round 3 on per-region stacks (#151)
Address council round 4 on per-region stacks (#151)
Address council round 5 on per-region stacks (#151)
Key the region stack optics cache unambiguously (#151)
Cut long shared prefixes to their visible top (#151)
Keep separated colors apart with per-region stacks (#151)
Keep invisibly worse stacks looking like their old color (#151)
Merge pull request #223 from vycdev/feat/issue-151-region-stacks
Plan per-region filament stacks for Auto-paint (vycdev#151)
Lay out per-region stacks for relief and Flat Paint (vycdev#151)
Add the Per-region stacks option to Auto-paint (vycdev#151)
vycdev commentedon Nov 28, 2026
Fixed on develop by #223. It ships in the next release.