FaceDNeRF: Semantics-Driven Face Reconstruction, Prompt Editing and Relighting with Diffusion Models

Hao Zhang, Tianyuan Dai, Yanbo Xu, Yu-Wing Tai, Chi-Keung Tang

Reconstructing a 3D face from a single 2D photo is a classic "holy grail" of computer vision. While the field has made significant strides in the reconstruction part, editing those faces—changing an expression, adding a beard, or moving the light source—while keeping the person looking like themselves in 3D has remained notoriously difficult.

To tackle this, researchers have introduced FaceDNeRF, a framework that bridges the gap between high-fidelity 3D GANs and the semantic flexibility of 2D diffusion models.

TL;DR

FaceDNeRF allows users to reconstruct a photorealistic 3D face (NeRF) from a single image and then edit it using text prompts (e.g., "an old man") or explicit lighting controls. By using a 2D diffusion model to guide a 3D-aware GAN, it achieves high-quality, 3D-consistent edits in about 10 minutes—significantly faster and more realistic than previous optimization-based methods.

FaceDNeRF Capabilities

What Problem Does This Paper Address?

The field currently faces a "trilemma" in 3D face manipulation:

  1. Photorealism: 3D GANs (like EG3D) produce beautiful faces but are hard to control with text.
  2. Semantic Control: 2D Diffusion models (like Stable Diffusion) can edit anything via text but struggle to maintain 3D consistency across different viewing angles.
  3. Efficiency: Existing text-to-3D methods (like DreamFusion) often take hours to optimize and frequently produce "blurry" or "melty" geometry when applied to human faces.

FaceDNeRF addresses the lack of a unified pipeline that can perform reconstruction, semantic editing, and relighting simultaneously while preserving the subject's identity.

Methods

The core innovation of FaceDNeRF is how it combines existing heavy-hitters in AI:

  • The Backbone (EG3D): The researchers use a pre-trained EG3D model, a 3D-aware GAN. Instead of training a new 3D model from scratch, they optimize the latent vector ($W+$ space) of this GAN. This ensures the output always stays within the "manifold" of realistic human faces.
  • The Guide (Stable Diffusion via SDS): To enable text editing, they use Score Distillation Sampling (SDS). Essentially, a frozen 2D Stable Diffusion model looks at the 3D renders and provides "gradients" that tell the GAN's latent vector how to change to match the text prompt (e.g., "add a pair of glasses").
  • Differentiable Relighting: They incorporate a novel illumination loss. By using a differentiable hourglass network to estimate Spherical Harmonics (SH) lighting coefficients, users can explicitly define a target light source, and the model adjusts the 3D face's appearance accordingly.
  • The Loss Function Balance: To keep the person looking like themselves, the authors use a combination of a Reconstruction Loss (keeps the background and basic features), an Identity Loss via ArcFace (ensures the "face signature" remains the same), and a Diffusion Loss (drives the semantic changes requested in the text prompt).

Datasets and Generalization

The model was primarily trained and evaluated on FFHQ (Flickr-Faces-HQ), the gold standard for high-quality human face images. However, as demonstrated in the visual results, the method is highly adaptable. It was also tested on AFHQv2 to demonstrate that the method generalizes to other domains like cats, and ShapeNet to show it works for inanimate objects like cars.

Key Insights and Ideas

  • GANs as a Safety Rail: One of the biggest insights is using the GAN as a constraint. Pure diffusion-based 3D generation often fails on faces because the search space is too vast. By optimizing inside a GAN's latent space, the model is physically incapable of producing a "non-face," leading to much higher stability and clean underlying geometry.
  • SDS vs. CLIP: The paper argues that SDS (from diffusion) provides much better "control" than CLIP-based guidance. CLIP often focuses on "bag-of-words" nouns, whereas diffusion models understand spatial relationships and subtle attributes (like "angry" or "wearing makeup") much better.
  • Identity vs. Editability Trade-off: The researchers highlight a fundamental tension: if your reconstruction loss is too high, you can't edit the face; if it's too low, the person becomes unrecognizable. Their weighted loss approach provides a tunable "sweet spot" for this balance.

Key Results

  • Speed: FaceDNeRF takes roughly 10 minutes on a single NVIDIA 3090 GPU to produce an edited 3D head. For comparison, previous text-to-3D methods like DreamFusion can take up to 90 minutes.
  • Identity Preservation: In quantitative tests, FaceDNeRF maintained lower Identity (ID) loss than competitors like InterfaceGAN and StyleCLIP when performing complex edits.
  • Zero-Shot Relighting: Unlike 2D methods that often produce flickering or inconsistent lighting when the head turns, FaceDNeRF’s 3D-aware approach ensures that shadows and highlights move correctly across the face geometry.

Limitations and Future Work

While powerful, the method is limited by the "expressive power" of the underlying GAN. If the pre-trained EG3D model hasn't seen a specific extreme hairstyle or accessory, FaceDNeRF cannot generate it. Furthermore, because it relies heavily on FFHQ, the model inherits the demographic biases present in that dataset. Finally, while it works exceptionally well for heads, it struggles with highly articulated movements (like complex body poses) because the underlying 3D generators for full bodies are not yet as robust.

Ultimately, FaceDNeRF represents a significant step toward a "Photoshop for 3D," making high-end, movie-quality facial editing accessible through simple text commands and single images.

Summary updated

BibTeX
@inproceedings{zhang2023facednerf,
  author = {Hao ZHANG and Tianyuan DAI and Yanbo Xu and Yu-Wing Tai and Chi-Keung Tang},
  title = {{FaceDNeRF: Semantics-Driven Face Reconstruction, Prompt Editing and Relighting with Diffusion Models}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=QUkYZNhfc6},
}
Figure