Understanding Mesh Generation from 2D Assets
A technical overview of how a 2D PNG/SVG becomes a 3D triangle mesh: sampling, contours, triangulation, normals, watertightness, and STL output constraints.
Step-by-step
- 1
Choose a representation: silhouette vs. height field
Logos often work as “silhouette extrusion” (binary shapes). Grayscale artwork behaves like a height map (brightness → Z height), which can introduce noise if the image is not clean.
- 2
Generate an STL and inspect topology
Use the PNG / SVG → STL converter to generate an STL, then check for tiny islands, holes, and excessively dense triangle regions.
1) Sampling the 2D input
For PNG, the engine reads pixels (often in sRGB) and may normalize alpha/background. For SVG, it parses viewBox/paths and rasterizes or samples contours at a chosen density. The sampling stage decides how much detail will exist downstream.
2) From contours/height to triangles
- Silhouette extrusion: find the boundary of solid pixels, triangulate the 2D region, then extrude with side walls.
- Height field: treat brightness as height, generate a surface mesh over a grid, then add a base to make it watertight.
3) Normals, watertightness, and STL constraints
STL is triangle-only. For reliable prints, the mesh should be watertight (closed volume) and avoid self-intersections. Even if a slicer can auto-repair, clean topology reduces surprises.