Exercises
ex01-sdf-sphere
EasyVerify that the SDF satisfies the Eikonal equation for all .
Compute .
Gradient
$
Norm
$
ex02-sdf-operations
EasyGiven SDFs and for two objects, write the SDFs for: (a) the union , (b) the intersection , (c) the complement .
Inside means ; inside both means and .
The complement flips inside and outside.
Boolean operations
- Union: .
- Intersection: .
- Complement: .
Distance property caveat
Union and intersection preserve the correct zero level set but may violate the exact distance property () away from the surface. The complement preserves the distance property exactly: .
ex03-sphere-tracing-convergence
EasyA ray is traced toward a sphere of radius centred at . Starting from , compute the first three sphere tracing iterates .
The SDF at is .
Iterates
- : , so .
- : . Surface hit!
In this case, sphere tracing converges in a single step because the ray passes through the centre of the sphere, where the SDF along the ray is exactly affine.
ex04-eikonal-cylinder
EasyWrite the SDF for an infinite cylinder of radius whose axis is the -axis. Verify the Eikonal equation.
The distance from to the -axis is .
SDF
$
Eikonal verification
$
ex05-occupancy-sigmoid
EasyGiven the SDF (unit sphere), compute the occupancy field for at (a) , (b) , and (c) .
.
Computations
- (a) , (inside).
- (b) , (on the surface).
- (c) , (outside).
ex06-positional-encoding
MediumA neural SDF uses positional encoding with levels. What is the maximum spatial frequency (cycles per unit length) that the network can represent? For a mmWave system at GHz ( mm), what minimum is needed to represent features at the wavelength scale in a m scene?
The highest frequency in is .
To resolve features at scale in a scene of size , need frequency .
Maximum frequency
The positional encoding introduces frequencies cycles per unit length. The maximum is .
Required $L$
To resolve mm features in a m scene: . Thus , giving (). In practice, provides a safety margin.
ex07-geraf-loss-gradient
MediumDerive the gradient of the GeRaF data fidelity loss with respect to the SDF network parameters , showing how the gradient flows through the rendering equation and the SDF evaluation.
Use the chain rule: .
The derivative passes through .
Chain rule through rendering
$
Derivative of rendered power
\delta_\sigma'(s) = -s/\sigma^2 \cdot \delta_\sigma(s)\partial f_\theta / \partial \theta\blacksquare$
ex08-mf-vs-sdf-resolution
MediumA MIMO radar with aperture and bandwidth produces an MF image with cross-range resolution and range resolution . Explain how a neural SDF can recover surface details finer than and .
The SDF provides a continuous, regularised surface that is not limited by the pixel grid.
The Eikonal constraint acts as a physics-based prior.
Super-resolution via regularisation
The MF image has resolution limited by the PSF. However, the neural SDF is a continuous function, not a discrete pixel grid. The Eikonal constraint enforces smoothness consistent with a valid distance function, acting as a strong prior that interpolates between the MF resolution elements.
Analogy with compressed sensing
Just as LASSO recovers sparse signals beyond the Nyquist limit by exploiting sparsity, the neural SDF recovers sub-resolution geometry by exploiting the SDF structure (smoothness + unit gradient). The neural network acts as an implicit regulariser, biasing the solution toward geometrically plausible shapes.
Limits
Super-resolution is not unlimited: the SNR and the number of views determine how much geometric detail can be reliably recovered. Features significantly smaller than the PSF may not be distinguishable from noise.
ex09-fresnel-two-angles
MediumA planar dielectric interface is observed from two angles and . The measured power reflection coefficients are and . Estimate .
Use .
Solve numerically (e.g., bisection) or analytically for simple cases.
Setup
For TE polarisation:
Numerical solution
At : , . Setting : Taking the positive square root: , giving . Solving: .
Verification at : with gives , close to the measured (consistent within measurement noise).
ex10-eikonal-gradient-compute
MediumDescribe how to compute for a neural SDF implemented as a PyTorch MLP. Write the key PyTorch code fragment.
Use torch.autograd.grad with create_graph=True to enable second-order derivatives.
Code
p = torch.randn(N, 3, requires_grad=True)
sdf = model(p) # shape (N, 1)
grad_sdf = torch.autograd.grad(
outputs=sdf,
inputs=p,
grad_outputs=torch.ones_like(sdf),
create_graph=True # needed for Eikonal loss backprop
)[0] # shape (N, 3)
eikonal_loss = ((grad_sdf.norm(dim=-1) - 1) ** 2).mean()
Explanation
Setting create_graph=True builds the computational graph through the gradient computation, enabling backpropagation of the Eikonal loss through and into . Without create_graph=True, the gradient would not be available.
ex11-occupancy-vs-sdf-normals
MediumCompare the surface normals obtained from (a) a neural SDF and (b) an occupancy network, for a sphere of radius . Which method gives more accurate normals and why?
For the SDF, the normal is .
For occupancy, the normal is .
SDF normals
For the sphere SDF : , which is the exact outward normal. The neural approximation has near the surface (enforced by Eikonal loss), so the normals are accurate.
Occupancy normals
For : . The direction is correct, but the magnitude depends on and decays exponentially away from the surface. For a neural occupancy network, the gradient is noisy because the network learns a near-step function, whose gradient is poorly conditioned.
ex12-geometric-init
HardExplain the geometric initialisation strategy for neural SDFs: initialise the MLP so that for some large . How is this achieved, and why is it important for training convergence?
Atzmon and Lipman (2020) showed that specific weight initialisation of the last layer achieves this.
Without geometric initialisation, the initial SDF may have many disconnected zero level sets.
Initialisation method
For an MLP with layers and skip connections, set the final layer bias to and the final layer weights so that the output approximates . This can be achieved by: (1) using the geometric initialisation of SAL (Atzmon and Lipman, 2020), which sets the last layer to compute the distance from a sphere of radius , or (2) pre-training the MLP on the analytical sphere SDF for a few hundred iterations.
Importance for training
Without geometric initialisation, the random MLP output has many disconnected zero level sets (small "bubbles"). The Eikonal loss and data loss must eliminate all spurious surfaces while growing the correct surface, which is slow and prone to local minima. With geometric initialisation, the SDF starts as a single large sphere that contracts toward the true surface --- a much smoother optimisation path.
ex13-geraf-lensless
HardExplain why NeRF's ray-based sampling (one ray per pixel, sampled along the ray) does not directly apply to radar imaging. How does GeRaF resolve this?
In a camera, each pixel corresponds to one ray direction. In radar, each measurement integrates over all directions within the antenna beam.
The matched filter effectively focuses the radar data into a pseudo-image.
NeRF assumes a lens
NeRF's volume rendering equation integrates density and colour along a single ray per pixel. This works because the camera lens maps each pixel to a unique ray direction, providing angular selectivity. The loss compares rendered pixel colours to observed pixel colours, one ray at a time.
Radar is lensless
Each radar measurement (Tx , Rx , subcarrier ) integrates contributions from all scatterers in the scene, weighted by the Tx-Rx beamforming gain and propagation delay. There is no one-to-one mapping from measurements to spatial directions. Directly applying NeRF's per-ray rendering would require "focusing" the data first.
GeRaF's solution
GeRaF uses the matched filter to produce the MF power image , which concentrates energy at scatterer locations. The MF power image serves as a pseudo-observation analogous to a camera image: each voxel corresponds to a spatial location, and the neural SDF renders the predicted MF power at that location. The L2 loss between observed and predicted MF power drives the training.
ex14-eikonal-sampling
HardThe Eikonal loss requires evaluating at random 3D points. Describe two sampling strategies (uniform and importance-based) and explain their trade-offs.
Uniform sampling in the bounding box is simple but wastes samples in empty space.
Importance sampling near the current zero level set is efficient but requires knowing the current surface estimate.
Uniform sampling
Sample uniformly in the bounding box. Advantage: simple, no bias, enforces the Eikonal equation globally. Disadvantage: most samples fall far from the surface, where the Eikonal constraint is automatically satisfied by a well-initialised network; these samples contribute little useful gradient.
Near-surface importance sampling
Sample points near the current zero level set: where and . Advantage: concentrates samples where the Eikonal constraint matters most. Disadvantage: biased toward the current surface estimate; may miss regions where the SDF is incorrect.
Best practice
Use a mixture: 50% uniform, 50% near-surface. The uniform samples prevent global Eikonal violations; the near-surface samples ensure accurate surface geometry.
ex15-marching-cubes
HardDescribe the marching cubes algorithm for extracting a triangle mesh from a neural SDF evaluated on a grid. What determines the mesh resolution, and what is the computational cost?
Each voxel has 8 corners; the sign of at each corner determines the triangle configuration.
There are cases, reduced to 15 by symmetry.
Algorithm
- Evaluate at all grid vertices.
- For each of the voxels, classify each of 8 corners as inside () or outside ().
- Look up the triangle configuration from a precomputed table of cases.
- For each edge where the sign changes, interpolate the vertex position using .
Resolution and cost
The mesh resolution is determined by the grid spacing where is the scene size. Features smaller than are aliased. The computational cost is for the MLP evaluations (the bottleneck) plus for the marching cubes lookup (negligible). For , this requires million MLP evaluations.
ex16-material-ambiguity
HardExplain the geometry-reflectivity ambiguity in single-view radar imaging: given a single MF power measurement , show that the pair is not uniquely determined. How does multi-view data resolve this?
A strong MF return could be a nearby highly reflective surface or a distant weakly reflective surface.
Multiple views change the incidence angle, which affects reflectivity differently than geometry.
Single-view ambiguity
The rendered MF power is . A high observed power can be explained by: (1) large and (strong reflector on the surface), or (2) moderate and with a different surface shape that concentrates the MF response. The product admits infinitely many factorisations from a single observation.
Multi-view resolution
Different views observe the same surface at different incidence angles. The geometry (SDF) is view-independent, but the effective reflectivity varies with angle (Fresnel coefficients). By requiring the SDF to explain all views simultaneously, the geometry is fixed, and the reflectivity is then determined by the residual. With views at sufficiently different angles, the ambiguity is resolved.
ex17-sigma-annealing
ChallengeIn GeRaF's rendering equation, the surface delta function is approximated by . Propose and justify an annealing schedule for during training.
Large at the start makes the loss landscape smoother (easier to optimise).
Small at the end concentrates the scattering on the surface (more accurate).
Annealing schedule
Start with (e.g., several voxel widths) and decay exponentially: with chosen so that (one voxel width or less).
Justification
- Large (early training): The smoothed delta spreads the gradient signal over a wide region around the current surface, enabling the SDF to capture coarse geometry even when the initial surface is far from the truth.
- Small (late training): The delta concentrates on the surface, forcing the SDF to precisely locate it. If is small from the start, the gradient signal is too localised and the surface cannot move to the correct position.
Connection to curriculum learning
This annealing is analogous to curriculum learning: coarse-to-fine optimisation avoids bad local minima. NeuS (Wang et al., 2021) uses a similar annealing for the logistic density function in SDF-based volume rendering.
ex18-multi-material-scene
ChallengeDesign a neural architecture for jointly estimating the SDF and per-point material classification (concrete, glass, metal, drywall) from multi-view radar data. Define the loss function and explain how the discrete material classes interact with the continuous SDF.
Use a shared backbone with separate output heads for SDF and material class.
Each material class has a known permittivity range, which constrains the Fresnel reflection.
Architecture
A shared MLP backbone feeds two heads:
- SDF head: .
- Material head: , where (concrete, glass, metal, drywall).
Loss function
\mathcal{L}{\text{mat}} = -\sum_q \sum_k m_k^*(\mathbf{p}q) \log m{k,\theta}(\mathbf{p}q)\mathcal{L}{\text{mat}} = \text{entropy}(\mathbf{m}\theta)$ to encourage low-entropy (decisive) classifications.
Material-SDF interaction
The Fresnel reflection coefficient depends on , which is determined by the material class. The rendered MF power uses , where is the Fresnel coefficient for material at incidence angle . This makes the data fidelity loss depend on the material classification, providing a self-supervised signal for material segmentation.
ex19-primitive-vs-neural
ChallengeCompare the primitive-based SDF approach (representing a room as unions of half-spaces and cylinders) with the neural SDF approach for indoor RF imaging. Under what conditions does each approach perform better?
Primitive-based: few parameters, exact SDFs, but limited expressiveness.
Neural: flexible, can represent arbitrary shapes, but requires more data and training.
Primitive-based advantages
- Exact Eikonal: No need for Eikonal regularisation; the analytical SDFs satisfy exactly.
- Few parameters: An L-shaped room is described by parameters (wall positions, corner locations).
- Interpretability: Parameters have physical meaning (wall position = 3.5 m).
- Fast inference: No MLP evaluation; SDF computation is per point.
Neural SDF advantages
- Expressiveness: Can represent arbitrary shapes (furniture, curved surfaces, irregular geometry).
- Data-driven: Learns from measurements without manual scene modelling.
- Joint optimisation: Geometry and materials are optimised end-to-end.
Recommendation
Use primitives when the scene is well-modelled by simple shapes (empty rooms, corridors, warehouses). Use neural SDFs when the scene contains complex or unknown geometry. A hybrid approach --- primitive backbone with neural residual --- combines the strengths of both: the primitives capture the dominant structure, and the neural network refines the details.
ex20-convergence-analysis
ChallengeConsider the simplified 1D case: a neural SDF trained on a single surface point with the loss . Show that the minimiser is (up to sign) and discuss the convergence rate.
and a.e. implies .
In 1D, the Eikonal equation has only two solutions passing through any given point.
Characterising the minimiser
The first term forces . The Eikonal term forces for all . The only continuous functions satisfying both are and (in the SDF convention, with positive to the right). Both are valid SDFs for the surface .
Connection to the absolute value
The true signed distance to the point on the real line is , which is the unsigned distance. However, is not differentiable at . The smooth neural approximation for small satisfies away from and transitions smoothly at .
Convergence rate
Under gradient descent with learning rate , the Eikonal term converges at rate (for smooth losses), while the surface term converges exponentially. The overall convergence is limited by the Eikonal term and depends on the MLP architecture (depth, width, activation function).