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

Slicing a mesh and preserving the textured visuals #1920

Closed
cosw0t opened this issue May 5, 2023 · 1 comment
Closed

Slicing a mesh and preserving the textured visuals #1920

cosw0t opened this issue May 5, 2023 · 1 comment

Comments

@cosw0t
Copy link

cosw0t commented May 5, 2023

Does trimesh provide a way to slice a mesh with a plane and not drop the texture visual?

As of version 3.21.5, in mesh.slice_plane, the sliced vertices/faces are assigned to a new mesh without any material, because no uvs are computed for the newly created vertices.

In theory it seems almost straightforward - for every vertex that is created by cutting one edge, compute the barycentric coordinates of said vertex with respect to the vertices that make the edge, and interpolate their uvs.
The slice_mesh_plane could accept uvs (or any attribute for that matter, e.g. vertex normals) and return them interpolated.

In practice I'm finding it difficult to patch the function to do that, so I was wondering if you had a fix planned or something in the making already?

Thanks!

@mikedh
Copy link
Owner

mikedh commented May 5, 2023

Yeah that's just not implemented and there's no fixes on the horizon, PR's welcome!! I like the idea of doing it for arbitrary vertex attributes too. Agreed the logic in there is pretty dense and it's hard to figure out exactly where to plug in the barycentric interpolation, when I briefly looked into it.

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

2 participants