KhronosGroup / KhronosGroup/glTF
simple extension for geometry metadata
- Dominant language
- HTML
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 17h 26m
- Merged PRs (30d)
- 5
Description
Hey folks,
Throwing together a simple internal extension to allow glTF to summarise some computed geometry data –– I thought I might as well post here in case anyone else is interested.
The information we are interested in is **vertex count**, **triangle count**, and **world-space bounds** for each mesh. Since many nodes can instantiate a mesh, nodes are the meaningful place to insert the extension data.
Every node includes data on the cumulative counts and world bounds for the subtree they parent. If the node references a mesh, we also include the world bounds of just that node.
Limitations:
- This is just for the default static pose. We make no attempt to accomodate animations.
- We traverse the scene graph from the default scene. Other scenes would typically result in different per-node world transforms.
Proposed output:
```
{
"asset": { "version": "2.0" },
"extensionsUsed": [ "FB_geometry_metadata" ],
"scenes": [
{"nodes": [ 0 ]},
{"nodes": [ 2 ]}
],
"nodes": [
{
"children": [ 1 ],
"extensions": {
"FB_geometry_metadata": {
"nodeWorldBounds": {
"min": [ -0.26, 0.24, -0.88 ],
"max": [ 2.24, 1.88, -0.22 ]
},
"vertexCount": 48,
"triangleCount": 24
}
}
},
{
"mesh": 0,
"children": [ 2 ],
"extensions": {
"FB_geometry_metadata": {
"meshWorldBounds": {
"min": [ -0.13, 0.12, -0.44 ],
"max": [ 1.12, 0.94, -0.11 ]
},
"nodeWorldBounds": {
"min": [ -0.26, 0.24, -0.88 ],
"max": [ 2.24, 1.88, -0.22 ]
},
"vertexCount": 48,
"triangleCount": 24
}
}
},
{
"scale": [ 2.0, 2.0, 2.0 ],
"mesh": 0,
"extensions": {
"FB_geometry_metadata": {
"meshWorldBounds": {
"min": [ -0.26, 0.24, -0.88 ],
"max": [ 2.24, 1.88, -0.22 ]
},
"nodeWorldBounds": {
"min": [ -0.26, 0.24, -0.88 ],
"max": [ 2.24, 1.88, -0.22 ]
}
"vertexCount": 24,
"triangleCount": 12
}
}
}
],
"meshes": [
{
"primitives": [
{
"indices": 0,
"attributes": { "POSITION": 1 }
}
],
}
],
... rest of file
}
```
Contributor guide
Research direction
The issue contains a proposed FB_geometry_metadata JSON shape for nodes, meshes, counts, and world-space bounds, but names no repository files, tests, or implementation entry point. First determine where glTF extensions are specified and validated; done would require an agreed extension design and corresponding implementation and coverage for the stated static-pose limitations.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100