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
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.
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.
Caching preprocessed tensors to disk avoided reopening HDF5 files and repeating preprocessing each epoch, improving GPU utilization during training.
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.
| Experiment | Change | Observation |
|---|---|---|
| Camera vs. world-space normals | Changed the coordinate frame of the normal inputs. | World-space normals gave slightly better spatial coherence. |
| Reconstruction loss | Added L1 loss on reflectance × predicted illumination. | Clearest visible improvement in broad lighting structure. |
| Gradient loss | Compared horizontal and vertical illumination gradients. | More spatial variation; sharp shadow boundaries remained inaccurate. |
| Model capacity | Doubled feature widths from base-32 to base-64. | Slightly lower loss with little visible improvement. |
| Perceptual loss | Compared reconstructions in VGG16 feature space. | Small brightness changes without recovering sharp edges. |
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.
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.
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.







