Skip to content

The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.

Fix orientation of hunyuan 3d model.

comfyanonymous32ca0805b724
diff --git a/comfy/ldm/hunyuan3d/vae.py b/comfy/ldm/hunyuan3d/vae.py
index 311c9b416..5eb2c6548 100644
--- a/comfy/ldm/hunyuan3d/vae.py
+++ b/comfy/ldm/hunyuan3d/vae.py
@@ -581,7 +581,7 @@ class ShapeVAE(nn.Module):
enable_pbar = kwargs.get("enable_pbar", True)
grid_logits = self.volume_decoder(latents, self.geo_decoder, bounds=bounds, num_chunks=num_chunks, octree_resolution=octree_resolution, enable_pbar=enable_pbar)
- return grid_logits
+ return grid_logits.movedim(-2, -1)
def encode(self, x):
return None
diff --git a/comfy_extras/nodes_hunyuan3d.py b/comfy_extras/nodes_hunyuan3d.py
index 6abcde1f6..ac2cff3a9 100644
--- a/comfy_extras/nodes_hunyuan3d.py
+++ b/comfy_extras/nodes_hunyuan3d.py
@@ -185,8 +185,8 @@ def voxel_to_mesh(voxels, threshold=0.5, device=None):
device=device
).reshape(-1, 4)
- all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 2], face_indices[:, 1]], dim=1))
- all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 3], face_indices[:, 2]], dim=1))
+ all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 1], face_indices[:, 2]], dim=1))
+ all_indices.append(torch.stack([face_indices[:, 0], face_indices[:, 2], face_indices[:, 3]], dim=1))
vertex_count += 4 * num_faces
@@ -202,6 +202,7 @@ def voxel_to_mesh(voxels, threshold=0.5, device=None):
if scale > 0:
vertices = vertices / scale
+ vertices = torch.fliplr(vertices)
return vertices, faces