Chapter 6: 3D Reconstruction Pipelines
Master the complete pipeline for reconstructing 3D models from images and sensor data: photogrammetry workflows from images to textured meshes, surface reconstruction from point clouds using Poisson and marching cubes, implicit surface representations with signed distance functions, mesh optimization and simplification, and texture mapping onto recovered geometry.
- Topics
- 7
- Demos
- 2
- Videos
- 3
- Min read
- 40
Chapter Overview
3D reconstruction is the process of recovering a complete digital 3D model of a scene or object from sensor data. This chapter covers the full pipeline: from raw images or point clouds through to watertight, textured meshes ready for visualization, simulation, or manufacturing.
What is this chapter about? We walk through the major reconstruction approaches. Photogrammetry takes a collection of photographs and produces a textured 3D model through a sequence of well-defined stages. Point cloud meshing converts raw 3D points into connected surfaces. Poisson reconstruction and marching cubes provide mathematically principled methods for extracting smooth surfaces from noisy data. Signed distance functions offer a powerful implicit representation that unifies many reconstruction techniques. We close with the practical concerns of mesh simplification (making models efficient) and texture mapping (making them look real).
Why does this matter? 3D reconstruction drives applications from cultural heritage preservation (digitizing ancient artifacts) to real estate (virtual property tours) to film and games (scanning real-world environments). Understanding the full pipeline lets you diagnose quality issues, choose appropriate methods for different scenarios, and build production-quality reconstruction systems.
How the topics connect: The photogrammetry pipeline provides the big picture of how images become 3D models. Mesh reconstruction and Poisson reconstruction convert intermediate point clouds into surfaces. Marching cubes extracts geometry from volumetric representations. Signed distance functions provide the mathematical foundation for implicit surfaces. Mesh simplification optimizes the result for practical use, and texture mapping adds visual realism.
Chapter Roadmap
Click any topic to jump in
Photogrammetry
The full pipeline from photographs to 3D models — SfM, dense MVS, and the COLMAP workflow.
Two approaches to meshing — local connectivity and global smoothness
Mesh Reconstruction
Converting raw point clouds into connected triangle meshes using ball pivoting and alpha shapes.
Poisson Reconstruction
Extracting smooth, watertight surfaces by solving the Poisson equation on oriented normals.
Grid-based extraction and implicit representations
Marching Cubes
Extracting triangle meshes from volumetric scalar fields using cube classification and edge interpolation.
Signed Distance Functions
Implicit surface representations where zero-crossings define geometry — from TSDF to DeepSDF.
Optimization for rendering and adding visual realism
Mesh Simplification
Reducing triangle count via edge collapse and quadric error metrics for efficient rendering.
Texture Mapping
Projecting color onto geometry through UV parameterization, atlas generation, and mipmap filtering.
Topics
7 topics in this chapter
Chapter 5 ended with depth maps, from sensors or from multi-view stereo, but a depth map is one view's opinion about the scene. A museum scanning a statue, a game studio capturing a rock, or a surveyor documenting a building wants a single model: one consistent surface with colour, viewable from anywhere and usable in other software. Photogrammetry is the pipeline that turns a pile of overlapping photographs into that model, and this chapter walks through its stages. The first stage is structure from motion from Chapter 4, which recovers every camera's pose and a sparse point cloud. Multi-view stereo then computes dense depth for every image and fuses the maps into a point cloud with millions of points. Meshing converts points into a connected surface, simplification trims the triangle count to something usable, and texturing paints the photographs back onto the mesh. Each stage inherits the errors of the one before, so a weak pose estimate shows up as a doubled wall or a smeared texture. This topic gives the overview with COLMAP as the running example; the rest of the chapter opens up each stage.
Definition
A photogrammetry pipeline reconstructs a textured 3D model from overlapping photographs. Structure from motion estimates camera poses and sparse points, multi-view stereo computes and fuses dense depth maps into a point cloud, surface reconstruction converts the points into a mesh, and texture mapping projects the photographs onto it. Tools such as COLMAP and Meshroom automate the stages.
In this topic
- 1Structure from Motion (SfM)
- 2Dense Reconstruction and MVS
- 3End-to-End Pipeline: COLMAP Workflow
Structure from Motion (SfM)
SfM simultaneously recovers camera poses (positions and orientations) and a sparse 3D point cloud from image correspondences. The process begins with feature detection (SIFT, SuperPoint) and matching across image pairs. An initial pair of images is chosen with sufficient baseline, and their relative pose is estimated from the Essential matrix. Additional images are registered incrementally by finding 2D-3D correspondences (PnP algorithm) and triangulating new 3D points. Bundle adjustment globally optimizes all camera parameters and 3D point positions by minimizing the total reprojection error across all observations. The output is a set of calibrated cameras and a sparse point cloud (thousands to millions of points).
SfM solves a nonlinear least squares problem: minimize total reprojection error over all camera poses and 3D points . With cameras and points, there are unknowns but the Jacobian is extremely sparse (each observation only depends on one camera and one point), enabling efficient Schur complement-based bundle adjustment that reduces the system to a camera-only problem.
An SfM pipeline processes 200 images and produces 50,000 sparse 3D points. On average, each point is observed in 4 images. How many total observations (reprojection constraints) does bundle adjustment optimize over?
Dense Reconstruction and MVS
After SfM produces camera poses and a sparse point cloud, Multi-View Stereo (MVS) computes dense depth maps for each image. Dense reconstruction evaluates depth hypotheses at every pixel by checking photometric consistency across neighboring views. The per-view depth maps are then fused into a single dense point cloud by applying geometric consistency filters that reject outliers. Tools like COLMAP, OpenMVS, and Meshroom automate this pipeline. The dense point cloud typically has hundreds of times more points than the sparse SfM output (the worked example below reaches 360x), with sufficient density for surface reconstruction.
Dense MVS estimates per-pixel depth by evaluating photometric consistency across views. The cost function at pixel and depth aggregates matching scores: where is the depth-dependent homography from reference to view and NCC is normalized cross-correlation over local patches. The depth with minimum cost is selected: .
SfM produced 50,000 sparse points from 200 images at 4000x3000 resolution. MVS produces depth maps at 1/4 resolution. Estimate the dense point cloud size after fusion with 60% valid pixel rate.
End-to-End Pipeline: COLMAP Workflow
COLMAP is the most widely used open-source photogrammetry pipeline. It integrates feature extraction (SIFT), exhaustive or sequential matching, incremental SfM with bundle adjustment, and dense MVS with PatchMatch stereo. The typical workflow is: (1) extract features from all images, (2) match features across image pairs, (3) run incremental SfM to recover poses and sparse points, (4) optionally run geometric verification, (5) compute dense depth maps via PatchMatch, (6) fuse depth maps into a dense point cloud. From there, external tools (Poisson reconstruction, Screened Poisson) generate the final mesh, and texture mapping projects colors back onto the surface.
COLMAP's exhaustive matching has complexity: for images, it evaluates image pairs. Each pair requires descriptor comparisons for features per image (or with approximate nearest neighbors). The quadratic scaling becomes the bottleneck — 500 images need 124,750 pair evaluations. Vocabulary tree matching reduces this to by retrieving only the top- most similar images per query, enabling reconstruction from thousands of images.
A COLMAP pipeline with 500 images takes 2 minutes for feature extraction, 45 minutes for exhaustive matching (), 30 minutes for SfM, and 120 minutes for dense MVS. If the image count doubles to 1000, estimate the new total time.
Related Problems on PixelBank
The previous topic's dense stage ends with a point cloud of millions of coloured points. That is not yet a surface: points have no connectivity, so a renderer cannot shade between them, a physics engine cannot test collisions, and a 3D printer has nothing watertight to fill. Mesh reconstruction must decide which points are neighbours on the surface and join them into triangles, using only their positions. That is harder than it sounds. Sampling density varies with distance to the cameras, noise blurs thin parts, and two sheets that pass close to each other, such as the two sides of a thin wall, look like one blob of points. This topic covers the geometric family of methods that build triangles directly from the input points. Ball pivoting rolls a ball of fixed radius over the cloud and makes a triangle wherever it rests on three points. Alpha shapes and the 3D Delaunay triangulation they are built from carve a tetrahedral mesh of the points down to the surface. These methods interpolate the data exactly, which is their strength and their weakness; the next topic's Poisson reconstruction trades that for robustness.
Definition
Mesh reconstruction from point clouds infers a triangle mesh whose vertices are, or approximate, the input points. Interpolating methods such as ball pivoting and alpha shapes connect the points directly, choosing triangles by an empty-ball criterion with radius set relative to the sampling density; approximating methods such as Poisson fit an implicit surface instead.
In this topic
- 1Ball Pivoting Algorithm (BPA)
- 2Alpha Shapes and Delaunay-Based Methods
- 3Delaunay Triangulation in 3D
Ball Pivoting Algorithm (BPA)
The Ball Pivoting Algorithm reconstructs a triangle mesh by rolling a virtual ball of radius r across the point cloud surface. The ball starts at a seed triangle (three points that the ball can rest on) and pivots around each edge, rolling over the surface to find the next point it contacts. Each pivot creates a new triangle. The process continues until no more pivots are possible, then a new seed is found for disconnected regions. The ball radius is a critical parameter: too small and the mesh has holes (the ball falls through gaps); too large and fine details are smoothed over. BPA works well for relatively uniform point clouds but struggles with varying density.
Ball Pivoting traces the surface by rolling a ball of radius over the point cloud. The ball touches exactly three points at a time, forming a triangle. The radius must be chosen relative to the local point spacing : too small () and the ball falls through gaps; too large () and fine details are smoothed over. The algorithm's complexity is with spatial indexing, and it produces a manifold surface only when the point density is sufficiently uniform.
A point cloud has average point spacing of 2mm. What ball radius should be used for BPA? If the cloud has 500,000 points, estimate the number of triangles in the resulting mesh.
Alpha Shapes and Delaunay-Based Methods
Alpha shapes generalize convex hulls to non-convex shapes by controlling a parameter that determines the level of detail. The algorithm computes the Delaunay triangulation (or its 3D equivalent, the Delaunay tetrahedralization) of the point set, then removes tetrahedra whose circumradius exceeds . The boundary of the remaining tetrahedra forms the alpha shape. Small captures fine details but may produce holes; large gives a smoother but less accurate surface; gives the convex hull. Delaunay-based methods guarantee topological consistency (no self-intersections) and work well for point clouds that sample a well-defined surface.
Edelsbrunner's alpha shape keeps every Delaunay simplex (edge, triangle or tetrahedron) that has an empty circumscribing ball of radius at most , and the shape is the boundary of what remains. As only the points survive; as every simplex qualifies and the result is the convex hull. In between, a ball of radius acts as an eraser: wherever it fits between points without touching any, space stays empty. That is why the handle hole survives only while is smaller than the hole's radius, and why noise with gaps larger than punches holes.
A point cloud of a mug has points spaced ~3mm apart. The handle has a hole with diameter 30mm. What range of will correctly capture the handle hole?
Delaunay Triangulation in 3D
The 3D Delaunay triangulation divides the convex hull of a point set into tetrahedra whose circumscribed spheres contain no other points. In 2D the same empty-circle rule maximizes the minimum angle, but that guarantee does not carry over to 3D: Delaunay tetrahedralizations routinely contain slivers, flat tetrahedra with four nearly coplanar vertices and tiny dihedral angles. The worst-case size is tetrahedra, but for well-spread points it is linear, about 6.5 per point, and randomized incremental insertion runs in expected time. CGAL, Qhull and scipy.spatial.Delaunay implement it; alpha shapes, Voronoi diagrams and many surface reconstructors are built on it.
Delaunay is the projection of a convex hull: lift each point to on a paraboloid in four dimensions, and the lower hull's facets project down to the Delaunay tetrahedra. This explains both the empty-sphere property, since a sphere maps to a hyperplane below which no lifted point lies, and the complexity: a hull in 4D can have facets, though random points give a linear count. It also explains slivers. Four nearly cospherical points on a common circle have an empty circumsphere whatever their shape, so the criterion happily accepts a flat tetrahedron.
You compute the Delaunay tetrahedralization of 10,000 points drawn uniformly in a unit cube. Roughly how many tetrahedra should you expect, how many triangles lie on the convex hull, and are slivers a concern?
Ball pivoting and alpha shapes, the previous topic, connect the input points directly, so every gap in the scan becomes a hole and every noisy point becomes a bump. Real scans of statues, rooms and people have both, and many uses, 3D printing and physics simulation among them, need a closed, watertight surface. Poisson surface reconstruction takes a different route: instead of connecting points, it fits one smooth function to all of them at once. The trick is to use the normals. If you knew the solid's indicator function, 1 inside and 0 outside, its gradient would be zero everywhere except at the surface, where it points along the normal. An oriented point cloud is therefore a set of samples of that gradient, and finding the function whose gradient best matches them is a Poisson equation, solved efficiently on an adaptive octree. The surface is then extracted as a level set with marching cubes, the next topic. This topic covers the formulation, the screened variant that keeps the surface close to the points, and the step everything depends on: estimating consistently oriented normals.
Definition
Poisson surface reconstruction recovers an indicator function from an oriented point cloud by solving , where is a vector field built from the input normals. The surface is an isosurface of . Screened Poisson adds a term that pulls toward the isovalue at the input points.
In this topic
- 1The Indicator Function and Poisson Equation
- 2Screened Poisson Reconstruction
- 3Normal Estimation and Orientation
The Indicator Function and Poisson Equation
Poisson reconstruction defines the surface implicitly as the boundary of a solid region. The indicator function equals 1 inside the object and 0 outside. The surface is where transitions from 0 to 1. The gradient of is zero everywhere except at the surface, where it equals the inward-pointing surface normal. This means the oriented point cloud (positions + normals) samples the gradient of . To recover , we solve the Poisson equation: , where is a vector field constructed from the input normals. The solution is found using a multigrid solver on an adaptive octree, and the surface is extracted as the iso-surface at an appropriate threshold.
Poisson reconstruction formulates surface extraction as solving where is the indicator function (1 inside, 0 outside the surface) and is the vector field of oriented normals. The Laplacian is a smoothing operator, so the solution inherits the smoothness of the right-hand side. The surface is the isosurface . The key insight: oriented normals are samples of the gradient of the indicator function, , so we solve for given its (approximate) gradient.
A point cloud has 100,000 points with normals. Poisson reconstruction uses an octree of depth 10. How many leaf cells does the octree have at maximum, and what is the resolution?
Screened Poisson Reconstruction
The original Poisson reconstruction smooths the surface by solving only the divergence constraint, which can shift the surface away from the input points (over-smoothing near sharp features). Screened Poisson reconstruction (Kazhdan and Hoppe, 2013) adds a screening term that pulls the solution back toward the input points: minimize , where are input point positions and are target values. The screening weight controls the trade-off between smoothness and data fidelity. Higher produces surfaces that pass closer to the input points; lower gives smoother results. Screened Poisson is the default reconstruction method in MeshLab and Open3D.
Screened Poisson adds a data fidelity term: where encodes point positions (1 at input points, 0 elsewhere) and controls how closely the surface passes through the input data. Without screening (), the surface is globally smooth but may drift from the data. With screening (), the surface is pulled toward the input points, improving fidelity at the cost of some smoothness. This is solved on an adaptive octree grid with complexity.
Poisson reconstruction with octree depth 8 and screening weight produces a mesh with 200K vertices. If you increase depth to 10 (4x finer), estimate the new mesh size and memory usage.
Normal Estimation and Orientation
Poisson reconstruction requires oriented normals (normals pointing consistently outward). If the input point cloud lacks normals, they must be estimated from local geometry. Normal estimation fits a plane to each point's k nearest neighbors using PCA (the normal is the eigenvector of the smallest eigenvalue of the covariance matrix). However, PCA normals have ambiguous sign (could point inward or outward). Normal orientation propagates a consistent direction through the point cloud using a minimum spanning tree of the Riemannian graph, where edge weights reflect normal alignment between neighbors. Getting normals wrong (inconsistent or inward-facing) produces catastrophic reconstruction artifacts: inverted surfaces, holes, and self-intersections.
Normal orientation consistency is critical because the Poisson equation requires consistently oriented normals — if some normals point inward while others point outward, the indicator function has contradictory gradient constraints and the surface develops holes or self-intersections. The standard approach builds a Riemannian graph connecting nearby normals and propagates orientation using a minimum spanning tree. The propagation cost is , and failures occur at thin structures where the surface has nearby points with opposing true normals.
A point cloud of a coffee mug has 50,000 points. PCA normal estimation uses k=30 neighbors. How many PCA computations (3x3 eigendecompositions) are needed? What is the risk with k=30 at the handle junction?
Poisson reconstruction, the previous topic, does not output triangles; it outputs a function sampled on an octree, and the surface is wherever that function crosses a chosen value. The same situation arises all over 3D vision: a fused TSDF volume, a CT scan's density, a neural network that predicts signed distance. Each defines a surface implicitly, and every renderer, game engine and 3D printer wants triangles. Marching cubes, published by Lorensen and Cline in 1987 for medical imaging, is the standard bridge. It visits each cell of the grid, classifies the eight corners as inside or outside, looks up which pattern of triangles separates them in a precomputed table, and places each triangle vertex on a cell edge by linear interpolation of the two corner values. The method is simple, parallel and fast, but it has well-known flaws: some corner patterns are ambiguous, sharp features get rounded off, and the output has many thin triangles. This topic covers the lookup table, edge interpolation and those flaws with their fixes, then the next topic looks at the signed distance functions marching cubes most often extracts.
Definition
Marching cubes extracts a triangle mesh approximating the isosurface of a scalar field sampled on a regular grid. Each cell's eight corners are classified against , giving one of 256 configurations; a lookup table supplies that case's triangles, whose vertices are placed on crossing edges by linear interpolation of the corner values.
In this topic
- 1Cube Classification and Lookup Table
- 2Edge Interpolation and Vertex Placement
- 3Handling Ambiguities and Mesh Quality
Cube Classification and Lookup Table
Each cube in the grid has 8 corners, and each corner is classified as inside (value >= iso-value) or outside (value < iso-value). With 8 binary classifications, there are possible configurations. By exploiting rotational and reflective symmetries, these reduce to just 15 unique cases (or 33 with ambiguous cases resolved). A precomputed lookup table maps each configuration index (0-255) to a set of triangles. The configuration index is computed by checking each corner: if corner i is inside, bit i of the index is set. Edge intersections are interpolated linearly between the two corner values to find the exact surface crossing point.
Marching cubes classifies each vertex of a regular grid cell as inside () or outside () the isosurface, creating a binary index from 8 vertices: . With 8 binary vertices, there are possible configurations, but rotational and reflection symmetry reduces these to just 15 unique topological cases. The lookup table maps each index to a set of triangles that approximate the isosurface within the cube.
A 128^3 voxel grid has iso-value 0. A cube at position (50,50,50) has corner values: [-0.3, 0.1, 0.2, -0.1, -0.2, 0.3, 0.1, -0.4]. What is the configuration index? How many edges are intersected?
Edge Interpolation and Vertex Placement
For each edge of a cube that crosses the isosurface (one endpoint inside, one outside), the exact crossing point is found by linear interpolation between the two endpoint values. If corner A has value and corner B has value , and the iso-value is , the interpolation parameter is , and the surface vertex is at position . This places vertices precisely where the scalar field crosses the threshold, producing a mesh that accurately tracks the isosurface. Higher-order interpolation (cubic) can improve accuracy for smooth fields but linear interpolation is standard and sufficient for most applications.
Edge interpolation places mesh vertices along cube edges where the scalar field crosses the isovalue. For edge with values and straddling the isovalue , the vertex position is . This linear interpolation assumes the field varies linearly along each edge — a first-order approximation that produces continuous meshes (continuous but with sharp normal transitions between triangles).
An edge goes from corner A at position (2.0, 3.0, 1.0) with value -0.3 to corner B at position (2.0, 3.0, 2.0) with value 0.7. The iso-value is 0. Where is the surface vertex?
Handling Ambiguities and Mesh Quality
Some cube configurations are ambiguous: the lookup table could generate two different topologies (connected versus disconnected surface patches). The classic example is the saddle point case, where two diagonally opposite corners are inside and two are outside. The original marching cubes algorithm from 1987 could produce meshes with cracks between adjacent cubes. Solutions include: asymptotic decider (checking the saddle point value), marching tetrahedra (splitting each cube into tetrahedra, which have no ambiguities), and dual contouring (placing vertices inside cells rather than on edges). Post-processing steps like vertex welding (merging nearly-coincident vertices) and Laplacian smoothing improve mesh quality.
Ambiguous configurations arise when a cube face has the pattern at diagonal corners — the isosurface could connect the positive or negative pairs, creating topologically different meshes. The original marching cubes algorithm chooses arbitrarily, which can produce cracks between adjacent cubes that resolve the ambiguity differently. Marching cubes 33 resolves this by testing the face ambiguity with the body diagonal's scalar value, ensuring consistent topology at the cost of 33 unique cases instead of 15.
A marching cubes mesh from a 64^3 grid has 35,000 triangles but 500 non-manifold edges (shared by more than 2 triangles). What is the likely cause, and how would you fix it?
Related Problems on PixelBank
Marching cubes, the previous topic, turns any sampled scalar field into a mesh, but some fields are far better to work with than others. The indicator function from Poisson jumps abruptly from 0 to 1, so its exact crossing is poorly defined between grid samples. A signed distance function instead stores, at every point in space, the distance to the nearest surface, negative inside and positive outside. That simple definition buys a lot. The value varies smoothly across the surface, so interpolation places vertices accurately; its gradient is the surface normal; and Boolean operations on shapes reduce to taking minima and maxima. It is also a natural format for fusing noisy depth: KinectFusion and its successors average truncated signed distances from many depth frames into a voxel grid in real time. Neural networks push the idea further by learning a continuous SDF in their weights, so a shape can be queried at any resolution. This topic covers SDFs as implicit surfaces, the truncated SDF used in volumetric fusion, and DeepSDF, which leads into the neural representations of later chapters.
Definition
A signed distance function gives each point's distance to the nearest surface point, negative inside and positive outside, so the surface is the zero level set . A true SDF satisfies almost everywhere. Truncated SDFs clamp values beyond a band around the surface for volumetric fusion.
In this topic
- 1SDF as an Implicit Surface Representation
- 2Truncated Signed Distance Function (TSDF)
- 3Neural Implicit Surfaces (DeepSDF)
SDF as an Implicit Surface Representation
An SDF encodes a surface implicitly as the zero-crossing of a continuous function. Unlike explicit representations (meshes, point clouds) that store surface elements directly, the SDF defines the surface everywhere in space: any point can be queried to determine its distance to the surface and whether it is inside or outside. The magnitude of the SDF gives the exact distance to the closest surface point, and the gradient of the SDF at the surface equals the surface normal. SDFs can represent surfaces with arbitrary topology (genus, disconnected components) without special handling, and Boolean operations (union, intersection, difference) reduce to simple min/max operations on the SDF values.
The SDF assigns to each point its signed distance to the nearest surface: , with inside and outside. The surface is the zero level set . A key property: everywhere (the Eikonal equation), meaning the gradient direction gives the surface normal and the magnitude gives the rate of distance change. This makes SDFs self-consistent geometric representations.
A sphere of radius 2 centered at origin has SDF: f(x) = |x| - 2. Compute the SDF value and gradient at point (1, 2, 2).
Truncated Signed Distance Function (TSDF)
In real-time 3D reconstruction (KinectFusion), the TSDF truncates the signed distance to a small range [-delta, delta] around the surface. Values beyond the truncation distance are clamped. The TSDF is stored on a voxel grid and updated incrementally as new depth frames arrive: each frame's depth map is converted to a local TSDF, and the running average is updated voxel-by-voxel using a weighted running mean. Truncation serves two purposes: it limits the influence of each measurement to a thin band around the surface (preventing distant geometry from affecting nearby surfaces), and it allows efficient storage (voxels far from any surface can be marked as unknown). The surface is extracted as the zero-crossing of the fused TSDF using marching cubes.
The TSDF truncates the distance field to : for , and otherwise. Fusion from depth frames uses a running weighted average: where weights by viewing angle and distance. The truncation focuses representation near surfaces where precision matters, and the averaging suppresses noise with .
A TSDF voxel grid has resolution 256^3, truncation distance delta = 4cm, and voxel size 2mm. How much memory is needed storing (value, weight) per voxel at 16-bit each? What fraction of voxels are within the truncation band for a planar surface?
Neural Implicit Surfaces (DeepSDF)
DeepSDF represents shapes as the zero level-set of a neural network that takes a 3D coordinate as input and outputs the signed distance value. Instead of storing SDF values on a grid, the continuous function is encoded in the network's weights. This provides virtually infinite resolution (query at any point), compact storage (a few MB of weights represent complex shapes), and enables shape interpolation and generation in the learned latent space. Training requires ground-truth SDF samples, which are generated by sampling points near the surface and computing their signed distances. The auto-decoder architecture learns a shape embedding space where each training shape has a latent code, and new shapes can be generated by interpolating codes.
DeepSDF parameterizes the SDF with a neural network conditioned on a latent code that encodes shape identity. Training minimizes where the regularizer prevents overfitting to individual shapes. At inference, the latent code for a new shape is found by optimizing — a test-time optimization that takes seconds versus minutes for classical methods.
A DeepSDF network has 8 layers of 512 units each with ReLU activations. A latent code has 256 dimensions. How many parameters does the network have? Compare storage to a 512^3 TSDF grid.
Related Problems on PixelBank
Signed distance fusion and marching cubes, the previous topics, produce meshes at the resolution of their grid, and a dense photogrammetry or TSDF mesh easily reaches tens of millions of triangles. Most of them are wasted: a flat floor needs two triangles, not two million, while a face or a carved edge really does need detail. Games, web viewers and AR headsets have budgets of tens or hundreds of thousands of triangles per object, so the mesh must shrink by a factor of 100 or more without visibly changing shape. Surface simplification reduces the triangle count while keeping the geometric error small, and the hard part is choosing what to remove. The standard answer is greedy: repeatedly collapse the edge whose removal changes the surface least. This topic covers the edge collapse operation and its bookkeeping, the quadric error metric of Garland and Heckbert, which estimates the change cheaply with a 4 by 4 matrix per vertex, and level-of-detail systems and progressive meshes, which store a whole sequence of simplifications. Texture mapping, the last topic, then makes the simplified mesh look detailed again.
Definition
Surface simplification reduces a mesh's vertex and triangle counts while minimizing geometric error. Most methods apply edge collapses greedily, ordered by an error metric such as the quadric error, the sum of squared distances from a new vertex to the planes of the original faces around it. Recording the collapses in order yields a progressive mesh supporting continuous levels of detail.
In this topic
- 1Edge Collapse Operations
- 2Quadric Error Metrics (QEM)
- 3Level of Detail (LOD) and Progressive Meshes
Edge Collapse Operations
Edge collapse is the fundamental simplification operation: select an edge, merge its two endpoint vertices into a single vertex, and remove the two triangles that shared that edge. The resulting mesh has 2 fewer triangles, 3 fewer edges, and 1 fewer vertex (matching Euler's formula). The position of the merged vertex determines the quality of the approximation. Simplest approach: place it at the midpoint. Better approach: optimize its position to minimize geometric error. The order in which edges are collapsed is driven by an error metric, with the least-error edges collapsed first. This greedy strategy produces nearly optimal simplifications.
Edge collapse removes an edge by merging both vertices into a single new vertex , deleting the two adjacent triangles. Each collapse reduces the vertex count by 1, the edge count by 3, and the face count by 2. A mesh with faces can be reduced to faces in exactly collapses. The key question is which edges to collapse first — greedy selection by error metric determines the quality of the simplification.
A mesh has 100,000 triangles. Simplification to 10,000 triangles requires 45,000 edge collapses. Why 45,000 and not 90,000?
Quadric Error Metrics (QEM)
The Quadric Error Metric (Garland & Heckbert, 1997) assigns an error to each vertex based on its distance to the original surface planes. For each vertex, a 4x4 quadric matrix Q is computed as the sum of the outer products of the planes of all adjacent faces. Collapsing edge (v1, v2) produces a new vertex v_new that minimizes the combined error v_new^T (Q1 + Q2) v_new. The optimal position is found by solving a 4x4 linear system. QEM is remarkably effective because it accounts for the flatness of the local surface: edges in flat regions (where all planes agree) have low error and are collapsed first, while edges near sharp features or high curvature have high error and are preserved longest.
The Quadric Error Metric (QEM) assigns to each vertex a matrix where for each plane of adjacent triangles (in homogeneous form). The error of placing the merged vertex at position is , which measures the sum of squared distances to all original planes. The optimal position minimizes this quadratic form: (when invertible), giving the point closest to all surrounding planes.
A vertex on a flat plane (all 6 surrounding triangles are coplanar with normal (0,0,1) at height z=3) has quadric Q = sum of 6 copies of the plane (0,0,1,-3). What is the quadric error at position (0, 0, 3)?
Level of Detail (LOD) and Progressive Meshes
Level of Detail systems store multiple simplification levels of the same mesh and switch between them based on viewing distance or screen-space coverage. A car 500 meters away uses the 1,000-triangle LOD; at 50 meters, the 10,000-triangle LOD; up close, the full 100,000-triangle mesh. Progressive meshes (Hoppe, 1996) store a base mesh plus a sequence of vertex split records (the inverse of edge collapses). Any intermediate LOD can be reconstructed by applying the appropriate number of splits. This enables smooth, continuous LOD transitions (geomorphing) without storing separate meshes. Modern game engines use nanite-style virtualized geometry that automatically selects per-triangle LOD, eliminating pop-in artifacts entirely.
Progressive meshes store a base mesh plus a sequence of vertex split records (the inverse of edge collapses). This enables continuous level-of-detail: at distance from the camera, render the mesh with faces where maps distance to detail level. The geomorphing technique smoothly interpolates vertex positions between LOD levels to avoid popping artifacts, with each vertex moving along the split/collapse trajectory parameterized by .
A game scene has 500 objects. Each has LOD levels at 100%, 50%, 25%, 10% triangle count. If average full-detail is 50K triangles and the camera sees 20% at full detail, 30% at 50%, 30% at 25%, and 20% at 10%, what is the total triangle count?
The previous topic shrank the mesh to a usable size, and in doing so it threw away fine detail: a simplified statue is a smooth grey shape. Texture mapping puts the detail back as an image. The photographs already contain the colour of every surface point, and a few thousand triangles look photorealistic once each one is painted with the right patch of a high-resolution image. Doing that takes two steps. First the mesh needs a parameterization: every vertex gets 2D texture coordinates , which requires cutting the surface into charts, flattening each with as little stretching as possible, and packing the charts into one texture atlas. Then the atlas has to be filled, by choosing for every triangle the photograph that sees it best, frontal, close and unoccluded, and blending across seams where neighbouring triangles chose different photos. Finally a renderer must sample the texture without shimmering when it appears small on screen, which is what mipmapping solves. This topic covers all three steps, the final stage of the photogrammetry pipeline that began this chapter.
Definition
Texture mapping assigns each mesh vertex 2D coordinates into a texture image and colours the surface by sampling that image. For reconstructed meshes, the surface is cut into charts, flattened and packed into an atlas, which is filled by projecting the source photographs, choosing and blending views per triangle. Mipmaps provide prefiltered textures for rendering.
In this topic
- 1UV Parameterization and Atlas Generation
- 2Projective Texture Mapping from Photographs
- 3Texture Filtering and Mipmapping
UV Parameterization and Atlas Generation
UV unwrapping maps each triangle of a 3D mesh to a 2D triangle in texture space. The challenge is that most 3D surfaces cannot be flattened to 2D without some distortion (stretching or compression). The mesh is cut along seam edges to divide it into charts (patches that can be flattened individually). Each chart is parameterized (flattened) using conformal or isometric mapping that minimizes angular or area distortion. The flattened charts are then packed into a single rectangular texture atlas, maximizing space utilization. The UV coordinates of each vertex map between 3D mesh space and 2D texture space.
A parameterization has a Jacobian at each point whose singular values measure stretching. Conformal maps keep , preserving angles; area-preserving maps keep . Both together force , an isometry, and Gauss's Theorema Egregium rules that out wherever the Gaussian curvature is nonzero, which is why a sphere cannot be flattened without distortion. Cutting the surface into charts reduces the distortion each must absorb, at the price of seams. Least squares conformal maps choose angle preservation and minimize the remaining conformal error with a sparse linear solve.
A mesh has 50,000 triangles requiring a texture atlas. If each triangle needs on average 10x10 pixels of texture detail and the atlas must be a power-of-2 square, what texture resolution is needed?
Projective Texture Mapping from Photographs
In photogrammetry, texture is generated by projecting the original photographs onto the reconstructed mesh. For each triangle, the algorithm selects the best source photograph (the one where the triangle is most front-facing, least occluded, and closest to the camera) and samples the color from that image. The selection considers the angle between the face normal and the camera viewing direction (oblique views cause stretching), the resolution (closer cameras give more detail), and occlusion (other geometry may block the view). Multi-band blending combines contributions from multiple photographs at different frequency bands, producing seamless textures without visible seams between photographs.
Projective texture mapping projects a photograph onto geometry: each mesh vertex gets texture coordinates where is the camera's projection matrix. For multiple photographs, each triangle selects the best source image based on: (1) viewing angle between surface normal and camera direction, (2) distance (closer = higher resolution), and (3) visibility (not occluded). Blending across photograph boundaries uses Poisson blending or multi-band blending to avoid seams.
A triangle faces camera A at 20 degrees (nearly front-on) at 5m distance, and camera B at 60 degrees at 3m distance. Both cameras have 4000x3000 resolution. Which provides better texture?
Texture Filtering and Mipmapping
When a textured mesh is rendered, each screen pixel typically does not align with exactly one texel (texture pixel). Minification (one screen pixel covers many texels) causes aliasing (shimmering, moire patterns). Magnification (one texel covers many screen pixels) causes blockiness. Mipmapping precomputes a pyramid of progressively smaller texture versions (512x512, 256x256, ..., 1x1), and the renderer selects the appropriate mip level based on the screen-space coverage of each pixel. Trilinear filtering interpolates between two mip levels for smooth transitions. Anisotropic filtering handles oblique viewing angles by using different mip levels in different directions.
Mipmapping precomputes downsampled versions of each texture, forming a pyramid where level has resolution . During rendering, the mipmap level is selected based on the screen-space footprint of a texel: . Trilinear filtering interpolates between the two nearest levels, suppressing aliasing artifacts. Without mipmapping, a texture sampled at a rate below its Nyquist frequency produces shimmer and moire patterns.
A 4096x4096 texture has mipmaps. How many mip levels are stored? What is the total memory including all mipmaps (RGBA, 8 bits per channel)?