3D-aware Blending with Generative NeRFs

Hyunsu Kim, Gayoung Lee, Yunjey Choi, Jin-Hwa Kim, Jun-Yan Zhu · DOI

Abstract

Traditional image blending methods operate on 2D pixel grids, often failing when source and target images are misaligned in 3D pose or shape. We present a novel 3D-aware blending framework that leverages generative Neural Radiance Fields (NeRFs). By performing blending in a 3D latent space and optimizing for volume density, our method achieves seamless composition of unaligned images with high photorealism and multi-view consistency.

Introduction

Image blending is a fundamental task in computer vision and graphics, aiming to combine a reference foreground into an original background. However, existing 2D techniques—ranging from Poisson blending to GAN-based inversion—struggle with "out-of-plane" rotations and geometric discrepancies. When a reference object’s pose or shape differs from the target, 2D warping often results in ghosting or blurred textures. This paper proposes a shift in perspective: performing the blend in a 3D latent space rather than on a 2D canvas.

Methodology

The proposed method leverages Generative NeRFs (specifically the EG3D architecture) as a prior for 3D geometry. The pipeline consists of two primary stages:

1. 3D-aware Alignment

To resolve pose discrepancies, the system first estimates 3D camera poses for both images using a CNN encoder. The reference image is then re-rendered from the target's viewpoint. For local geometric alignment (e.g., matching the position of ears), 3D meshes are extracted via Marching Cubes, and Iterative Closest Point (ICP) is used to calculate a precise 3D transformation (scale and translation) that snaps the reference feature onto the original.

2. 3D-aware Blending

Instead of simple pixel interpolation, the method optimizes a latent code in the NeRF’s $W+$ space. A key innovation is the Density-blending loss. While standard losses match colors (L1 and LPIPS), the density loss ensures the 3D volumetric structure of the blended result matches the reference's geometry while maintaining the background's density from the original image. This allows the model to preserve complex, highly-structured geometries like hair or glasses.

Comparison of 2D blending vs. the proposed 3D-aware approach.

Experimental Results

The model was evaluated on human faces (FFHQ/CelebA-HQ), cats (AFHQv2), and cars (ShapeNet).

Qualitative Performance

As shown in the figure below, the 3D-aware approach handles significant misalignments that cause 2D methods to fail. It successfully preserves complex structures like hair flow and ear geometry, even when the reference and original images have different orientations. Because the blend happens in 3D, the final result is multi-view consistent; it can be rotated and viewed from different angles.

Qualitative comparison of blending results under varying degrees of alignment.

Quantitative and User Study

The method achieved a Kernel Inception Distance (KID) of 0.002 on CelebA-HQ, significantly outperforming SDEdit (0.008). In user studies, the proposed method was preferred in over 80% of cases against Poisson blending and 60-70% against state-of-the-art GAN-based methods like StyleMapGAN.

Conclusion

By integrating 3D geometric priors into the blending pipeline, this work overcomes the fundamental limitations of 2D pixel-based composition. While currently limited by latent inversion quality and processing time (~45s on an A100), it paves the way for more robust and realistic content creation tools that understand the 3D nature of the world. Future work may involve training dedicated encoders to replace the optimization step, potentially enabling real-time performance.

Summary updated

BibTeX
@inproceedings{kim2023d,
  author = {Hyunsu Kim and Gayoung Lee and Yunjey Choi and Jin-Hwa Kim and Jun-Yan Zhu},
  title = {{3D-aware Blending with Generative NeRFs}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
  doi = {10.1109/iccv51070.2023.02094},
}
Figure