Open3D
Open3D copied to clipboard
Update the GLTF writer to support writing textured models
The GLTF exporter does not currently support textured meshes. This is because Open3d's per triangle UV coordinates makes the task non-trivial. This change set adds that feature.
Note: this depends on #5938 which changes how textures are stored in an open3d::geometry::TriangleMesh
Type
- [ ] Bug fix (non-breaking change which fixes an issue): Fixes #
- [x] New feature (non-breaking change which adds functionality). Resolves #
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) Resolves #
Motivation and Context
The current GLTF exporter does not support textured meshes. This PR adds an exporter for TriangleMeshModels. Currently there is only a reader. It does not add support to the existing writer.
Checklist:
- [x] I have run
python util/check_style.py --applyto apply Open3D code style to my code. - [x] This PR changes Open3D behavior or adds new functionality.
- [ ] Both C++ (Doxygen) and Python (Sphinx / Google style) documentation is updated accordingly.
- [ ] I have added or updated C++ and / or Python unit tests OR included test results (e.g. screenshots or numbers) here.
- [x] I will follow up and update the code if CI fails.
- [x] For fork PRs, I have selected Allow edits from maintainers.
Description
Code was added to create TriangleMeshModels from a TriangleMesh. This isn't a simple conversion because TriangleMesh's support multiple materials, assigned on a per triangle basis. However TriangleMeshModels are supposed to only have one material per mesh. There is a similar issue for the export of the meshes. TriangleMesh's store texture coordinates on a per triangle basis. This is to support seams where the same vertex has different texture coordinates. However GLTF requires texture coordinates to be stored on a per vertex basis. So this PR adds a function to convert a mesh to have per-vertex texture coordinates. Currently this function is in a detail namespace but could be moved to a public API.