Skip to content

Export a smoothed relief STL as one closed solid instead of stacked layer shells - #257

Merged
vycdev merged 6 commits into
developfrom
t3/smooth-relief-stl-solid
Nov 30, 2026
Merged

vycdev merged 6 commits into
developfrom
t3/smooth-relief-stl-solid

Conversation

@vycdev

@vycdev vycdev commented Nov 30, 2026 •

Copy link
Copy Markdown
Owner

With Smooth Meshing on, a relief STL wasn't one solid. It was every color layer's closed slab written one after another, so each layer interface kept two opposite caps in the same plane, and walls met four to an edge. PrusaSlicer reads such a file as one part per layer. The issue's 4-color image gave 90 coincident face pairs and 185 edges shared by four triangles.

Now the STL is one closed stepped solid. Smoothed relief layers carry their stack data (mask, Z range, strength), and the STL exporter builds the solid with the existing Flat Paint solid mesher. It runs over one shared outline smoothing of all layers, labeled by how many layers cover each pixel. Caps appear only on the outside, walls split wherever another face meets them, and no faces sit inside the model. Where two diagonal pixels rise above both of their neighbors and would touch only at a corner, which an STL can't keep apart, the higher neighbor is raised to bridge them. The unsmoothed STL already does the same, and it keeps the full-pixel bridges the smoothed layers had in checkered and dithered areas. Anything that isn't a smoothed relief stack of two or more layers (a single layer, masks not nested, other meshes, different transforms, non-finite heights) falls back to the old path, and so does a solid the mesher fails to build.

The preview and the 3MF are unchanged, and so is the STL with Smooth Meshing off. I first tried building the preview and 3MF layers on the shared outline too, so all three would match. It made 18× more triangles on a 256×256, 8-layer relief, so I kept this STL-only.

What changes in the print

Issue image (32×24 px, 0.1 mm/px), Aggressive Before After
PrusaSlicer --info parts 4 1
Manifold yes, per part yes
Facets 48 922
Size X × Y × Z 2.73 × 1.93 × 1.28 mm 2.80 × 2.00 × 1.28 mm
Volume 2.529 mm³ 2.686 mm³

The outline differs slightly from before and from the preview. The per-layer smoothing caps each rectangle from corner to corner, so long straight edges get pulled in by up to about 0.35 px (0.035 mm here). The shared outline keeps every boundary vertex, so straight edges stay put and only corners round. On this small image that is about 6% more volume at Medium. It is a sliver along each outline, so the share shrinks as regions get larger.

Size and time cost (Medium, Node on Apple silicon):

Relief Old STL New STL Solid build
1024×768, 16 layers, posterized 706k triangles (35 MB) 1.85M (93 MB) 3.8–5.2 s
1024×768, 16 layers, noisy photo 5.48M (274 MB) 5.74M (287 MB) 12–15 s

Tests (tests/smoothReliefStl.test.ts, new)

  • The issue's image at Minimal, Medium and Aggressive: the STL is closed, manifold, outward-facing, with no duplicate or coincident faces. It is exactly the union of its layers over the shared outline. Nothing faces down at any interface, only the exposed step faces up, and it stays within 8% of the preview's volume. The same checks show the old layers had both caps at every interface.
  • 12 seeded reliefs with cliffs, saddles, corner contacts and holes, at 0.1 and 0.4 mm/px: manifold, and exactly the union.
  • A stack that isn't nested, layers placed differently, and a single layer all fall back to writing the layers as built. A moved model keeps its place.
  • A checkerboard over a base keeps its volume within 8% of the layers' (no thin diamonds replacing the layers' full-pixel bridges). The STL also sits at the preview's corner.
  • Level counts, corner bridging (and the corners the tessellation's diamond already handles), and a saddle solid equal to its bridged layers.
  • The smoothed STL export golden is updated. Every 3MF golden is unchanged.
  • The corner repair leaves no diagonal-only contact on a 256² checkerboard and noise, and only raises counts.
  • npm test (1361 pass), lint, tsc -b, test:i18n, test:docs, test:e2e:all (all 8 suites).

No docs change: the docs already describe the STL as a single-geometry model. Changelog under Unreleased → Fixed.

Fixes #111

Council review

Rounds: 5. Only two providers are available here, so there is no third seat.

Delegate Round 1 Round 2 Round 3 Round 4 Round 5
Claude Opus 5.5 8.5/10 9/10 9/10 9/10 9/10
GPT-6.2 Sol 7/10 7/10 8/10 8/10 9/10
  • Round 1: corner contacts are bridged with full pixels everywhere, as the unsmoothed STL does (a checkerboard had lost up to half its volume to thin diamonds). A single layer keeps its exact old STL, export progress no longer jumps back, a mesher failure falls back to the old STL, and heights are checked to be finite.
  • Round 2: the corner repair works from a worklist instead of a full pass per propagation step (17.8 s → about 0.1 s on a 2048² worst case), and progress keeps moving forward after a fallback.
  • Rounds 3–4: the repair no longer queues every corner up front. It settles each row before moving on (peak queue about two rows at 8192²) and yields between rows.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

vycdev and others added 6 commits November 30, 2026 22:30
Smoothed relief layers are closed slabs, and the STL wrote them one after
another, keeping two opposite caps on every layer interface. Tag the
layers with their stack data, and have the STL exporter build one stepped
solid over a shared tessellation of the layers' coverage counts with the
Flat Paint solid mesher. Diagonal contacts the tessellation does not join
are bridged like the unsmoothed STL's heightfield. Preview and 3MF are
unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ilt, and keep export progress monotonic

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@vycdev
vycdev force-pushed the t3/smooth-relief-stl-solid branch from 2804c81 to cd8938b Compare November 30, 2026 20:35
@vycdev
vycdev merged commit 93b7135 into develop Nov 30, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant