3D Scan to glTF: Decimation and Retopology
Transforming dense, millions-of-polygons raw 3D scans into optimized glTF models requires a structured decimation and retopology pipeline to balance visual fidelity with real-time performance. This guide outlines industry-standard workflows for preparing photogrammetry and LiDAR data for WebGL and real-time engines, detailing automated and manual retopology paths, UV unwrapping, high-to-low poly texture baking, and final glTF export optimization.
1. Pre-Processing and Initial Decimation
Raw scan data—whether from photogrammetry software like RealityCapture or laser scanners—often contains noise, non-manifold geometry, and tens of millions of micro-triangles.
- Cleanup: Load the raw mesh into software such as MeshLab, Blender, or ZBrush. Remove disconnected floating vertices, non-manifold edges, and internal geometry.
- First-Pass Decimation: Reduce the raw scan from 20–50 million polygons down to a workable high-poly reference of 1 to 3 million polygons. Algorithms like Quadric Edge Collapse Decimation (available in MeshLab and Blender) preserve silhouette and curvature while making the mesh responsive enough for downstream retopology tools.
2. Choosing a Retopology Approach
Depending on the intended use case of the glTF asset, choose between an automated pipeline or a manual pipeline:
Pipeline A: Automated Retopology (Static Props and Rapid Production)
Best for static environmental props, e-commerce products, and background assets where edge flow is secondary to fast turnaround and clean geometry.
- Auto-Remeshing: Use tools like QuadRemesher (Exoside), ZBrush (ZRemesher), or Instant Meshes. Set your target polygon count based on platform constraints (typically 5,000 to 50,000 triangles for real-time glTF).
- Feature Preservation: Use vertex painting, polygroups, or guide curves to instruct the algorithm to respect hard mechanical edges, holes, and sharp silhouettes.
- Triangulation Check: glTF natively uses triangular meshes. Ensure the resulting quads can be triangulated cleanly without creating planar artifacts or non-planar polygons.
Pipeline B: Manual Retopology (Hero Assets and Deformable Meshes)
Essential for characters, rigged models, or assets requiring precise silhouette control and maximum polygon efficiency.
- Snap-to-Surface Topology: Import the decimated high-poly reference into Blender (Poly Build/Shrinkwrap), Maya (Quad Draw), or Topogun.
- Edge Flow: Draw topology manually along deformation zones (such as joints) and high-curvature areas.
- Budget Allocation: Allocate the highest density of polygons to the outer silhouettes and interactive focal points, drastically reducing geometry on flat surfaces.
3. UV Unwrapping and Packing
A clean UV layout is critical to prevent texture seam artifacts and wasted texture space in real-time viewers:
- Seam Placement: Place seams in natural crevices or non-visible areas to minimize visible texture borders.
- Unwrap: Use distortion-minimizing unwrapping algorithms (such as ABF++ or LSCM).
- UV Packing: Pack islands tightly to achieve high UV space utilization (aim for >75% coverage). Maintain uniform texel density across the asset unless certain zones require higher visual priority.
4. High-to-Low Poly Baking
The low-poly retopologized mesh relies on texture maps to simulate the high-frequency detail of the raw scan.
- Baking Tool: Bake maps using dedicated bakers such as Marmoset Toolbag, Substance 3D Painter, or xNormal.
- Cage Setup: Use an expanded ray-projection cage to prevent missed rays and projection skewing around overlapping surfaces.
- Essential Maps:
- Normal Map: Captures micro-surface details and edge bevels.
- Ambient Occlusion (AO): Captures contact shadows.
- Base Color / Albedo: Transferred from the original photogrammetry vertex color or high-poly texture atlas.
- Roughness / Metalness: Generated or hand-authored to establish PBR material properties.
5. Packing and Exporting to glTF
glTF 2.0 uses specific texture channel packing to reduce draw calls and memory overhead:
- ORM Texture Packing: Pack Ambient Occlusion into the Red channel, Roughness into the Green channel, and Metalness into the Blue channel into a single texture file.
- Normal Format: glTF strictly requires OpenGL format (Y+ / Green Up) normal maps. Invert the green channel if your bake tool outputs DirectX (Y-).
- Compression:
- Apply Draco geometry compression during export if low file size for web delivery is prioritized over load-time decompression performance.
- Use KTX2 / Basis Universal texture compression for optimal GPU VRAM management on mobile and web platforms.