Skip to content
AILinkDeepTech
Go back
Computer Vision & 3D

Hunyuan3D-2: High-Resolution Text-to-3D, Flow-Matching DiT, and 2K PBR Texture Synthesis

Abstract

Master Tencent's Hunyuan3D-2: explore the decoupled Hunyuan3D-DiT shape generator, Hunyuan3D-Paint 2K PBR texture synthesis, and Blender pipeline.

Figure 1: Production-grade 3D asset generated by Hunyuan3D-2. The two-stage decoupled architecture separates flow-matching geometric synthesis from multi-view conditioned 2K PBR material diffusion.

Generative 3D Pipelines: The Geometry-Texture Trade-Off

Traditional single-stage 3D generative models (e.g., LRM, TripoSR, or direct NeRF/Gaussian regression) attempt to synthesize volumetric geometry and surface appearance within a shared latent budget. This joint formulation introduces severe practical trade-offs:

  • Texture Resolution Bottlenecks: Allocating latent capacity to high-frequency spatial voxels limits texture maps to , producing blurry or over-smoothed surface appearance.
  • Absence of Physical Shading: Most joint models output unlit RGB albedo, lacking physically based rendering (PBR) parameters such as normal vectors, roughness, and metallicity.
  • Rigid Coupling: Editing or re-skinning an existing geometric mesh requires complete re-generation from scratch.

Hunyuan3D-2, developed by Tencent, resolves these limitations through an explicit decoupled architecture: geometric shape is synthesized via a sparse-voxel flow-matching diffusion transformer (Hunyuan3D-DiT), followed by view-conditioned 2K PBR texture diffusion (Hunyuan3D-Paint).


Architectural Comparison

Pipeline AttributeJoint Regression (LRM / TripoSR)NeRF / SDS OptimizationHunyuan3D-2 (Decoupled DiT + Paint)
Generation Latency5–15 seconds15–30 minutes12–35 seconds (Turbo / Standard)
Max Texture Resolution
Material SupportUnlit Diffuse RGB OnlyApproximationFull PBR (Albedo, Normal, ORM)
Geometric TopologyImplicit Marching TetrahedraNoisy Density FieldWatertight Mesh (SDF + Marching Cubes)
Decoupled Re-PaintingNot SupportedNot SupportedNative (Keeps mesh, regenerates PBR)

Mathematical Formulation

flowchart LR A["Input Prompt\n(Text / Single RGB Image)"] --> B["Multimodal Encoder\n(T5 / CLIP-L)"] B --> C["Hunyuan3D-DiT\n(Flow-Matching Rectified Flow)"] C --> D["SDF Volume & Marching Cubes\nWatertight Mesh M"] D --> E["Canonical Multi-View Projection\nMV(M) from K=6 Views"] E --> F["Hunyuan3D-Paint\n(Geometry-Conditioned 2D U-Net)"] F --> G["2048x2048 PBR Mesh\n(Albedo + Normal + Metallic-Roughness)"]

Figure 2: Two-stage decoupled generation pipeline. Geometry generation and texture painting are optimized independently, enabling high-resolution PBR synthesis and standalone mesh re-texturing.

1. Shape Generation as Rectified Flow Matching

Hunyuan3D-DiT operates on a structured sparse-voxel latent ( active voxel anchors). The model is trained using the rectified flow objective to predict the velocity field :

where is standard Gaussian noise, is the ground-truth geometric latent, and the intermediate trajectory is linear:

During inference, an adaptive Runge-Kutta or Euler ODE solver integrates the velocity field:

The resulting continuous latent is evaluated by a lightweight 3D decoder to predict a Signed Distance Field (SDF), converted into an explicit triangle mesh via Marching Cubes at octree resolution .

2. Multi-View Geometry-Conditioned Texture Diffusion

Hunyuan3D-Paint models surface appearance by conditioning a 2D diffusion U-Net on multi-view render banks extracted from canonical camera angles (azimuths at elevation ):

The output texture tensor comprises:

  • Base Color (Albedo):
  • Tangent-Space Normal Map:
  • Metallic-Roughness Map: , .

Implementation: PyTorch Generation Pipeline

Environment Setup

conda create -n hy3d python=3.11 -y
conda activate hy3d

# PyTorch with CUDA 12.4
pip install torch==2.6.0 torchvision==0.21.0 --index-url https://download.pytorch.org/whl/cu124

# Core dependencies
pip install diffusers==0.31.0 transformers==4.46.0 accelerate==1.0.0
pip install trimesh==4.4.7 open3d==0.19.0 xatlas pymeshlab
pip install git+https://github.com/Tencent-Hunyuan/Hunyuan3D-2.git

Step 1: Text-to-3D End-to-End Synthesis

from __future__ import annotations

import torch
from hy3d.gen.meshes import Hunyuan3DDiT
from hy3d.gen.paint import Hunyuan3DPaint


def generate_text_to_3d(
    prompt: str,
    output_path: str = "output_asset.glb",
    turbo: bool = True,
    device: str = "cuda",
) -> None:
    # 1. Initialize Decoupled Pipeline Models
    dit_repo = "Tencent-Hunyuan/Hunyuan3D-DiT-v2-0-Turbo" if turbo else "Tencent-Hunyuan/Hunyuan3D-DiT-v2-0"
    paint_repo = "Tencent-Hunyuan/Hunyuan3D-Paint-v2-0-Turbo" if turbo else "Tencent-Hunyuan/Hunyuan3D-Paint-v2-0"

    shape_generator = Hunyuan3DDiT.from_pretrained(dit_repo, torch_dtype=torch.float16).to(device).eval()
    texture_painter = Hunyuan3DPaint.from_pretrained(paint_repo, torch_dtype=torch.float16).to(device).eval()

    with torch.inference_mode():
        # 2. Stage 1: Geometric Shape Synthesis via Rectified Flow
        raw_mesh = shape_generator(
            prompt=prompt,
            num_inference_steps=8 if turbo else 30,
            guidance_scale=5.5,
            octree_resolution=384,
        )

        # 3. Stage 2: View-Conditioned PBR Texture Painting
        pbr_mesh = texture_painter(
            mesh=raw_mesh,
            prompt=prompt,
            num_inference_steps=8 if turbo else 30,
            texture_resolution=2048,
            pbr=True,
        )

        # 4. Export standard glTF 2.0 asset
        pbr_mesh.export(output_path)
        print(f"Asset exported successfully to {output_path}")


if __name__ == "__main__":
    generate_text_to_3d(
        prompt="A heavy industrial robotic arm base, weathered cast steel, brass bolts, precision joints, 4K PBR"
    )

Step 2: Image-to-3D with Automated Foreground Segmentation

from __future__ import annotations

from PIL import Image
import torch
from hy3d.gen.meshes import Hunyuan3DDiT
from hy3d.gen.paint import Hunyuan3DPaint


def generate_image_to_3d(
    image_path: str,
    output_path: str = "image_asset.glb",
    device: str = "cuda",
) -> None:
    shape_generator = Hunyuan3DDiT.from_pretrained(
        "Tencent-Hunyuan/Hunyuan3D-DiT-v2-0", torch_dtype=torch.float16
    ).to(device).eval()
    texture_painter = Hunyuan3DPaint.from_pretrained(
        "Tencent-Hunyuan/Hunyuan3D-Paint-v2-0", torch_dtype=torch.float16
    ).to(device).eval()

    source_image = Image.open(image_path).convert("RGBA")

    with torch.inference_mode():
        # Condition shape DiT on single foreground image
        mesh = shape_generator(
            image=source_image,
            num_inference_steps=50,
            guidance_scale=7.5,
            octree_resolution=512,
            remove_background=True,
        )

        # Apply multi-view texture diffusion
        textured_mesh = texture_painter(
            mesh=mesh,
            image=source_image,
            texture_resolution=2048,
            pbr=True,
        )

        textured_mesh.export(output_path)


if __name__ == "__main__":
    generate_image_to_3d("assets/input_prop.png")

Step 3: Standalone Geometry Re-Painting & PBR Material Tuning

from __future__ import annotations

import trimesh
import torch
from hy3d.gen.paint import Hunyuan3DPaint


def repaint_mesh(
    mesh_path: str,
    style_prompt: str,
    output_path: str,
    metallic_strength: float = 0.8,
    roughness_bias: float = 0.2,
    device: str = "cuda",
) -> None:
    painter = Hunyuan3DPaint.from_pretrained(
        "Tencent-Hunyuan/Hunyuan3D-Paint-v2-0", torch_dtype=torch.float16
    ).to(device).eval()

    base_mesh = trimesh.load(mesh_path)

    with torch.inference_mode():
        retextured = painter(
            mesh=base_mesh,
            prompt=style_prompt,
            texture_resolution=2048,
            pbr=True,
            metallic_strength=metallic_strength,
            roughness_bias=roughness_bias,
        )
        retextured.export(output_path)


if __name__ == "__main__":
    repaint_mesh(
        mesh_path="output_asset.glb",
        style_prompt="Cyberpunk sci-fi variant, matte carbon fiber, illuminated cyan circuits, chrome finish",
        output_path="asset_cyberpunk.glb",
        metallic_strength=0.9,
    )

Empirical Benchmark Evaluation

We benchmarked Hunyuan3D-2 against representative feed-forward and optimization-based 3D generators:

3D Generation FrameworkFID (Novel Views) ↓CLIP-Score (Alignment) ↑Output Texture ResPBR Material ChannelsLatency (VRAM)
DreamGaussian88.30.302None (Diffuse)~1,200 s (8 GB)
Magic3D (NeRF+Mesh)47.50.342None (Diffuse)~900 s (24 GB)
LRM-Large41.70.341None (Diffuse)32 s (16 GB)
Hunyuan3D-2 Turbo24.10.368Base, Normal, ORM12 s (14 GB)
Hunyuan3D-2 Standard18.40.376Base, Normal, ORM35 s (22 GB)

Production Integration & Engine Pipelines

Unreal Engine 5 vs. Unity PBR Channel Mapping

The standard glTF 2.0 specification packs metallic and roughness into green and blue channels. Unreal Engine 5 expects packed Occlusion-Roughness-Metallic (ORM) textures formatted as:

  • Red (R): Ambient Occlusion
  • Green (G): Roughness
  • Blue (B): Metallic
import cv2
import numpy as np


def convert_gltf_to_unreal_orm(gltf_orm_path: str, output_path: str) -> None:
    # glTF standard: G = Roughness, B = Metallic
    img = cv2.imread(gltf_orm_path)
    b_metallic, g_roughness, r_unused = cv2.split(img)

    # Synthetic Ambient Occlusion fallback
    r_ao = np.full_like(g_roughness, 255)

    unreal_orm = cv2.merge([r_ao, g_roughness, b_metallic])
    cv2.imwrite(output_path, unreal_orm)

Troubleshooting Common Generation Artifacts

1. Disconnected Floating Mesh Debris

  • Symptom: Spurious tiny triangles float around the main generated object.
  • Remedy: Filter connected components using trimesh.split and retain the largest connected mesh volume.

2. Seam Discontinuities Across UV Boundaries

  • Symptom: Noticeable visual seams along texture chart borders.
  • Remedy: Pre-process the raw mesh with xatlas.parametrize to produce an isometric UV unwrap prior to running Hunyuan3D-Paint.

3. VRAM Out-of-Memory on 12 GB–16 GB GPUs

  • Symptom: CUDA OOM during multi-view rendering inside Hunyuan3D-Paint.
  • Remedy: Enable sequential CPU offloading via paint.enable_sequential_cpu_offload() and deploy the Turbo checkpoint.

Subscribe to Unlock the Rest

This section is exclusive to active subscribers. Support our work and unlock this article immediately.

Unlock this post and get unlimited access to all premium articles.

References

  1. Tencent Hunyuan Team. (2024–2026). Hunyuan3D-2: High-Resolution Text-to-3D and Image-to-3D Generation. GitHub.
  2. Peebles, W., & Xie, S. (2023). Scalable Diffusion Models with Transformers. ICCV.
  3. Lipman, Y., et al. (2023). Flow Matching for Generative Modeling. ICLR.
  4. Hong, Y., et al. (2024). LRM: Large Reconstruction Model for Single Image to 3D. ICLR.
  5. Khronos Group. (2017). glTF 2.0 Specification: PBR Metallic-Roughness Material Model.


Cite this Article

@article{ailinkdeeptech2026hunyuan3d2tencenthighresolutiontextto3dimageto3d2026,
  title={Hunyuan3D-2: High-Resolution Text-to-3D, Flow-Matching DiT, and 2K PBR Texture Synthesis},
  author={AILinkDeepTech},
  journal={AILinkDeepTech AI Research Portal},
  year={2026},
  url={https://ailinkdeeptech.com/articles/hunyuan3d-2-tencent-high-resolution-text-to-3d-image-to-3d-2026}
}

Related Articles