-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Update the GLTF writer to support writing textured models #6101
Draft
dbs4261
wants to merge
20
commits into
isl-org:main
Choose a base branch
from
dbs4261:model_writer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Changed TriangleMesh::materials_ to be a std::vector<std::pair<std::string, Material>> so that the order of materials when loading a mesh is respected. Using the unordered map caused issues when a Default Material and a texture were loaded and the texture would end up as the second material in the iterator. Now TriangleMesh::triangle_material_ids_ will indicate what material index should be used. A warning is given when passing a TriangleMesh to the visualizer and more than one material index is found, and the minimum value found in TriangleMesh::triangle_material_ids_ is used. If no triangle_material_ids_ exist then the first material in the order they are loaded will be used.
…iangle mesh model
…y its materials into a TriangleMeshModel
…ngs. Removed dead code.
…Mesh as well as for exporting a TriangleMeshModel to GLTF
…than one material was in use.
…4 byte boundaries
…g for remapped vertices correctly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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:
python util/check_style.py --apply
to apply Open3D code styleto my code.
updated accordingly.
results (e.g. screenshots or numbers) here.
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.
This change is