From 400019196518dedbf5904f4516216163d6796b2e Mon Sep 17 00:00:00 2001 From: kijai <40791699+kijai@users.noreply.github.com> Date: Sun, 2 Feb 2025 12:49:12 +0200 Subject: [PATCH] Update nodes.py --- nodes.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/nodes.py b/nodes.py index e079c0f..7e5b138 100644 --- a/nodes.py +++ b/nodes.py @@ -1408,14 +1408,16 @@ class Hy3DNvdiffrastRenderer: # Get texture from material if hasattr(mesh_copy.visual.material, 'baseColorTexture'): pil_texture = getattr(mesh_copy.visual.material, "baseColorTexture") - pil_texture = pil_texture.transpose(Image.FLIP_TOP_BOTTOM) + elif hasattr(mesh_copy.visual.material, 'image'): + pil_texture = getattr(mesh_copy.visual.material, "image") + pil_texture = pil_texture.transpose(Image.FLIP_TOP_BOTTOM) - # Convert PIL to tensor [B,C,H,W] - transform = transforms.Compose([ - transforms.ToTensor(), - ]) - texture = transform(pil_texture).to(device) - texture = texture.unsqueeze(0).permute(0, 2, 3, 1).contiguous() #need to be contiguous for nvdiffrast + # Convert PIL to tensor [B,C,H,W] + transform = transforms.Compose([ + transforms.ToTensor(), + ]) + texture = transform(pil_texture).to(device) + texture = texture.unsqueeze(0).permute(0, 2, 3, 1).contiguous() #need to be contiguous for nvdiffrast else: print("No texture found") # Fallback to vertex colors if no texture