-
-
Notifications
You must be signed in to change notification settings - Fork 35.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
GLTFExporter: create separate accessors per group for non-indexed geometry #23333
Conversation
5069b57
to
9c129b2
Compare
cc @takahirox @donmccurdy It looks like you both have worked on GLTFExporter; would you be able to review this change? |
I don't think it's necessary to fix this – likely a rare case, and could be avoided by using indices. Performance-sensitive applications should probably be using indices anyway? Plenty of tools are available for optimizing the glTF after export as well. This looks good to me if @takahirox has no concerns — thanks @jtbandes! |
Any update on this? |
Sorry, wanted to review but lack of time. Please ignore me for now because I don't want to block. I may review later as follow up. |
The thing is that I'm not really a fan of our geometry groups / multi material API anymore... How does GLTF deal with the concept of geometry groups / multi material? |
In glTF a https://www.khronos.org/registry/glTF/specs/2.0/glTF-2.0.html#geometry A
Three.js But we realized that geometry groups and multi materials can make |
Each glTF mesh could contain many primitives, where some primitives are triangle meshes and others are points or lines, they do not have to be consistent. So, mapping a mesh to |
Closing in favor of #27268. |
Splitting a single mesh with multi materials (geometry groups) into separate meshes during export/import feels not quite right. It breaks many workflows dependant on nodes structure of the scene. In my case, I really need single mesh for the decals to work properly. Once you have exported a single mesh into multiple glTF primitives there must be a way to restore the same exact single mesh during the import process. |
I've given up on trying to have GLTFLoader create multi-material meshes during the loading process — there's no possible glTF input for which GLTFLoader will currently construct a multi-material mesh. Trying to do so within the loader added a lot of complexity and overhead in the past, so instead we produce a THREE.Group containing a THREE.Mesh for each glTF mesh primitive. I have no strong preference on what GLTFExporter should do, though. |
Fixes #21538
Description
GLTFExporter handled
groups
for indexed geometry by adjusting theindices
accessor. However, it was missing logic to handlegroups
in non-indexed geometry. This change adds support for non-indexed geometry by creating separate accessors for each group.Also adds a new multi-colored cube example (both indexed and non-indexed) taken from #21538 to misc_exporter_gltf.html,
and to the unit tests. Looks like the unit tests have been deleted 😓One downside of this implementation (and the current exporter architecture) is that the attribute data gets duplicated when groups overlap. Fixing this seems like it might require a more difficult refactor and I would appreciate input from anyone familiar with the existing code.