How tencent-hunyuan/hunyuan3d-2 works
Project type and purpose
• This is a full-stack, research-grade 3D asset generation system (Hunyuan3D 2.0).
File structure
• Top-level python scripts:
• api_server.py (launches HTTP endpoints)
• gradio_app.py (hosts interactive UI)
• blender_addon.py (Blender integration)
• Core library: hy3dgen/
• shapegen/: data preprocessors, diffusion transformer models, scheduler, pipelines.py, postprocessors
• texgen/: custom rasterizer (C++/CUDA), differentiable_renderer (mesh processor & renderer), hunyuanpaint (UNet), pipelines.py, utilities
• Configuration and build: setup.py, requirements.txt
• Examples & assets: examples/ scripts for common workflows, assets/ sample images, models, templates, docs/ full documentation.
README for additional insights
• Two-stage architecture:
B. Texture generation paints UV texture maps on the mesh.
• Interfaces: diffusers-like Python API, Gradio UI, REST API, Blender Addon.
• External dependencies: PyTorch, Hugging Face models, trimesh, custom C++/CUDA rasterizer, differentiable renderer.
Make the pipeline detail explicit
• Image loader → Preprocessor → Noise scheduler → DiT FlowMatching model → Surface extractor → Mesh postprocessor
• Mesh + image → UV unwrapping (custom rasterizer compile/install) → Differentiable renderer (mesh_processor → mesh_render) → UNet paint model → Texture postprocessors (align, simplify)
• At interfaces, annotate how Gradio_app.py or api_server.py instantiate and orchestrate these pipelines, and how blender_addon.py proxies requests to the local API server.
• Model checkpoint storage (Hugging Face repository) as an external dependency.