ReplaceAnything3D: Text-Guided Object Replacement in 3D Scenes with Compositional Scene Representations

Edward Bartrum, Thu Nguyen-Phuoc, Chris Xie, Zhengqin Li, Numair Khan, Armen Avetisyan, Douglas Lanman, Lei Xiao

TL;DR

ReplaceAnything3D (RAM3D) is a novel framework that allows users to swap or add objects in a 3D scene using simple text prompts. By employing a compositional "Erase-and-Replace" strategy and localized neural fields, it achieves high-fidelity, 3D-consistent results that blend seamlessly into complex real-world environments.

What Problem Does This Paper Address?

Original 3D scene featuring a statue before object replacement. ReplaceAnything3D: Text-Guided Object Replacement in 3D Scenes with Compositional Scene Representations, page 2

Original 3D scene featuring a statue before object replacement.

While 3D reconstruction and generation have seen massive leaps recently, 3D scene editing remains a significant challenge. Specifically, replacing an object within an existing 3D scene is difficult because it requires:

  1. Local Precision: You need to change one specific area without altering the rest of the scene (e.g., changing a person's shirt shouldn't change the background).
  2. 3D Consistency: The new object must look correct from every possible angle.
  3. Contextual Integration: The new object needs to interact realistically with the environment, respecting shadows, lighting, and occlusions.

Existing methods often struggle with these. Some (like Instruct-NeRF2NeRF) perform global edits that change the entire scene's identity, while others fail to synthesize complex textures or require tedious manual 3D modeling.

Methods

RAM3D introduces an Erase-and-Replace pipeline that treats object replacement as a 3D inpainting problem. The process follows four key steps:

  1. Segmentation: Using a text-to-mask model (LangSAM), the system identifies and masks the object to be removed across all input views.
  2. The Erase Stage: The system trains a "background" neural field to fill in the hole left by the removed object. It uses a "Halo Region"—a small area around the mask—to provide supervision, ensuring the inpainted background matches the surrounding environment perfectly.
  3. The Replace Stage: A "foreground" neural field is trained to generate the new object based on the user's text prompt. This is done using HiFA distillation, which leverages a 2D text-to-image inpainting model as a prior. To prevent "floaters" (blurry artifacts), they use random background augmentation during training to force a clean separation between the object and the scene.
  4. Composition: The foreground and background are composited using alpha blending. To keep things efficient, the authors propose Bubble-NeRF, a localized representation that only models the specific area being edited, significantly reducing memory usage and training time.

Datasets

The authors evaluated RAM3D on several established 3D scene datasets to demonstrate versatility:

  • SPIn-NeRF: Used for forward-facing scenes like "Statue" and "Red-Net."
  • NeRF (LLFF): Used for the "Fern" scene.
  • Mip-NeRF 360: Used for the "Garden" scene to test 360-degree consistency.
  • Instruct-NeRF2NeRF: Used for the "Face" dataset to test human avatar editing.

No new datasets were introduced, as the focus was on providing a robust method for existing challenging benchmarks.

Key Insights and Ideas

  • Compositional Disentanglement: By explicitly separating the scene into background and foreground neural fields, RAM3D avoids the "bleeding" artifacts where the new object's texture leaks into the background.
  • Inpainting as a Prior: Instead of using a standard text-to-image model, RAM3D uses a 2D inpainting model. This is a crucial "aha" moment: inpainting models are already trained to understand how new content should fit into an existing context.
  • The Power of the "Bubble": Bubble-NeRF proves that you don't need to simulate the entire world to change a single vase. Localizing the neural field makes the optimization much more stable and faster.
  • Random Background Augmentation: Swapping the background for random solid colors during the "Replace" stage is a clever trick to ensure the model learns a solid 3D shape rather than a semi-transparent cloud.

Key Results

The original statue replaced with an octopus using RAM3D. ReplaceAnything3D: Text-Guided Object Replacement in 3D Scenes with Compositional Scene Representations, page 2

The original statue replaced with an octopus using RAM3D.
  • Qualitative Superiority: RAM3D successfully generates intricate textures (like tartan or checkered patterns on clothing) and complex geometries (like a dragon or an octopus) that baselines like GaussianEditor or Instruct-NeRF2NeRF fail to capture.
  • Quantitative Performance: In benchmarks, RAM3D achieved the highest CLIP Text-Image Direction Similarity (meaning the results matched the text prompts best) and the lowest Warping Error (indicating superior temporal and 3D consistency across views).
  • Seamless Blending: Unlike 2D-only methods, RAM3D's results show realistic interaction with the scene, including shadows cast by the new objects onto the original environment.

Limitations and Future Work

  • The Janus Problem: Like many SDS-based (Score Distillation Sampling) methods, RAM3D can occasionally suffer from the "multi-face" artifact, where an object (like a dog) might end up with multiple heads when viewed from different angles.
  • Structural Loss: Because the method erases the original object entirely, it isn't ideal for "property editing" (e.g., "make this specific chair blue"). It's better at "replacement" than "modification."
  • Scale Mismatch: If the replacement object is significantly larger or smaller than the original mask, the synthesis quality can degrade.
  • Future Directions: The authors suggest extending this approach to 3D Gaussian Splatting for even faster rendering and exploring ways to better disentangle geometry from appearance for finer control.

Summary updated

BibTeX
@inproceedings{bartrum2024replaceanything,
  author = {Edward Bartrum and Thu Nguyen-Phuoc and Chris Xie and Zhengqin Li and Numair Khan and Armen Avetisyan and Douglas Lanman and Lei Xiao},
  title = {{ReplaceAnything3D: Text-Guided Object Replacement in 3D Scenes with Compositional Scene Representations}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=8HwI6UavYc},
}
Figure