GPSDiffusion-Object-Shadow-Generation

February 24, 2026 ยท View on GitHub

This is the official repository for the following paper:

Shadow Generation Using Diffusion Model with Geometry Prior [pdf] [supp]

Haonan Zhao, Qingyang Liu, Xinhao Tao, Li Niu, Guangtao Zhai
Accepted by CVPR 2025.

Object shadow generation aims to generate plausible shadow for the inserted object in the composite image. We propose Geometry Prior guided Shadow generation Diffusion model (GPSDifffusion), which significantly improves the shadow geometry. The visual comparision between SGDiffusion and our GPSDiffusion is shown below. From left to right, we show the composite image, foreground mask, the result of SGDiffusion, the result of our GPSDiffusion, and ground-truth.

We also provide the visual comparison with other baselines below.

GPSDiffusion has been integrated into our image composition toolbox libcom. Note that the performance of GPSDiffusion is unstable, so you need to generate multiple results and pick the most satisfactory one.

๐Ÿ“ข News

[2025/7/02] GPSDiffusion-SDXL is available now!

Online Demo

Our GPSDiffusion has been integrated into libcom toolbox. Try this online demo for image composition (object insertion) built upon libcom toolbox and have fun!

![]

Installation

Environment

conda create -n GPSDiffusion python=3.8
conda activate GPSDiffusion
pip install -r requirements.txt

Training

python train_GPSDiffusion.py

Inference

python infer_GPSDiffusion.py

Post-processing

python post_processing.py

Evaluation

python eval.py

Other Resources