-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Copy UV coordinates from a reference mesh. #6625
Comments
Related: #6615 |
Greeting, Could you please provide me some brief info about the issue and location of files/folder in which it need to be fixed. |
Disclaimer: I'm new to Open3D as well, so take this as an idea to explore. Someone more experienced can probably help you better. Assume we have a way to detect if the vertices of a triangle have "crossed the edge and wrapped around". Let, for example, |
I'm wondering if I am using this correctly. I tried applying this to a mesh that I then applied quadric simplification to and the render didn't come out making sense. The dataset is about 300 MB and is derived from the ODM Test Dataset Sheffield Cross, I did modify it to bake the texutres into a single atlas. I then used this code snippet to try coping the UV coordinates. int main(int argc, char** argv) {
const std::string source_path = "combined_mesh.obj";
open3d::geometry::TriangleMesh mesh;
if (!open3d::io::ReadTriangleMesh(source_path, mesh, {})) {
open3d::utility::LogError("Failed to read {}", source_path);
}
open3d::geometry::TriangleMesh processed = mesh;
processed.materials_.clear();
processed.textures_.clear();
processed.triangle_material_ids_.clear();
processed = *processed.SimplifyQuadricDecimation(
static_cast<std::size_t>(processed.triangles_.size() * 0.5),
std::numeric_limits<double>::max(), 100.0);
processed.InterpolateTextureCoordinatesFrom(mesh);
const std::string out_path = "UVTransfered.obj";
if (!open3d::io::WriteTriangleMesh(out_path, processed)) {
open3d::utility::LogError("Failed to write to {}", out_path);
}
return EXIT_SUCCESS;
} Here is a screenshot of the input mesh: I was expecting to see some issues around texture seams, but this strange result makes me think I applied it wrong. Thoughts? |
Checklist
main
branch).Proposed new feature or change
In many mesh processing workflows, UV coordinates are not preserved (e.g. mesh simplification). UV coordinates are required for many downstream tasks. One way to propagate UV coordinates through mesh processing workflows is by copying them from the original mesh. Here is an outline:
meshB.InterpolateTextureCoordinatesFrom(meshA)
. This does:References
No response
Additional information
It may be necessary to convert from per-triangle UVs to per-vertex UVs (or vice versa). The following code shows an example of how to make that conversion: https://github.com/isl-org/Open3D/blob/main/cpp/open3d/visualization/rendering/filament/TriangleMeshBuffers.cpp#L614
The text was updated successfully, but these errors were encountered: