TL;DR
SpatialHand is a novel framework that enables precise, 3D-aware object insertion and manipulation within 2D images. By decomposing 6-Degrees-of-Freedom (6DoF) control into 2D masks, depth maps, and latent orientation features, SpatialHand allows users to place objects with exact positioning, realistic occlusions, and specific 3D rotations, moving beyond the limitations of traditional flat 2D inpainting.
The Problem: Generative AI's Flat Canvas
Current generative image editing tools are remarkably adept at "hallucinating" objects into a scene, but they fundamentally operate in 2D. They treat the image as a flat canvas, which leads to two major spatial headaches:
- Spatial Ambiguity: If you prompt a model to place a chair in a room, it often struggles to determine whether the chair should sit in front of or behind an existing table. It lacks a true understanding of depth.
- Orientation Chaos: You cannot easily instruct a model to "insert this car facing 45 degrees to the left." Models typically guess the orientation based on surrounding context, frequently resulting in jarring perspective mismatches.
The authors of SpatialHand argue that for generative AI to be truly useful in AR/VR or professional content creation, we must transition from "2D inpainting" to "3D perspective manipulation."
Methods: Injecting 3D Spatial Conditions
SpatialHand builds upon the FLUX-Dev.1 architecture (a Multi-Modal Diffusion Transformer) and introduces a robust method to inject 3D spatial conditions into the generation process. The core innovation is how the framework represents 6DoF Pose (3D location + 3D orientation):
- Decomposed 3D Location: Instead of forcing the model to interpret raw 3D coordinates, SpatialHand uses a 2D mask (indicating where the object goes) combined with a composited depth map. By modifying depth values within the masked region, the system explicitly tells the model exactly how "deep" into the scene the object should sit.
- Geometry-Aware Composition: To handle occlusions naturally, the system compares the scene's existing depth map with the intended placement depth. If an existing object is "closer" than the new one, the system preserves that foreground object in the mask, ensuring the new object is correctly tucked behind it.
- Latent Orientation Features: 3D orientation (azimuth, elevation, and in-plane rotation) is processed through a zero-initialized MLP and embedded directly into the model's latent features.
To ensure robust learning, the model undergoes a three-stage training progression: learning identity preservation, mastering novel view synthesis (rotating the object in isolation), and finally, executing 3D-aware insertion in complex, multi-object scenes.
Overcoming the Data Bottleneck
Because high-quality "before and after" 3D-aware image pairs are exceedingly rare, the authors built an automated data construction pipeline. They utilized Hunyuan-3D 2.0 to generate 43,000 high-quality 3D meshes. From these, they created 370,000 high-fidelity training pairs using two methods: rendering assets in virtual scenes via Blender for perfect geometry, and blending assets into real images using subject-driven models for visual diversity.
For evaluation, they established a manual benchmark of 1,600 test samples featuring precise 3D pose annotations.
Key Insights
- Implicit is Better than Explicit: Rather than forcing the model to render a heavy 3D mesh—which often looks "uncanny"—SpatialHand uses 3D information as guidance for a 2D generative process. This maintains the high visual quality of diffusion models while securing precise 3D control.
- Depth as the "Z-Buffer" for Inpainting: Using a depth map as a conditional input effectively solves the occlusion problem that has plagued 2D inpainting for years.
- The Importance of Absolute Orientation: Unlike previous methods that relied on relative rotation (e.g., "rotate 30 degrees from the current view"), SpatialHand uses absolute semantic orientation, allowing it to work seamlessly even when the reference is just a text description.
Key Results
SpatialHand significantly outperforms state-of-the-art models like GPT-4o and Gemini-2.0-Flash in spatial accuracy.
- Orientation Accuracy: On the "Acc@30°" metric (measuring if the rotation was within 30 degrees of the target), SpatialHand achieved 52.0%, thoroughly eclipsing GPT-4o and Gemini, which hovered around 16-20%.
- Depth Precision: It achieved a much lower Absolute Relative Depth Error (19.8) compared to GPT-4o (38.6), proving objects were placed much more accurately in 3D space.
- Qualitative Superiority: As seen in the results, SpatialHand successfully "tucks" objects behind foreground elements (like placing a toy behind a vase) and maintains consistent object identity even under extreme rotations—tasks where general-purpose models consistently fail.
Limitations and Future Work
The authors identify a "coupling" issue between the 2D bounding box and 3D orientation. Currently, if a user draws a square box but requests a side-view of a long object (like a bus), the model might struggle because the aspect ratio of the box conflicts with the requested orientation.
Future work will likely focus on decoupling location and orientation conditions, allowing the model to adjust the object's footprint more flexibly based on its 3D pose. Additionally, improving how the model handles complex lighting and shadows will help make 3D-inserted objects feel even more grounded in their new environments.
Summary updated