Vertex Optimization Engine Update
We shipped an edge-aware vertex optimization pass that reduces STL size and improves slicer stability without changing the visible silhouette.
Highlights
- Edge-aware vertex welding: merges near-duplicate vertices while preserving sharp boundaries.
- Degenerate triangle culling: removes zero-area faces that can confuse some slicers.
- Deterministic output ordering: repeated conversions produce stable topology and byte-level reproducible STL streams.
Algorithm details
Edge-aware welding (why it’s safe)
Classic “weld” can destroy sharp corners if it merges across boundaries. Our pass uses edge signals to keep silhouette-critical vertices stable while still merging near-duplicates on flat regions.
- Boundary preservation: vertices near sharp angle changes are protected from cross-edge welding.
- Epsilon-based grouping: near-duplicate vertices are grouped spatially to reduce redundant points.
Degenerate culling
Zero-area (or near-zero) triangles can appear from noisy inputs, contour self-touch, or numerical edge cases. Removing them reduces slicer warnings and prevents weird “missing layer” artifacts.
Deterministic ordering
We sort vertices/faces into a stable order so the same input produces the same STL stream. This makes caching, debugging, and regression testing significantly easier.
convert(input) → stl_A
convert(input) → stl_B
# with deterministic ordering:
hash(stl_A) == hash(stl_B) ✅What changed in the pipeline
This release adds a post-mesh optimization stage that runs after raster/vector sampling and mesh generation, but before STL serialization.
input (PNG/SVG)
→ normalize (colorspace / alpha / viewBox)
→ sample (height field / contours)
→ mesh generation (triangulation)
→ vertex optimization (weld + cull + ordering) ← NEW
→ STL serialization (stream)Impact
- Smaller STL files: fewer redundant vertices and faces means faster uploads and faster slicing.
- Cleaner geometry for downstream tools: reduced chance of warnings like “degenerate facets” in slicers.
- No UX changes: the tool UI stays the same; improvements are internal.
What this does NOT do
- It won’t magically smooth a noisy PNG edge — clean the 2D input first.
- It’s not a general-purpose decimator — for polygon strategy, follow Optimize polygon count.
- If your mesh is non-manifold, start with the fix guide: Fix non-manifold STL.
Convert a clean, high-contrast PNG with sharp edges to see the best effect. Use the PNG / SVG → STL converter.