Abstract
Relighting outdoor scenes from a single RGB image is a significant challenge in computer vision, primarily due to the non-local nature of cast shadows. Traditional methods often require multi-view geometry, while standard 2D neural networks struggle to maintain physical consistency over long distances. We present OutCast, a novel framework that integrates traditional ray-marching principles with a learned 3D representation. By utilizing a specialized 3D ray-marching layer and an epipolar volume, OutCast successfully predicts complex, long-range cast shadows even when the underlying geometry—estimated from a single view—is noisy or incomplete.
Introduction
Changing the sun's position or the sky's color in a single outdoor photograph is a "holy grail" task in computer graphics. While local surface shading can be approximated, predicting cast shadows remains the primary bottleneck. Shadows are inherently non-local: an object on one side of a scene can cast a shadow on a surface far away.
Accurate shadow calculation typically requires a high-fidelity 3D model. Previous state-of-the-art approaches relied on multi-view stereo (MVS) to reconstruct a 3D proxy from dozens of images. Single-image alternatives have historically used 2D neural networks (such as U-Nets), but these architectures lack the spatial awareness to handle long-range geometric interactions, often resulting in blurry or physically impossible shadows. OutCast bridges this gap by introducing a geometric inductive bias into a deep learning pipeline.
Methodology
OutCast employs a hybrid approach that combines classic screen-space graphics techniques with deep neural networks. The pipeline consists of several key stages:
1. Monocular Depth Estimation
The framework begins by estimating the scene's geometry using an off-the-shelf monocular depth estimator (MiDaS). While these depth maps provide a rough 3D shape, they are often "bumpy" and lack information regarding occluded regions (the "behind" of visible objects).
2. Learned Ray-Marching and Epipolar Volumes
To overcome the limitations of 2D convolutions, OutCast introduces a 3D ray-marching layer. For every pixel, the system "marches" a ray toward the target light source. Rather than relying solely on absolute depth, the system stores the ratio between the ray's depth and the estimated surface depth into a 3D volume, known as an epipolar volume. This "shadow ratio" makes the features scale-invariant, allowing the model to generalize across diverse scenes, from close-up architecture to vast landscapes.
3. 3D-2D Encoder-Decoder
This volume is processed by 3D convolutions, providing the network with a geometric "cheat sheet." This architecture forces the model to look for occluders specifically along the path of light, effectively teaching the network the physics of shadow formation.
4. Refinement and Relighting
A dedicated refinement network ($R$) cleans the predicted shadow masks, while a final relighting network ($L$) integrates these shadows with the original image, surface normals, and target light directions to produce the final RGB output. The model is trained using a combination of Mean Squared Error (MSE), Perceptual Similarity (E-LPIPS), and an adversarial loss (LSGAN) to ensure visual sharpness.
Training and Data
Because ground-truth relighting for real-world scenes is nearly impossible to capture, the authors utilized synthetic data:
- Training Set: 164,000 images rendered from 40 high-quality "Evermotion Archexterior" 3D scenes using the Cycles path tracer and the Nishita sky model.
- Robustness Strategy: A critical insight was the training distribution. By training on a mix of ground-truth depth and noisy, estimated depth (an 80/20 split), the network learned to remain robust to the distortions inherent in monocular depth estimation.
Key Results
OutCast demonstrates significant improvements over existing baselines such as Pix2PixHD and standard 2D CNNs.
- Quantitative Performance: The method achieved the lowest error rates across DSSIM, LPIPS, and MSE metrics. Notably, it outperformed "direct" ray-marching on noisy depth, proving that the learned component is vital for correcting geometric errors.
- Qualitative Fidelity: The framework produces sharp, believable shadows that accurately follow the contours of the terrain. It successfully removes existing shadows from the input and replaces them with new ones consistent with the target sun position.
- Generalization: Despite being trained on synthetic architectural renders, the model generalizes remarkably well to real-world photographs and even historical landscape paintings, such as those by Canaletto.
Limitations and Future Work
While OutCast represents a leap forward in single-image relighting, some limitations remain:
- Out-of-Frame Occluders: The model cannot account for shadows cast by objects located behind the camera or outside the image frame.
- Light Source Complexity: The current iteration assumes a single dominant light source (the sun) and does not explicitly model complex global illumination effects like caustics or multi-light setups.
- Input Requirements: Users must provide an estimate of the original sun position in the input photograph.
Future research may apply this "learned ray-marching" architecture to other domains, such as material editing or more complex global illumination tasks.
Summary updated