mirror of
https://git.datalinker.icu/kijai/ComfyUI-Hunyuan3DWrapper.git
synced 2025-12-09 21:04:32 +08:00
Update nodes.py
This commit is contained in:
parent
9c69b6f4fd
commit
4000191965
16
nodes.py
16
nodes.py
@ -1408,14 +1408,16 @@ class Hy3DNvdiffrastRenderer:
|
|||||||
# Get texture from material
|
# Get texture from material
|
||||||
if hasattr(mesh_copy.visual.material, 'baseColorTexture'):
|
if hasattr(mesh_copy.visual.material, 'baseColorTexture'):
|
||||||
pil_texture = getattr(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]
|
# Convert PIL to tensor [B,C,H,W]
|
||||||
transform = transforms.Compose([
|
transform = transforms.Compose([
|
||||||
transforms.ToTensor(),
|
transforms.ToTensor(),
|
||||||
])
|
])
|
||||||
texture = transform(pil_texture).to(device)
|
texture = transform(pil_texture).to(device)
|
||||||
texture = texture.unsqueeze(0).permute(0, 2, 3, 1).contiguous() #need to be contiguous for nvdiffrast
|
texture = texture.unsqueeze(0).permute(0, 2, 3, 1).contiguous() #need to be contiguous for nvdiffrast
|
||||||
else:
|
else:
|
||||||
print("No texture found")
|
print("No texture found")
|
||||||
# Fallback to vertex colors if no texture
|
# Fallback to vertex colors if no texture
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user