[GLTF] Reuse mesh buffer items
See original GitHub issueMultiple copies of the mesh data are included when with the same mesh is added to the scene multiple times. I would be nice to identify that the mesh data is already present and avoid adding it again. This will allow us to have smaller files and in some cases speed up write times.
Bellow is a simple example of a scene where we should try to have a single buffer item.
from trimesh import Scene
from trimesh.creation import box
from trimesh.transformations import translation_matrix
import trimesh
scene = Scene()
box_1 = box()
box_2 = box()
print(trimesh)
scene.add_geometry(box_1, 'box_1', transform=translation_matrix((1, 1, 1)))
scene.add_geometry(box_2, 'box_2', transform=translation_matrix((-1, -1, -1)))
scene.export('boxes2.glb')
I may have a chance to tackle this myself, but wanted to capture this task here incase there were any upfront objections to adding this.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Mesh - glTF-Transform
Meshes define reusable geometry (triangles, lines, or points) and are instantiated by Nodes. Each draw call required to render a mesh is represented...
Read more >glTF in Unity optimization - 1. Buffers, Accessors and Primitives
In Unity you render geometry via a Unity Mesh, which is a data structure that tightly bundles vertex attribute buffers and (sub) mesh...
Read more >How do indices work (under primitives)? - glTF
Hi, In the mesh attribute I got a vector of positions and textures. ... This arrangement allows vertices to be reused by multiple...
Read more >Mesh and PointCloud Loaders - loaders.gl
Keys are glTF attribute names and values are accessor objects. indices, Object (Optional), If present, describes the indices (elements) of the geometry as...
Read more >Mesh | API Reference | ArcGIS Maps SDK for JavaScript 4.25
To support multiple materials (as is often the case for complex 3D models), meshes may define components that define a material for a...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ah nevermind that just combines them into one big buffer. Dedupe branch here with the hashing strategy works for meshes: https://github.com/mikedh/trimesh/tree/gltf/dedupe
Hmm, what about the existing
merge_buffers
option? IEscene.export(file_type='gltf', merge_buffers=True)
. It seems like it does pretty much this, maybe it should be selected by default?