Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ms.transfer_attributes_to_texture_per_vertex doesn't write the texture file. #383

Open
jsusgin-aist opened this issue Jul 24, 2024 · 0 comments

Comments

@jsusgin-aist
Copy link

jsusgin-aist commented Jul 24, 2024

Certainly! Here's your original text with Markdown formatting applied to the code parts:


Hi,

I would like to generate a mapping between two objects, one being the parametrized xatlas export of the second one, with the function: ms.transfer_attributes_to_texture_per_vertex. I tried to use this filter on MeshLab and it worked, but I need to automatize it, and PyMeshLab doesn't generate the texture.png file.

This is my code:

import xatlas
import trimesh

atlas = xatlas.Atlas()
mesh = trimesh.load_mesh("input.obj")
vmapping, indices, uvs = xatlas.parametrize(mesh.vertices, mesh.faces)
xatlas.export("output.obj", mesh.vertices[vmapping], indices, uvs)

In another Python kernel:

import pymeshlab

ms = pymeshlab.MeshSet()
srcmesh = ms.load_new_mesh("input.obj")
tgtmesh = ms.load_new_mesh("output.obj")  # Assuming "output.obj" is the parametrized mesh
tex_out = 'texture.png'

assert len(ms) == 2  # True

ms.transfer_attributes_to_texture_per_vertex(sourcemesh=0, targetmesh=1, textname=tex_out)
# Got console output: "Similar Triangles face sampling" but the tex_out is not created.

I also tried to create an empty file with with open(tex_out, 'w') as f: pass before running the transfer_attributes_to_texture_per_vertex function, but it didn't change anything. I also tried to set "overwrite" to True, but it didn't change anything, whether the file was created initially or not... Did I miss something?

Thank you for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant