hunyuan3d-rs — Text-to-3D & Image-to-3D Mesh and PBR Texture Engine in Rust
hunyuan3d-rs is a native Rust implementation of Tencent's Hunyuan3D-2 pipeline for synthesizing high-resolution 3D meshes and physically based rendering (PBR) textures from text or single images. It combines Dual-Stream Diffusion Transformer shape generation, octree Marching Cubes surface extraction, and UV-unwrapped albedo/roughness/metallic baking.
$ cargo install hunyuan3d-rs
Architected for Speed & Reliability
Engineered from the ground up in memory-safe Rust with zero unnecessary dependencies.
Marching Cubes Surface Extractor
Pure Rust implementation of the 256-configuration edge and triangle lookup table with iso-surface interpolation and bounding box normalization.
Rectified Flow Matching ODE
High-order numerical solvers including Euler, Midpoint, Heun, and 4th-order Runge-Kutta (RK4) with shifted schedule matching upstream Hunyuan3D-2.1.
Spatio-Temporal DiT & 3D RoPE
3D Rotary Position Embeddings across spatial axes, scaled dot-product attention, AdaLN-Zero modulation, and Mixture of Experts (MoE) routing.
Automated Mesh Healing & QEM
Prunes detached floating debris, applies iterative Laplacian smoothing, and executes Quadric Error Metric (QEM) decimation to target polygon budgets.
PBR Material Synthesis
Bakes physically-based rendering textures including Albedo, Roughness, and Metallic maps directly into standard GLB material channels.
Parallel Software Rasterizer
Multi-threaded CPU software rasterizer powered by Rayon for multi-view validation and texture projection without GPU driver lock-in.
Get Started in Seconds
Install via Cargo and run immediately on macOS, Linux, or Windows.
# Build and install Hunyuan3D-RS
cargo install --git https://github.com/bhubbard/hunyuan3d-rs
# Generate a high-resolution 3D asset from prompt
hunyuan3d generate --prompt "ancient ornate brass lantern" --solver rk4 -o lantern.glb
# Decimate and repair an existing mesh using QEM
hunyuan3d decimate --input raw.obj --target-faces 15000 -o optimized.glb
# Run the test suite
cargo test --release
Engine Architecture
Streamlined execution pipeline with deterministic memory isolation and zero runtime overhead.
┌───────────────────────────────────────────────────────────┐
│ Input: Text Prompt / Image Latent │
└─────────────────────────────┬─────────────────────────────┘
│
┌─────────────────────────────▼─────────────────────────────┐
│ Rectified Flow Matching ODE (Euler/Heun/RK4) │
└─────────────────────────────┬─────────────────────────────┘
│ 3D Density Grid
┌─────────────────────────────▼─────────────────────────────┐
│ MCSurfaceExtractor (Marching Cubes 256) │
└─────────────────────────────┬─────────────────────────────┘
│ Raw Mesh & Triangles
┌─────────────────────────────▼─────────────────────────────┐
│ Mesh Post-Processing (Laplacian + QEM Decimation) │
└─────────────────────────────┬─────────────────────────────┘
│
┌─────────────────────────────▼─────────────────────────────┐
│ PBR Material Synthesis & Texture Baking -> GLB │
└───────────────────────────────────────────────────────────┘