Image to 3D textured object
It would be nice if you could load both pipelines
# Load image to 3D Pipeline
iTo3d_pipeline = Trellis2ImageTo3DPipeline.from_pretrained("microsoft/TRELLIS.2-4B")
iTo3d_pipeline.cuda()
# Load texture Pipeline
texture_pipeline = Trellis2TexturingPipeline.from_pretrained("microsoft/TRELLIS.2-4B", config_file="texturing_pipeline.json")
texture_pipeline.cuda()
Then simply run something like:
with timer(f"getting mesh for: {image_name}"):
image = Image.open(image_file)
mesh = iTo3d_pipeline.run(image)[0]
mesh.simplify(MAX_FACES) #
with timer(f"adding texture to mesh for: {image_name}"):
image = Image.open(image_file)
output = texture_pipeline.run(mesh, image)
output.export(glb_outfile, extension_webp=True)
But the mesh output from Trellis2ImageTo3DPipeline, cannot be used directly in Trellis2TexturingPipeline.
There must a simple conversion though?
Actually, the image-to-3D pipeline internally uses the same model and algorithms as the texturing pipeline, so this may not be necessary. If you do need something like this, you can simply read the vertices and faces from the mesh output of the image-to-3D pipeline, convert them from PyTorch tensors to NumPy arrays, and then feed them into a trimesh.Trimesh object.
I find that even the example https://github.com/microsoft/TRELLIS.2/blob/main/example_texturing.py just results in this black object.
I can't find config_file="texturing_pipeline.json" anywhere in the repository if that's necessary.
I find that even the example https://github.com/microsoft/TRELLIS.2/blob/main/example_texturing.py just results in this black object. I can't find
config_file="texturing_pipeline.json"anywhere in the repository if that's necessary.![]()
I'm facing the same issue. Have you identified what caused this?