From 8fecedb105397945de6d48d8645e7bb7dadcad4f Mon Sep 17 00:00:00 2001 From: GiusTex <112352961+GiusTex@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:45:23 +0100 Subject: [PATCH 1/2] LoadCustomMesh --- nodes.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/nodes.py b/nodes.py index 4d9e307..b1d4a0f 100644 --- a/nodes.py +++ b/nodes.py @@ -3,6 +3,7 @@ import torch from PIL import Image from pathlib import Path import numpy as np +import trimesh from .hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline, FaceReducer, FloaterRemover, DegenerateFaceRemover @@ -137,7 +138,29 @@ class DownloadAndLoadHy3DDelightModel: delight_pipe.enable_model_cpu_offload() return (delight_pipe,) + +class LoadCustomMesh: + @classmethod + def INPUT_TYPES(s): + return { + "required": { + "glb": ("STRING", {"default": "", "tooltip": "The glb path with mesh to load. Tested only for now with other hunyuan3d-2 glbs"}), + } + } + RETURN_TYPES = ("HY3DMESH",) + RETURN_NAMES = ("mesh",) + OUTPUT_TOOLTIPS = ("The glb model with mesh to texturize.",) + FUNCTION = "main" + CATEGORY = "Hunyuan3DWrapper" + DESCRIPTION = "Encodes a text prompt using a CLIP model into an embedding that can be used to guide the diffusion model towards generating specific images." + + def main(self, glb): + + mesh = trimesh.load(glb, force="mesh") + + return (mesh,) + class Hy3DDelightImage: @classmethod def INPUT_TYPES(s): From 9d9b9dc186bac5140f9425d2320c1cb38f6d9a8d Mon Sep 17 00:00:00 2001 From: GiusTex <112352961+GiusTex@users.noreply.github.com> Date: Thu, 23 Jan 2025 14:46:52 +0100 Subject: [PATCH 2/2] Added Load Custom Mesh node --- nodes.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nodes.py b/nodes.py index b1d4a0f..b530ebf 100644 --- a/nodes.py +++ b/nodes.py @@ -555,7 +555,8 @@ NODE_CLASS_MAPPINGS = { "Hy3DRenderMultiView": Hy3DRenderMultiView, "Hy3DBakeFromMultiview": Hy3DBakeFromMultiview, "Hy3DTorchCompileSettings": Hy3DTorchCompileSettings, - "Hy3DPostprocessMesh": Hy3DPostprocessMesh + "Hy3DPostprocessMesh": Hy3DPostprocessMesh, + "LoadCustomMesh": LoadCustomMesh } NODE_DISPLAY_NAME_MAPPINGS = { "Hy3DModelLoader": "Hy3DModelLoader", @@ -567,5 +568,6 @@ NODE_DISPLAY_NAME_MAPPINGS = { "Hy3DRenderMultiView": "Hy3D Render MultiView", "Hy3DBakeFromMultiview": "Hy3D Bake From Multiview", "Hy3DTorchCompileSettings": "Hy3D Torch Compile Settings", - "Hy3DPostprocessMesh": "Hy3D Postprocess Mesh" + "Hy3DPostprocessMesh": "Hy3D Postprocess Mesh", + "LoadCustomMesh": "Load Custom Mesh" }