Shape completion: generating the missing part
Read these first if they are new to you
- Conditional generation: generating from a hint Intermediate
- Shapes as point clouds Intermediate
The idea in one paragraph
Shape completion takes part of a shape and generates the rest. The known part is the condition, and the output is the missing part. For a shape stored as a point cloud, the model generates new points where the shape is missing. Often several completions fit the same known part, so a generative model proposes several, each different. Training needs no labels: cut a complete shape in two, show the model one part, and ask it to generate the other.
A completion continues a partial shape
A 3D scanner sees a mug from one side, so the scan has no points on the back. A branch runs off the edge of an image, so its end is cut off. In both cases we have a partial shape, stored as a point cloud, and we want a plausible rest. Shape completion is conditional generation where the condition is the known part.
…
What you should find
Near the cut, every completion continues in the direction of the known part. Farther on, they split: some bend up, some bend down. The average of 50 runs nearly straight, between the two groups, and stops short. Hardly any completion goes there.
Training pairs come from cutting complete shapes
To train a completion model, you need pairs: a known part and its true missing part. Complete shapes supply them. Cut a complete shape in two, give the model one part as the condition, and train it to generate the other. Each shape gives many pairs, because each cut can fall in a different place. No person has to label anything, because the data supply their own answers. This is called self-supervised learning.
A complete shape is 12 points spaced evenly along a quarter circle of radius 4, from (4, 0) to (0, 4).
- Cut at x = 1.5. The points with x > 1.5 are known: the first 9, from (4, 0) to (1.66, 3.64).
- The other 3 points are missing: (1.13, 3.84), (0.57, 3.96) and (0, 4).
- The pair is (known: 9 points, missing: 3 points). A cut at x = 2.7 makes a different pair, with 6 known and 6 missing points.
The known part and the missing part stay in the same coordinates, so the generated points land in the right place. Many pipelines also shift and scale each pair so that the known part is centered (see normalizing data).
make_pairs.py
import numpy as np
rng = np.random.default_rng(2)
# A full shape: 12 points along a quarter circle of radius 4.
# np.linspace gives 12 evenly spaced angles from 0 to π/2 (np.pi is π).
a = np.linspace(0, np.pi / 2, 12)
# np.stack(..., axis=1) puts x and y side by side: one row per point.
shape = np.stack([4 * np.cos(a), 4 * np.sin(a)], axis=1)
def make_pair(shape):
# Cut a full shape at a random x: the right part is known, the left part is missing.
cut = rng.uniform(1.0, 3.0) # a random number between 1 and 3
known = shape[shape[:, 0] > cut] # the rows whose x is greater than cut
missing = shape[shape[:, 0] <= cut] # the rows whose x is at most cut
return cut, known, missing
for i in range(3): # one shape gives many training pairs
cut, known, missing = make_pair(shape)
print(f"cut at x = {cut:.2f}: {len(known)} known, {len(missing)} missing")
cut at x = 1.52: 9 known, 3 missing cut at x = 1.60: 9 known, 3 missing cut at x = 2.63: 6 known, 6 missing
A generative model keeps the possibilities apart
If a shape may continue upward or downward, a predictor trained with squared error returns the average of the two (see loss): a short stub between them, or points smeared over both. A generative model picks one possibility per sample. Ask for several samples, and you see the range of plausible completions.
The spread of the samples is useful in itself. If many completions agree, the known part settles the answer. If they spread out, the known part leaves the answer open there. Completions can also test a candidate: if a piece of shape lies where many completions go, it plausibly continues the known part.
The output is a set of points, not a list
A point cloud has no order. The same points listed in another order are the same shape (see permutation invariance). So a completion model must produce the missing points as a set. A score for how well a completion matches the true missing part must compare sets, not lists: for example, it can match each generated point to the nearest true point.
Models such as the diffusion transformer treat every point alike, which suits sets. With flow matching, each output point starts as a noise point and moves into place. Its training pairs each noise point with one true point and compares velocities point by point, so its loss needs no comparison of sets.
This page cuts shapes with one straight line. Real partial shapes can miss patches in the middle, have noisy known parts, or come from several views. The idea stays the same: generate what is missing, conditioned on what is known.
Check yourself
-
Why does a shape-completion model need no human labels?
Answer
Cutting a complete shape makes both halves of a training pair: the known part is the input, and the cut-off part is the answer. The data supply their own answers.
-
Ten completions of shape A all agree closely. Ten completions of shape B point in three directions. What does each tell you?
Answer
For A, the known part settles how the shape continues. For B, the known part leaves several continuations plausible, so the model is unsure there.
-
A shape may continue upward or downward, equally often. A predictor trained with squared error completes it. What does it output, and why is that a problem?
Answer
Roughly the average of the two: a short straight stub between them, or a smear over both. Neither is a shape that occurs in the data.
-
A model returns 3 missing points. You list them in a different order. Is that a different completion?
Answer
No. A point cloud is a set, so its order carries no meaning.
Go further
Optional background, for readers with more time.
-
3D Shape Generation and Completion through Point-Voxel Diffusion Zhou, Du and Wu Project page Advanced
A diffusion model that generates several different completions of one partial 3D scan, with figures of the spread.
-
An early, widely cited network that completes point clouds with one answer per input: the predictor approach, for contrast.
Where this shows up
No unit or explanation builds on this one yet.