Abstract
Shadow Director is a lightweight framework that provides precise, parametric control over shadows—including intensity, shape, and light position—during the portrait generation process in diffusion models. By optimizing latent features at test-time using a small network trained on just 5,000 synthetic images, it achieves superior identity preservation and stylistic consistency compared to massive, data-hungry baselines.
1. Introduction
While text-to-image models like Stable Diffusion excel at creating stunning portraits, controlling lighting—specifically shadows—remains a significant challenge. Digital artists typically face two suboptimal choices: unpredictable prompt engineering, which often alters the subject's identity or art style, or post-processing tools like IC-Light and SwitchLight. These existing tools often suffer from "identity shift," where the subject's features change during relighting, and they require massive datasets (up to 10 million images) for training. Shadow Director addresses this gap by providing a resource-efficient method to control shadows during the generation process while maintaining strict identity preservation across diverse artistic styles.
2. Methodology
The core philosophy of Shadow Director is that well-trained diffusion models implicitly encode lighting and geometry data within their intermediate latent features. The system utilizes three primary components:
- Estimators: Two compact neural networks—a Shadow-Depth (SD) Estimator and an Identity (ID) Estimator—operate on the internal feature maps of the UNet during denoising.
- Shadow Acquisition: Users define target shadows using 2D binary masks or by placing 3D light sources, which are converted into shadow maps via ray casting against estimated depth maps.
- Latent Feature Optimization: During the denoising process (specifically at step 40 of 100), the model pauses to calculate a loss based on shadow alignment and identity embedding. The system then backpropagates this loss to update the latent features—rather than the model weights—before resuming generation.
This approach is fundamentally different from standard fine-tuning; it manipulates the representation of the image as it is being formed, rather than retraining the model's underlying weights.
3. Experimental Setup and Data Efficiency
Shadow Director is remarkably data-efficient. While competitors require millions of samples, this framework was trained on only 5,000 synthetic images generated from 1,000 CelebA identities. Training required approximately 8 hours on two A6000 GPUs. Evaluation was conducted using 800 unseen portrait images generated from text prompts to benchmark against state-of-the-art baselines.
4. Key Results
Shadow Director outperformed baselines in both objective metrics and human preference studies:
- Identity Preservation: The model achieved a CLIP Vision Score (CVS) of 0.9460, significantly higher than IC-Light (0.9140) and DiFaReli (0.9049), indicating that the subject's face remains consistent under varying light.
- Shadow Alignment: The Vision-Text Alignment (CVTA) score of 0.2692 confirmed that shadows are placed accurately according to user requests.
- User Preference: In a user study, Shadow Director was preferred 45.69% of the time, nearly doubling the score of the next best competitor.
- Efficiency: The framework adds only about 20% additional computation time to a standard SDXL inference run.
5. Discussion and Limitations
Research indicates a "sweet spot" for optimization during the early-to-middle stages of denoising ($t=0.5$ to $0.7$). Intervening too early results in unstable geometry, while late intervention struggles to override established lighting schemes.
Current limitations include a domain bias toward close-up portraits due to the CelebA training set and occasional overrides by strong lighting instructions in text prompts. Future work will focus on expanding the training set to include more diverse poses and clothing, as well as adding parametric controls for light color and multi-light configurations.
Summary updated