Zoe Homan Neural Shading
All work
03Machine Learning2026

Neural Shading for Indoor Architectural Scenes

I trained a U-Net to predict diffuse illumination in indoor scenes using surface normals, depth, and material reflectance from the Hypersim dataset. Across five training experiments, the model learned broad lighting patterns but struggled to reproduce sharp shadows and contact boundaries.

Type
Research project
Deep Learning for Computer Graphics
Role
Solo. Pipeline, model, experiments, analysis
Advisor
Prof. Corey Toler-Franklin
Stack
PyTorch · U‑Net · HDF5 · AWS (Tesla T4)
Data
Hypersim. ~2,000 samples, 10 scenes, 80/20 split
Eight-panel comparison: input normals, depth and reflectance buffers with ground-truth illumination on top; predicted illumination, error map, and both reconstructions below
Top: surface normals, depth, reflectance, and ground-truth illumination. Bottom: predicted illumination, error map, and target and predicted reconstructions; errors concentrate at edges and object contacts.
01

Data and model

Following Nalbach et al.’s Deep Shading, I trained a network to map per-pixel scene attributes to diffuse illumination. Hypersim provides synthetic interiors with separate reflectance, illumination, and non-diffuse residual buffers, allowing illumination to serve as the supervised target.

A photorealistic rendered interior beside its per-pixel buffers: diffuse reflectance, diffuse illumination, and a non-diffuse residual
Hypersim rendering and its reflectance, illumination, and non-diffuse residual buffers.Figure from Roberts et al., Hypersim (ICCV 2021).

Inputs: seven channels — three surface-normal channels, one log-scaled depth channel, and three diffuse-reflectance channels. Output: three-channel diffuse illumination, tone mapped with x / (1 + x).

The base U-Net encoder uses 32, 64, and 128 feature channels with a 256-channel bottleneck at 32 × 32. The decoder upsamples and concatenates skip features. Multiplying reflectance by predicted illumination reconstructs diffuse appearance.

Pipeline diagram: scene buffers preprocessed and concatenated, passed through a U-Net encoder and decoder with skip connections, producing illumination that is multiplied by reflectance to reconstruct appearance
Preprocessed inputs pass through the U-Net; predicted illumination is multiplied by reflectance to reconstruct diffuse appearance. Experiments vary illumination, reconstruction, and gradient losses.

Caching preprocessed tensors to disk avoided reopening HDF5 files and repeating preprocessing each epoch, improving GPU utilization during training.

02

Training experiments

The baseline used L1 loss between predicted and ground-truth illumination. I compared five changes to the inputs, training losses, and model capacity.

Training experiments and observed changes
ExperimentChangeObservation
Camera vs. world-space normalsChanged the coordinate frame of the normal inputs.World-space normals gave slightly better spatial coherence.
Reconstruction lossAdded L1 loss on reflectance × predicted illumination.Clearest visible improvement in broad lighting structure.
Gradient lossCompared horizontal and vertical illumination gradients.More spatial variation; sharp shadow boundaries remained inaccurate.
Model capacityDoubled feature widths from base-32 to base-64.Slightly lower loss with little visible improvement.
Perceptual lossCompared reconstructions in VGG16 feature space.Small brightness changes without recovering sharp edges.
Model output using illumination loss only: numerically converged but visually flat and averaged
Illumination loss only. Predictions are smooth and lack lighting variation.
Model output with reconstruction loss added: global lighting structure returns and the reconstruction tracks ground truth much more closely
With reconstruction loss. Broad brightness patterns more closely follow the target.

Over 20 epochs, base-32 total training loss fell from 0.142 to 0.070 and test loss from 0.118 to 0.068. Base-64 reached a slightly lower loss in fewer epochs, with little visible difference in the output. Similar training and test curves do not establish generalization to new scenes.

Training and test loss curves for the base-32 model over twenty epochs, both falling together with no divergence
Base-32 training and test total loss over 20 epochs.
Training and test loss curves for the base-64 model, reaching a lower floor in fewer epochs
Base-64 training and test total loss; increased capacity lowered the loss slightly.
03

Results and limitations

The best model used world-space normals with reconstruction and gradient loss. It captured broad brightness differences and light falloff, while sharp shadows, corner darkening, occlusion boundaries, and contact regions remained inaccurate. The opening comparison shows errors concentrated along edges and object contacts.

Output from the first CPU prototype on a single scene, collapsing almost entirely to a flat average
First CPU prototype, trained on a single scene. Its output is nearly uniform, before the later training changes.

Inputs describe visible surfaces from one viewpoint. They omit light-source positions and intensities, occluded geometry, visibility relationships, and wider scene context. These omissions are plausible contributors to the remaining errors.

The dataset was small: roughly 2,000 samples from 10 scenes, using an 80/20 split. The source material does not establish whether the split was by scene. These experiments do not rule out dataset size, capacity, or loss design as further sources of error.

References

  • Nalbach et al., Deep Shading: Convolutional Neural Networks for Screen-Space Shading (2017).
  • Roberts et al., Hypersim: A Photorealistic Synthetic Dataset for Holistic Indoor Scene Understanding (ICCV 2021). Source of the dataset and buffer-decomposition figure above.
Next project · 04
Color Correct
Case study