| 8 | os.path.join(os.environ.get("XDG_CACHE_HOME", os.path.expanduser("~/.cache")), "hunyuan3d-mlu", "modules"), |
| 9 | ) |
| 10 | |
| 11 | from loguru import logger |
| 12 | from paint_pipeline import PaintPipeline |
| 13 | |
| 14 | |
| 15 | def get_postprocess_paint_parser(): |
| 16 | parser = argparse.ArgumentParser(description="Post-processing pipeline for Hunyuan3D mesh texture (paint).") |
| 17 | |
| 18 | parser.add_argument( |
| 19 | "--hy_repo", |
| 20 | type=str, |
| 21 | default=None, |
| 22 | help="Hunyuan3D-2.1 source tree containing hy3dpaint/. Platform scripts pass this explicitly.", |
| 23 | ) |
| 24 | parser.add_argument( |
| 25 | "--model_path", |
| 26 | type=str, |
| 27 | required=True, |
| 28 | help="Path to Hunyuan3D-2.1 HF weights (hunyuan3d-paintpbr-v2-1, etc.).", |
| 29 | ) |
| 30 | parser.add_argument("--mesh_path", type=str, required=True, help="Input mesh from shape generation (.glb / .obj).") |
| 31 | parser.add_argument("--image_path", type=str, required=True, help="Reference image for texture generation.") |
| 32 | parser.add_argument( |
| 33 | "--save_path", |
| 34 | type=str, |
| 35 | required=True, |
| 36 | help="Output path for textured mesh (.glb recommended) or output directory prefix.", |
| 37 | ) |
| 38 | |
| 39 | parser.add_argument("--max_num_view", type=int, default=6, help="Number of multiview diffusion views (6-9).") |
| 40 | parser.add_argument("--resolution", type=int, default=512, choices=[512, 768], help="Multiview diffusion resolution.") |
| 41 | parser.add_argument( |
| 42 | "--device", |
| 43 | type=str, |
| 44 | default=os.environ.get("AI_DEVICE", "cuda"), |
| 45 | help="Torch device for paint models (default: AI_DEVICE env or cuda).", |
| 46 | ) |
| 47 | parser.add_argument( |
| 48 | "--multiview_cfg_path", |
| 49 | type=str, |
| 50 | default=None, |
| 51 | help="Override path to hunyuan-paint-pbr.yaml (default: hy3dpaint/cfgs/hunyuan-paint-pbr.yaml).", |
| 52 | ) |
| 53 | parser.add_argument( |
| 54 | "--realesrgan_ckpt_path", |
| 55 | type=str, |
| 56 | default=None, |
| 57 | help="Override RealESRGAN checkpoint (default: hy3dpaint/ckpt/RealESRGAN_x4plus.pth).", |
| 58 | ) |
| 59 | parser.add_argument( |
| 60 | "--custom_pipeline", |
| 61 | type=str, |
| 62 | default=None, |
| 63 | help="Override custom diffusers pipeline dir (default: hy3dpaint/hunyuanpaintpbr).", |
| 64 | ) |
| 65 | parser.add_argument( |
| 66 | "--dino_ckpt_path", |
| 67 | type=str, |