TL;DR

  1. Flow matching: train by regressing a velocity, sample by following the velocity. A flow moves noise to data along a deterministic ODE .
  2. Simplest version: , loss with random pairs. It works because the marginal velocity is the average of conditional velocities and generates the marginal probability path; the conditional loss has the same gradient.
  3. Flow matching vs. diffusion: deterministic ODE vs. stochastic SDE, velocity vs. noise regression, 10-100 vs. thousands of steps. For a Gaussian source they are equivalent up to reparameterization.
  4. 3D generative models: optimization-based (SDS: distill a 2D diffusion model into a NeRF/3DGS, DreamFusion) vs. optimization-free: direct (PC², point cloud diffusion) or latent (structured: TRELLIS; unstructured: 3DShape2VecSet, Hunyuan3D 2.0).
  5. Structured latents (voxel/triplane-aligned) have locality and allow editing; unstructured latents (vector sets) are compact and transformer-friendly. VecSets: simple, compact, dominant for generation; SLAT: structured, spatial, best for fidelity and editing.

Exam relevance

  • Last exam task: TRELLIS, Structured 3D Latents (Xiang et al., CVPR 2025): the difference between structured and unstructured latents, when to use which, and their advantages. See Structured vs. Unstructured Latents.
  • Hint from a fellow student: contrast flow matching vs. diffusion. See Flow Matching vs. Diffusion.
  • Transfer example: “put together pieces, with diffusion, to reconstruct depth and the back part of a scene”.

Overview: flow matching · score distillation sampling · point cloud diffusion · TRELLIS · Hunyuan3D.

Flow Matching

Slides 3-28, from the NeurIPS 2024 tutorial “Flow Matching for Generative Modeling” (Chen, Lipman, Ben-Hamu)

What is flow matching?

A scalable method to train flow generative models. Train by regressing a velocity, sample by following the velocity.

The Generative Modeling Problem

Slides 5-10

Think of the space of all images; each point is one image. Generative modeling means: start from a simple distribution (noise), and learn to map samples to samples of the complex data distribution (e.g. dog images): .

Mapping noise X0 from p to a dog image X1 from q
Slide 6: map samples from p to samples from q.

Two kinds of models:

  • Direct map (e.g. GANs): efficient sampling, but not probabilistic and a delicate min-max loss.
  • Continuous-time Markov process with : move the sample step by step. Three kinds of paths: flow (smooth), diffusion (noisy), jump (discontinuous).
Flow, diffusion and jump processes from p to q
Slide 8: flow, diffusion and jump processes.

Marginal probability path

Freeze time at : is a random variable with distribution , . The marginal probability path is the family , a continuous path of distributions from to .

Why focus on flows? They are deterministic (the state at is determined by the state at ) and smooth: simple, faster sampling, an exact likelihood estimator, flexible and easier to build. Diffusion and jump processes have a larger design space, but slower sampling and only an ELBO.

Flows and Velocities

Slides 11-17

Flow

: a warping function (a diffeomorphism: a smooth bijection that reshapes space without losing information). : the source. Markov: , the future depends only on the present.

Slide 12: a flow moves samples from a Gaussian through a warping grid.

Flow = velocity. Flows are non-linear (a linear combination of bijections is usually not a bijection), which makes them hard to parameterize. Instead we use the velocity field , the local speed and direction:

Flow ↔ velocity

Velocity → flow: solve an ODE (numerical integration). Flow → velocity: differentiate.

  • ✓ velocities are linear: averages of velocities are velocities
  • ✗ getting samples needs simulation (ODE solving)
Slide 13: the velocity field (blue arrows) deforms the space.

A velocity generates if .

Goal and sampling

Train a velocity that generates with and . Sample and solve

from to with any numerical ODE solver (the midpoint method works well).

Simplest Version of Flow Matching

Slides 18-19

Training (simplest version)

  1. sample (noise), (data), with an arbitrary coupling (e.g. independent)
  2. sample
  3. interpolate
  4. regress the velocity:

The code fits in ~10 lines, much less than a diffusion model.

Linear interpolation between noise X0 and dog image X1, loss on X1 - X0
Slide 18: the simplest version of flow matching.

Why does this work, although the pairs are random and even contradictory?

Building the Flow from Conditional Flows

Slides 20-23

Generate a single target point : the conditional flow moves every point towards (like gravity):

with conditional probability and conditional velocity .

Average over the data: at all conditional paths start at ; at each ends at a delta at its . Averaging over all training examples gives a path from to the (empirical) data distribution . Because velocities are linear, averaging the conditional velocities gives the velocity of the averaged path.

Slides 20-22: a conditional flow towards a single target point.

The marginalization trick (theorem)

The marginal velocity generates the marginal probability path, where

Flow Matching Loss

Slide 24

Flow matching (FM) vs. conditional flow matching (CFM)

Theorem: the losses are equivalent,

Intuition

We can’t compute the marginal velocity (it averages over the whole data distribution). But we don’t need to: regressing the easy, per-pair conditional velocity gives the same gradient, because the average of the regression targets is exactly the marginal velocity.

How to Choose the Conditional Flow

Slide 25

Optimal transport minimizes the kinetic energy. With Jensen’s inequality:

Linear conditional flow :

  • minimizes the bound
  • reduces the kinetic energy of the initial coupling
  • is exact optimal transport for single data points
  • is not optimal transport in general (but in high dimensions the paths are straighter)

Flow Matching vs. Diffusion

Slides 26-28

For a Gaussian source distribution, they are different views of the same mechanism. Numerically, diffusion and (linear) flow matching are equivalent up to reparameterization: the noise prediction (diffusion) and the score function (score matching) at a given time can be converted into a velocity in closed form.

Diffusion modelsFlow matching
Path typestochastic, noise-added SDE pathsdeterministic, ODE-based velocity fields
Training supervisionpredict noise / score via a variational objectivedirect regression of the velocity field
Sampling costthousands of iterative denoising stepsfewer steps (10-100) with ODE solvers
Theoretical robustnessinverse of a 2nd-order PDE; unstable under approximation1st-order PDE; more stable inversion, small-error behavior
Pathsfixed noise schedulesarbitrary or optimal paths

Summary on flow matching

  • Flow matching learns a direct velocity field that transforms noise into data deterministically.
  • Diffusion models learn to reverse a stochastic noising process.
  • FM can be seen as a generalization of diffusion models, with better sample efficiency, stability and flexibility.
  • Under Generator Matching, both are unified: transform distributions along well-defined paths.

3D Generative Models

Slides 29-30

flowchart TD
  G["3D generative models"] --> O["Optimization-based<br/>SDS: DreamFusion"]
  G --> F["Optimization-free"]
  F --> D["Direct<br/>point cloud diffusion: PC²"]
  F --> L["Latent"]
  L --> S["Structured latents<br/>TRELLIS (SLAT)"]
  L --> U["Unstructured latents<br/>3DShape2VecSet, Hunyuan3D 2.0"]

Score Distillation Sampling

Slides 31-36

SDS, introduced by DreamFusion: Text-to-3D using 2D Diffusion (Poole et al., 2022): distill 3D information from a 2D diffusion model.

Why use 2D diffusion models for 3D? 2D diffusion models (e.g. Stable Diffusion) are trained on large-scale image-text data; 3D datasets are scarce and costly. Idea: let a pre-trained 2D model guide the optimization of 3D content, without any 3D training data.

Slide 32: DreamFusion results
Slide 32: DreamFusion results

Setup:

  • a 3D representation with differentiable rendering (NeRF, Gaussian splatting)
  • differentiably render from a random viewpoint
  • run the diffusion model on the rendered view, get gradients, backpropagate into the 3D representation

SDS algorithm

  1. sample a random camera pose, render an image from the 3D representation
  2. sample a time and noise
  3. corrupt the render:
  4. predict the noise:
  5. compute the gradient:
  6. backpropagate to the 3D representation:

Intuition

The gradient from the diffusion model is just a scaled noise residual (predicted minus added noise): “how would the diffusion model change this render to make it more likely under the prompt?” The diffusion model is frozen; only the 3D representation is updated. The Jacobian of the U-Net is skipped (stop-gradient trick).

DreamFusion: NeRF render, noise, frozen Imagen U-Net, gradient back to NeRF
Slide 35: the DreamFusion algorithm.

Limitations:

  • Janus problem (Janus: the Roman god with two faces): views are optimized independently without global 3D consistency, so the object can get several faces.
  • Speed: many diffusion steps until convergence (up to 30 minutes).
  • Quality: optimizing from different views averages details.
Slide 36: SDS optimization seen from several views.

(Zero-1-to-3 uses a similar score-distillation loss to reconstruct a neural field: Lecture 10.)

Optimization-Free 3D Generative Models: Design Choices

Slides 37-40

  • Input conditions: none, text, images, …
  • Output 3D representation: voxels, fields, point clouds, meshes, 3DGS parameters
  • Explicit vs. latent diffusion and representation (structured / unstructured latent)
  • Generative backbone: GAN, VAE, diffusion, …

For a diffusion model, the output representation matters: diffusion denoises continuous vectors (discrete data like meshes needs workarounds), and it runs hundreds to thousands of steps, so the representation must be efficient and network-friendly.

Table of 3D representations rated for time efficiency, memory, representation capability and NN compatibility
Slide 39: point clouds, voxel grids, depth/normal maps, neural fields, meshes and hybrids as output representations.

Direct: Image-Conditioned Point Cloud Diffusion (PC²)

Slides 41-45

A direct point cloud diffusion model conditioned on an image. Key idea: enrich the points with projected image features at each diffusion step.

PC²: projection-conditioned diffusion (Melas-Kyriazi et al., CVPR 2023)

  • random Gaussian points , perspective projection
  • image encoder
  • pixel-aligned feature (: bilinear interpolation)
  • diffusion model predicts the update for the next step
PC2: image features projected onto the point cloud at each denoising step
Slide 43: PC².

Because it is generative, PC² can produce sharp structures on the back side.

StrengthsLimitations
explicit 3D representationrequires point clouds for training
stable trainingcannot perform novel view synthesis
same limitations as diffusion (slow inference, repeated forward passes)

Latent Diffusion Models for 3D

Slides 46-47

Diffusion models are powerful, but denoising a 3D asset directly may be infeasible:

  • high-dimensional data (detailed point clouds, 3DGS parameters)
  • discrete (meshes with connectivity) or infinite-dimensional (neural fields, SDFs) representations: what exactly would we denoise?

Instead: compress the data with a pre-trained autoencoder (VAE), perform diffusion in the latent space, and decode back to the original format (like Stable Diffusion). Clever encoders and decoders also solve the discrete/infinite-dimensional problem by mapping to continuous, finite latents.

Structured vs. Unstructured Latents

Slide 48

A single global latent generally struggles to reconstruct high-quality shapes with fine details. Therefore a latent representation typically consists of multiple latent vectors.

Structured vs. unstructured latents

Structured latentsUnstructured latents
Whatspatially aligned latent vectors (voxel structure, triplane structure)a list (set) of latent vectors: a VecSet
Where is the 3D structure?in the arrangement (the grid)encoded in the features
Propertiesinterpolation, locality awarenesscompact, compatible with transformers (permutation equivariant)
Processing3D CNNs / sparse or windowed attention (harder)standard (cross-)attention
ExamplesTRELLIS (SLAT)3DShape2VecSet, Hunyuan3D 2.0
Best forfidelity and local editingsimple, compact generation (currently dominant)
Structured latents on voxels or triplanes vs a list of latent vectors
Slide 48: structured vs. unstructured latents.

When to use which?

  • Structured when you need spatial correspondence: local edits (“change only the roof”), high fidelity, multiple output formats decoded from the same grid, locality-aware processing.
  • Unstructured when you want a compact, fixed-size set that a standard transformer can generate; the structure is learned in the features, and a query point reads the shape via cross-attention.
  • Summary from the lecture: VecSets = simple, compact, dominant for generation; SLAT = structured, spatial, best for fidelity and editing.

TRELLIS: Voxel-Based Structured 3D Latents

Slides 49-63

TRELLIS (Xiang et al., CVPR 2025, “Structured 3D Latents for Scalable and Versatile 3D Generation”): image-to-3D and text-to-3D, different output formats (3DGS, NeRF, mesh), trained on more than 500,000 assets with models up to 2 billion parameters. State of the art for text- and image-conditioned generation, and it allows flexible editing.

Structured latent: features at active voxels of a sparse grid
Slide 51: the structured latent (SLAT).

Structured latent (SLAT)

A grid populated with features at active voxels:

  • a voxel is active if it intersects the surface; = grid resolution, = number of active voxels
  • the grid gives the rough geometry outline
  • fine details and appearance are expressed through the features
  • one latent space for different output formats (3DGS, NeRF, mesh)

Sparse VAE training pipeline (how the latent space is learned):

  1. Voxelize the asset and render it from multiple views.
  2. Extract image features (DINOv2) and project them onto the voxels; average over the views → a sparse image-feature volume (not the final latent yet!).
  3. A sparse VAE encoder (transformer with shifted-window attention for locality and efficiency) turns it into the SLAT .
  4. Specific decoders for different output formats. E.g. the 3DGS decoder decodes each active voxel into Gaussians,

( keeps each Gaussian close to its voxel), trained end-to-end with a rendering loss.

In practice the encoder is trained together with the 3DGS decoder; the NeRF and mesh decoders are trained afterwards with the encoder frozen.

3D assets encoding: voxelize, multiview feature averaging, sparse VAE encoder, structured latents, decoders
Slide 54: the sparse VAE pipeline.

Generative model: learn to generate the structured latent, in 2 stages.

  1. Coarse structure generation: generating the occupancy grid directly is expensive. Instead, a 3D convolutional VAE compresses it into a feature volume ; a flow transformer generates (conditions injected via cross-attention), which is decoded into the active voxels. The continuous feature volume also suits diffusion/flow models better than binary occupancy.
  2. Latent feature generation: a second (sparse) flow transformer generates the features at the active voxels.

Then the decoders turn the SLAT into 3DGS, NeRF or a mesh.

Structure generation with a flow transformer, then structured latent generation, then decoding
Slide 58: the two-stage generative model.
Slide 61: TRELLIS results
Slide 62: text-to-3D with TRELLIS

TRELLIS key takeaways

  • trained on 0.5 M assets, 2 B parameter models
  • structured latent representation with spatial awareness
  • a coarse structure equipped with features that encode fine details and appearance
  • the spatial representation allows local editing
  • multiple output formats via distinct decoders
  • a latent model that generates high-quality assets from text or images

Unstructured Latents: 3DShape2VecSet

Slides 64-73

3DShape2VecSet (Zhang et al., SIGGRAPH 2023). Key idea: encode a 3D object as a set of latent vectors, then predict a signed distance (or occupancy) field. How do we predict a set? With a cross-attention transformer, which is permutation equivariant.

3DShape2VecSet: point cloud and positional embeddings, cross-attention to latents, self-attention, query points to occupancy
Slide 68: shape encoding, KL regularization and shape decoding.

Encoder: sample points on the shape surface, enrich them with a positional embedding (), and cross-attend from a set of latent queries:

  1. learnable latent queries :
  2. subsampled latent queries via farthest point sampling (as in PointNet++): ,

KL regularizer: a linear projection produces a mean and a variance per latent (like a VAE), so a diffusion model can be trained on smaller latents:

It makes the latent space Gaussian-like, so similar shapes get similar codes and sampling works.

Decoder: a series of self-attention blocks gives the VecSet . To evaluate the occupancy at a query point , interpolate the latents via cross-attention, then one fully connected layer:

The surface is extracted with marching cubes.

Trained on ShapeNet (lamps, chairs, cars, …): reconstruction from point clouds and generation conditioned on categories, text, partial observations or images. Its full potential shows in Hunyuan3D.

Hunyuan3D 2.0

Slides 74-79

Hunyuan3D 2.0 (Tencent Hunyuan 3D team, 2025), a state-of-the-art image-to-3D model with two parts:

  1. Shape generation (Hunyuan3D-DiT): a high-fidelity, textureless mesh from an input image. A latent diffusion model.
  2. Texture synthesis (Hunyuan3D-Paint): the matching texture.
Slide 74: Hunyuan3D 2.0.

Encoder-decoder (ShapeVAE): based on 3DShape2VecSet, with importance sampling around corners and edges, farthest point sampling for query points, cross-attention and multiple self-attention layers, and SDF evaluation via cross-attention and a one-layer MLP:

Hunyuan3D-DiT: a flow-based diffusion model (a denoising transformer on the latent tokens), conditioned on the image:

(: the model condition). This is the flow matching loss from the first part of the lecture.

Hunyuan3D-Paint: a multi-view diffusion network generates the textures, conditioned on renders of normals and positions of the generated mesh and on the input image (with image de-lighting, a reference branch and multi-task attention).

Hunyuan3D ShapeVAE: uniform and importance sampling, cross and self attention, SDF decoding
Slide 76: Hunyuan3D 2.0 encoder-decoder.

Conclusion

Slide 81

  • Flow matching
  • 3D generation and reconstruction:
    • SDS-based methods: distilling 3D from 2D diffusion
    • point cloud diffusion
    • TRELLIS: mapping 2D features to structured 3D voxels
    • 3DShape2VecSet and Hunyuan: compressing shapes into an unstructured latent vector set
  • VecSets = simple, compact, dominant for generation; SLAT = structured, spatial, best for fidelity and editing.
MethodFamilyRepresentationNeeds 3D training data?
DreamFusion (SDS)optimization-basedNeRF / 3DGS, optimized per promptno (2D diffusion)
PC²direct diffusionpoint cloudyes
TRELLISlatent (structured)sparse voxel features → 3DGS / NeRF / meshyes
3DShape2VecSet, Hunyuan3D 2.0latent (unstructured)vector set → SDF → meshyes

Transfer: Depth and the Back of a Scene with Diffusion

The exam hint asks to “put together pieces, with diffusion, to reconstruct depth and the back part of a scene, based on the algorithms you’ve seen”. One possible combination from the course:

flowchart LR
  I["single image"] --> D["depth: monocular depth<br/>(Depth Anything) or<br/>DUSt3R with the image twice"]
  I --> MV["back views: multi-view diffusion<br/>(Zero-1-to-3), conditioned on (R, T)"]
  D --> P["visible geometry<br/>(point map)"]
  MV --> R["3D reconstruction from all views<br/>(DUSt3R / 3DGS), keep consistent<br/>e.g. Gen-3Diffusion style"]
  P --> R
  R --> O["full 3D scene incl. back"]
  • The visible part comes from depth (Lecture 4) or point maps (Lecture 9).
  • The hidden back is ill-posed, so it must be generated: multi-view diffusion or a 3D generative model (TRELLIS / Hunyuan3D) conditioned on the image.
  • Consistency between generated views needs an explicit 3D representation (Gen-3Diffusion) or SDS with a single 3D model.

Self-Test

What is the idea of flow matching in one sentence?

Why parameterize velocities instead of flows?

Write down the simplest flow matching training step.

Why does training with random pairs work?

Contrast flow matching and diffusion.

How does score distillation sampling work, and what are its limitations?

What is the difference between structured and unstructured latents? When would you use which?

What is SLAT, and how does TRELLIS learn and generate it?

How does 3DShape2VecSet encode and decode a shape?

What are the two parts of Hunyuan3D 2.0?