VSDiffusion: Taming Ill-Posed Shadow Generation via Visibility-Constrained Diffusion
Abstract
Generating realistic cast shadows for inserted foreground ob-jects is a crucial yet challenging problem in image composition, wheremaintaining geometric consistency between objects and their shadows incomplex scenes remains difficult due to the ill-posed nature of shadowformation. To address this challenge, we propose VSDiffusion, a visibility-constrained two-stage framework that narrows the solution space by in-corporating visibility priors. In Stage I, a coarse shadow mask is pre-dicted to localize plausible shadow regions. In Stage II, conditional dif-fusion guided by lighting and depth cues estimated from the compositeimage is used to generate accurate shadows. Within VSDiffusion, visibil-ity priors are injected through two complementary pathways: (1) a vis-ibility control branch with shadow-gated cross-attention that providesmulti-scale structural guidance, and (2) a learned soft prior map thatreweights the training loss in error-prone regions to encourage geometriccorrection. In addition, we introduce a high-frequency guided enhance-ment module to sharpen shadow boundaries and improve texture inter-action with the background. Extensive experiments on the widely usedDESOBAv2 benchmark demonstrate that VSDiffusion produces geomet-rically consistent shadows in complex scenes and establishes new state-of-the-art results across most evaluation metrics. The code is availableat https://github.com/Jadelingli/VSDiffusion.