Parametric Shadow Control for Portrait Generation in Text-to-Image Diffusion Models

Haoming Cai, Tsung-Wei Huang, Shiv Gehlot, Brandon Y. Feng, Sachin Shah, Guan-Ming Su, Christopher Metzler

TL;DR

This paper introduces "Shadow Director," a novel method for precise, parametric control over shadows in AI-generated portraits. It achieves this by extracting and manipulating implicit shadow information within pre-trained diffusion models, offering intuitive control over shadow shape, placement, and intensity without requiring extensive retraining or expensive real-world data.

What Problem Does This Paper Address?

Generating diverse and realistic portraits with diffusion models has become remarkably advanced. However, controlling specific attributes like shadows remains a significant challenge. Existing methods often rely on post-processing, which can lead to identity shifts or style inconsistencies, or require vast amounts of data and computational resources for training. Prompt engineering, while flexible, lacks the fine-grained, intuitive control needed for precise shadow manipulation. This leaves artists and researchers without an accessible and effective way to precisely shape and position shadows in AI-generated portraits across various artistic styles.

Methods

Shadow Director tackles this by leveraging the rich, implicit information already encoded within well-trained diffusion models. The core of the method consists of two compact neural network "estimators" that operate on the UNet's internal feature maps during the diffusion model's denoising process:

  • Shadow-Depth (SD) Estimator: This component extracts 2D shadow and depth maps from the noisy latent features. This allows the system to understand and predict the shadow characteristics present at a given stage of generation.
  • Identity (ID) Estimator: This crucial component generates "ID embeddings" that capture the subject's identity. By comparing these embeddings to a reference, the method ensures that shadow manipulations do not alter the subject's appearance or artistic style.

Shadow control is achieved through test-time optimization. At an early denoising step, the process pauses, and the latent feature map is optimized. This optimization aims to minimize the difference between the current estimated shadow and a user-defined target shadow, while simultaneously ensuring the identity embeddings remain consistent. Users can control shadow intensity, shape (via masks), and light position (via ray casting).

A key innovation is the synthetic training dataset used for training the SD and ID estimators. This dataset, derived from the CelebA dataset and rendered using GeomConsistentFR, requires only a few thousand images and a few hours of training on a single GPU, making the approach highly resource-efficient.

Datasets

  • Training Data: A custom synthetic dataset was created using the CelebA dataset. For each identity, six lighting variations were rendered using GeomConsistentFR, resulting in approximately 6,000 synthetic images. This dataset was split into 5,700 for training and 300 for validation.
  • Evaluation Data: The paper evaluates its method on 800 unseen portrait images generated from text prompts.

Key Insights and Ideas

  • Implicit Shadow Information: Well-trained diffusion models inherently encode detailed shadow information within their latent representations, which can be accessed and manipulated without retraining the entire model.
  • Resource Efficiency: By focusing on extracting existing information rather than learning from scratch or using expensive real-world data, Shadow Director achieves effective shadow control with minimal training data and computational resources.
  • Identity Preservation is Crucial: Simply optimizing for shadow changes can lead to significant identity distortions. The dedicated ID Estimator is essential for maintaining subject consistency and artistic style.
  • Test-Time Optimization: Performing optimization in the latent space during the generation process allows for flexible and intuitive control over attributes like shadows.
  • Synthetic Data Sufficiency: Even with limited photorealism, carefully constructed synthetic data can be sufficient to train models that effectively leverage the internal representations of diffusion models for attribute manipulation.

Key Results

  • Parametric Control: Shadow Director enables intuitive control over shadow intensity (weak to strong), shape (via user-defined masks), and directional light position.
  • Identity and Style Preservation: The method consistently preserves identity and artistic style across diverse portrait styles, outperforming baseline methods like IC-Light and DiFaReli, which often exhibit identity shifts.
  • Efficiency: Training the SD and ID estimators takes approximately 8 hours on a single NVIDIA A6000 GPU. Inference adds only about 20% additional computation time compared to standard SDXL inference.
  • Quantitative Metrics: The paper reports strong performance in metrics like CVTA (CLIP Vision-Text Alignment) and CVS (CLIP Vision Score) for identity preservation and image authenticity, outperforming several baselines. For example, their method achieved a CVS of 0.9460, compared to 0.9140 for IC-Light.
  • User Studies: A user study indicated a strong preference for Shadow Director, with 45.69% of users preferring its results, significantly higher than other methods.

Limitations and Future Work

  • Dataset Limitations: The current model is trained on the CelebA dataset, which primarily features close-up, straight-on portraits with simple clothing. This can make preserving intricate garment details in full-body images challenging. Future work could involve expanding dataset diversity.
  • Text Prompt Dominance: Strong lighting effects specified in text prompts (e.g., "neon lighting") can sometimes override Shadow Director's control.
  • Lighting Temperature: The model does not explicitly handle lighting temperature, which can lead to inconsistencies in color tone.
  • Future Directions: The authors suggest exploring broader datasets and enhanced lighting models. They also highlight that their approach paves the way for more accessible shadow control methods for researchers with limited resources.

Summary updated

BibTeX
@inproceedings{cai2025parametric,
  author = {Haoming Cai and Tsung-Wei Huang and Shiv Gehlot and Brandon Y. Feng and Sachin Shah and Guan-Ming Su and Christopher Metzler},
  title = {{Parametric Shadow Control for Portrait Generation in Text-to-Image Diffusion Models}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2025},
}
Figure