Skip to content

Feature: give each color region its own filament stack #151

Done

Description

@vycdev

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

Proposal

  1. 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.
  2. 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.
  3. 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.
  4. 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/docs explain when to use it and what it costs in tool changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions