MultiShadow: Multi-Object Shadow Generation for Image Compositing via Diffusion Model

Waqas Ahmed, Dean Diepeveen, Ferdous Sohel

Abstract

Realistic shadow generation is crucial for achieving seamless image compositing, yet existing methods primarily focus on single-object insertion and often fail to generalize when multiple foreground objects are composited into a background scene. In practice, however, modern compositing pipelines and real-world applications often insert multiple objects simultaneously, necessitating shadows that are jointly consistent in terms of geometry, attachment, and location. In this paper, we address the under-explored problem of multi-object shadow generation, aiming to synthesize physically plausible shadows for multiple inserted objects. Our approach exploits the multimodal capabilities of a pre-trained text-to-image diffusion model. An image pathway injects dense, multi-scale features to provide fine-grained spatial guidance, while a text-based pathway encodes per-object shadow bounding boxes as learned positional tokens and fuses them via cross-attention. An attention-alignment loss further grounds these tokens to their corresponding shadow regions. To support this task, we augment the DESOBAv2 dataset by constructing composite scenes with multiple inserted objects and automatically derive prompts combining object category and shadow positioning information. Experimental results demonstrate that our method achieves state-of-the-art performance in both single and multi-object shadow generation settings.

Introduction

Image compositing—the process of integrating foreground objects into a new background—relies heavily on realistic shadows to create a convincing visual illusion. While recent advancements have improved shadow generation for single objects, synthesizing shadows for multiple objects simultaneously remains a significant challenge. Existing methods often struggle with two primary issues:

  1. Global Consistency: In multi-object scenes, all shadows must adhere to a unified light source in terms of direction and intensity. Sequential generation often leads to "error accumulation," resulting in inconsistent shadows.
  2. Association: Models frequently fail to correctly associate shadows with their respective parent objects, leading to "shadow bleeding" or detached shadows.

MultiShadow addresses these challenges by leveraging a diffusion-based framework designed for global consistency and precise object-shadow association.

Methodology

MultiShadow utilizes a dual-pathway architecture built upon a pre-trained Stable Diffusion backbone to ensure both spatial precision and semantic coherence.

The MultiShadow architecture featuring the dual-pathway approach: an image pathway for spatial guidance and a text-grounded layout pathway for shadow positioning.

Dual-Pathway Architecture

  • Image Pathway: A feature encoder processes the shadow-free composite and object masks. It employs Geometry-Aware Affine Modulation (GAAM) to inject multi-scale spatial features into the UNet, providing the pixel-level guidance necessary for accurate shadow shape and attachment.
  • Text-Grounded Layout Pathway: This core innovation uses a Shadow-Box Predictor to estimate bounding boxes for each shadow. These coordinates are converted into discrete Shadow Positional Tokens (SPT) and integrated into the text prompt (e.g., "a girl casting shadow [sx_0][sy_11]..."). This allows the model to leverage the semantic priors of the diffusion model regarding shadow casting.

Attention-Alignment Loss (AAL)

To ensure the model effectively utilizes the SPTs, an Attention-Alignment Loss is introduced. This loss forces the model's internal cross-attention maps to align with ground-truth shadow regions, effectively "anchoring" text tokens to specific spatial locations and preventing interference between multiple objects.

Data and Training

The researchers extended the DESOBAv2 dataset to create Multi-Object DESOBAv2, a training set of approximately 38,755 images featuring composite scenes with multiple objects. To enhance the training process, they employed ViP-LLaVA to automatically generate descriptive prompts that identify object categories and interactions (e.g., "riding," "sitting"), providing rich context for the diffusion process.

Results and Discussion

MultiShadow achieves state-of-the-art (SOTA) performance across both single and multi-object benchmarks.

Qualitative comparison of MultiShadow against baseline methods, demonstrating superior shadow attachment and consistency in multi-object scenes.

Quantitative and Qualitative Performance

On the extended DESOBAv2 test set, MultiShadow significantly outperformed baselines such as SGDiffusion and MetaShadow. Notably, in complex scenes with five or more objects, MultiShadow maintained a Balanced Error Rate (BER) of 0.426, whereas the next best diffusion-based model's error rose to 0.662. Qualitatively, the model produces cleaner "attachment" at the base of objects and maintains consistent shadow directions across complex environments. A user study with over 100 participants confirmed a strong preference for MultiShadow's physically plausible and coherent results.

Conclusion

MultiShadow represents a significant step forward in multi-object shadow generation. By combining dense image features with text-grounded layout tokens, it achieves unprecedented consistency and realism. While the system currently depends on the accuracy of its shadow-box predictor and faces challenges in complex multi-light environments, it provides a robust framework for future research in high-fidelity image compositing. Future work may explore integrating light-source estimation or more complex shape priors to further refine shadow synthesis.

Summary updated

Abstract

Realistic shadow generation is crucial for achieving seamless image compositing, yet existing methods primarily focus on single-object insertion and often fail to generalize when multiple foreground objects are composited into a background scene. In practice, however, modern compositing pipelines and real-world applications often insert multiple objects simultaneously, necessitating shadows that are jointly consistent in terms of geometry, attachment, and location. In this paper, we address the under-explored problem of multi-object shadow generation, aiming to synthesize physically plausible shadows for multiple inserted objects. Our approach exploits the multimodal capabilities of a pre-trained text-to-image diffusion model. An image pathway injects dense, multi-scale features to provide fine-grained spatial guidance, while a text-based pathway encodes per-object shadow bounding boxes as learned positional tokens and fuses them via cross-attention. An attention-alignment loss further grounds these tokens to their corresponding shadow regions. To support this task, we augment the DESOBAv2 dataset by constructing composite scenes with multiple inserted objects and automatically derive prompts combining object category and shadow positioning information. Experimental results demonstrate that our method achieves state-of-the-art performance in both single and multi-object shadow generation settings.
BibTeX
@misc{ahmed2026multishadow,
  author = {Waqas Ahmed and Dean Diepeveen and Ferdous Sohel},
  title = {{MultiShadow: Multi-Object Shadow Generation for Image Compositing via Diffusion Model}},
  year = {2026},
  eprint = {2603.02743},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.02743},
}
Figure