mirror of
https://git.datalinker.icu/kijai/ComfyUI-Hunyuan3DWrapper.git
synced 2026-06-05 15:44:30 +08:00
Added BPT to remesher
This commit is contained in:
parent
7700bf7396
commit
b1ea76ee89
12
nodes.py
12
nodes.py
@ -9,7 +9,7 @@ import json
|
|||||||
import trimesh as Trimesh
|
import trimesh as Trimesh
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
|
|
||||||
from .hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline, FaceReducer, FloaterRemover, DegenerateFaceRemover
|
from .hy3dgen.shapegen import Hunyuan3DDiTFlowMatchingPipeline, BptMesh, FaceReducer, FloaterRemover, DegenerateFaceRemover
|
||||||
from .hy3dgen.texgen.hunyuanpaint.unet.modules import UNet2DConditionModel, UNet2p5DConditionModel
|
from .hy3dgen.texgen.hunyuanpaint.unet.modules import UNet2DConditionModel, UNet2p5DConditionModel
|
||||||
from .hy3dgen.texgen.hunyuanpaint.pipeline import HunyuanPaintPipeline
|
from .hy3dgen.texgen.hunyuanpaint.pipeline import HunyuanPaintPipeline
|
||||||
|
|
||||||
@ -1234,6 +1234,8 @@ class Hy3DIMRemesh:
|
|||||||
"smooth_iter": ("INT", {"default": 8, "min": 0, "max": 100, "step": 1}),
|
"smooth_iter": ("INT", {"default": 8, "min": 0, "max": 100, "step": 1}),
|
||||||
"align_to_boundaries": ("BOOLEAN", {"default": True}),
|
"align_to_boundaries": ("BOOLEAN", {"default": True}),
|
||||||
"triangulate_result": ("BOOLEAN", {"default": True}),
|
"triangulate_result": ("BOOLEAN", {"default": True}),
|
||||||
|
"max_facenum": ("INT", {"default": 40000, "min": 1, "max": 10000000, "step": 1}),
|
||||||
|
"bpt": ("BOOLEAN", {"default": False}),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1243,7 +1245,7 @@ class Hy3DIMRemesh:
|
|||||||
CATEGORY = "Hunyuan3DWrapper"
|
CATEGORY = "Hunyuan3DWrapper"
|
||||||
DESCRIPTION = "Remeshes the mesh using instant-meshes: https://github.com/wjakob/instant-meshes, Note: this will remove all vertex colors and textures."
|
DESCRIPTION = "Remeshes the mesh using instant-meshes: https://github.com/wjakob/instant-meshes, Note: this will remove all vertex colors and textures."
|
||||||
|
|
||||||
def remesh(self, trimesh, merge_vertices, vertex_count, smooth_iter, align_to_boundaries, triangulate_result):
|
def remesh(self, trimesh, merge_vertices, vertex_count, smooth_iter, align_to_boundaries, triangulate_result, bpt, max_facenum):
|
||||||
try:
|
try:
|
||||||
import pynanoinstantmeshes as PyNIM
|
import pynanoinstantmeshes as PyNIM
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@ -1266,7 +1268,11 @@ class Hy3DIMRemesh:
|
|||||||
if triangulate_result:
|
if triangulate_result:
|
||||||
new_faces = Trimesh.geometry.triangulate_quads(new_faces)
|
new_faces = Trimesh.geometry.triangulate_quads(new_faces)
|
||||||
|
|
||||||
new_mesh = Trimesh.Trimesh(new_verts, new_faces)
|
if len(new_mesh.faces) > max_facenum:
|
||||||
|
new_mesh = FaceReducer()(new_mesh, max_facenum=max_facenum)
|
||||||
|
|
||||||
|
if bpt:
|
||||||
|
new_mesh = BptMesh()(new_mesh)
|
||||||
|
|
||||||
return (new_mesh, )
|
return (new_mesh, )
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user