MrForExample / ComfyUI-3D-Pack

An extensive node suite that enables ComfyUI to process 3D inputs (Mesh & UV Texture, etc) using cutting edge algorithms (3DGS, NeRF, etc.)
MIT License
2.21k stars 221 forks source link

load and save glb meshes #155

Closed imperator-maximus closed 3 months ago

imperator-maximus commented 4 months ago

Hi,

I made a very simple test workflow for just testing the load and save nodes: image

I used a simple cube mesh for testing.

But I am getting in load mesh node:

Error occurred when executing [Comfy3D] Load 3D Mesh:

invalid index to scalar variable.

File "E:\SD\ComfyUI\execution.py", line 151, in recursive_execute
output_data, output_ui = get_output_data(obj, input_data_all)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\SD\ComfyUI\execution.py", line 81, in get_output_data
return_values = map_node_over_list(obj, input_data_all, obj.FUNCTION, allow_interrupt=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\SD\ComfyUI\execution.py", line 74, in map_node_over_list
results.append(getattr(obj, func)(**slice_dict(input_data_all, i)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\SD\ComfyUI\custom_nodes\ComfyUI-3D-Pack\nodes.py", line 196, in load_mesh
mesh = Mesh.load(mesh_file_path, resize, renormal, retex)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\SD\ComfyUI\custom_nodes\ComfyUI-3D-Pack\mesh_processer\mesh.py", line 93, in load
mesh = cls.load_trimesh(path, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "E:\SD\ComfyUI\custom_nodes\ComfyUI-3D-Pack\mesh_processer\mesh.py", line 386, in load_trimesh
mesh.albedo = torch.tensor(texture[..., :3], dtype=torch.float32, device=device).contiguous()
~~~~~~~^^^^^^^^^

Thank you

MrForExample commented 4 months ago

Thanks for testing, I'll add it into bug fix

MrForExample commented 3 months ago

Screenshot 2024-07-02 162119 Problem turns out to be one edge case when loading .glb file without albedo texture maps, it will be fixed in next release, along with many other updates to make the system more robust!