glTF-Validator
glTF-Validator copied to clipboard
Add object counts and sizes to report
Hi glTF-Validator team. I've been tasked with extending the report to include object counts and sizes as shown in this table. We can do this in python but I need a node solution and was hoping to use gltf-validator.
I'm happy to do it myself but I'm not sure where to start. Where in the code can I go to add these items to the validation result?
Hi @viperphase1,
We have this feature partly implemented within VS Code plugin, see the discussion in #73.
The next version of the validator (not public yet) has an enhanced report that includes some of information from the screenshot above. Could you please lay out the expected fields in a more formal way, so we can get predictable results? For instance:
- Mesh Vertices - sum of all vertices from all meshes (including overlapping accessors)
Also keep in mind, that sizes could also be ambiguous:
- different meshes can re-use same accessors;
- accessors could be sparse;
- different accessors could point to the same buffer views;
- different buffer views could point to the same regions of the same buffers (however this sounds like an exporter bug).
Please start with defining what kind of data do you need and I'll see whether it's already implemented or could be easily adjusted on our side. Anyway, I'd suggest waiting for the next public release before looking into the sources.
Hi, I'm one of the devs on viper's team. Our primary goal is to provide the user with the necessary information needed to determine whether or not the model is compatible with Google's recommended limits for AR models, as described on this page: https://developers.google.com/ar/develop/java/scene-viewer
| Feature | Data | Google's Recommended Limit | Notes |
|---|---|---|---|
| Animation | Animation Count | 1 | |
| Number of Vertices | Vertex Count* | 30,000 | |
| Number of Materials | Material Count | 10 | |
| Max Texture Resolution | Texture Resolution | 2048x2048 | This already exists in the report |
| Bone (including non-weighted joints) | Count of Animation Targets or Bones | 256 | Counting animation channels doesn't work here because the ARCore viewer packs translation/rotation/scale channels together into a single "bone" for transform-based animations. |
| Bone Weights per Vertex | Max count of weights per vertex | 4 | |
| UV | Count of UVs per mesh | 1 | |
| Model Size | Total file size | 10 MB | Probably doesn't need to be included in the report |
* Vertex count is tricky because it could mean the count of vertices in the accessors, or it could mean the total number of vertices that will be rendered in the scene, which means the count would be influenced by shared accessors and double-sided materials. I suspect Google's guidelines refers to the latter interpretation.
Since this requirements list is published as a general standard for Google's AR viewer on Android, it seems widely useful for a large demographic of GLTF developers.
We also are interested in a breakdown of the filesize, (answering the question: "Why is my file so big?"), but seems like there's a good deal of discussion already about that in the other thread you linked. Just getting the same info output in the validation report would be awesome.
Is this enough information for you? @lexaknyazev
Will point out that the gltf-transform inspect model.glb tool has a similar feature to what's described here, with CSV or Markdown formatting options. Example output below. Given that the feature exists in gltf-vscode and gltf-transform I'm unsure if further work is needed here?
❯ gltf-transform inspect ~/Desktop/Matilda.glb
METADATA
────────────────────────────────────────────
┌────────────────────┬───────────────────────┐
│ key │ value │
├────────────────────┼───────────────────────┤
│ version │ 2.0 │
├────────────────────┼───────────────────────┤
│ generator │ glTF-Transform v0.9.6 │
├────────────────────┼───────────────────────┤
│ extensionsUsed │ KHR_materials_unlit │
├────────────────────┼───────────────────────┤
│ extensionsRequired │ none │
└────────────────────┴───────────────────────┘
SCENES
────────────────────────────────────────────
┌───┬───────────┬────────────────────────────────────┬────────────────────────────────┬──────────────────────────────┐
│ # │ name │ rootName │ bboxMin │ bboxMax │
├───┼───────────┼────────────────────────────────────┼────────────────────────────────┼──────────────────────────────┤
│ 0 │ OSG_Scene │ RootNode (gltf orientation matrix) │ -34.38869, -0.25728, -21.18059 │ 48.2628, 190.55261, 31.79096 │
└───┴───────────┴────────────────────────────────────┴────────────────────────────────┴──────────────────────────────┘
MESHES
────────────────────────────────────────────
┌─────┬───────────────────────────────────────────────┬───────────┬────────────┬──────────────┬──────────┬─────────┬───────────────────────────────────────────────────────────────────────┬───────────┬───────────┐
│ # │ name │ mode │ primitives │ glPrimitives │ vertices │ indices │ attributes │ instances │ size¹ │
├─────┼───────────────────────────────────────────────┼───────────┼────────────┼──────────────┼──────────┼─────────┼───────────────────────────────────────────────────────────────────────┼───────────┼───────────┤
│ 0 │ polySurface1_surfaceShader1_0 │ TRIANGLES │ 1 │ 500 │ 996 │ uint32 │ NORMAL:float32, POSITION:float32, TANGENT:float32, TEXCOORD_0:float32 │ 1 │ 52.55 KB │
├─────┼───────────────────────────────────────────────┼───────────┼────────────┼──────────────┼──────────┼─────────┼───────────────────────────────────────────────────────────────────────┼───────────┼───────────┤
│ 1 │ polySurface2_surfaceShader1_0 │ TRIANGLES │ 1 │ 216 │ 428 │ uint32 │ NORMAL:float32, POSITION:float32, TANGENT:float32, TEXCOORD_0:float32 │ 1 │ 22.59 KB │
├─────┼───────────────────────────────────────────────┼───────────┼────────────┼──────────────┼──────────┼─────────┼───────────────────────────────────────────────────────────────────────┼───────────┼───────────┤
│ 2 │ polySurface3_surfaceShader1_0 │ TRIANGLES │ 1 │ 221 │ 433 │ uint32 │ NORMAL:float32, POSITION:float32, TANGENT:float32, TEXCOORD_0:float32 │ 1 │ 22.89 KB │
├─────┼───────────────────────────────────────────────┼───────────┼────────────┼──────────────┼──────────┼─────────┼───────────────────────────────────────────────────────────────────────┼───────────┼───────────┤
│ 3 │ polySurface4_surfaceShader1_0 │ TRIANGLES │ 1 │ 140 │ 280 │ uint32 │ NORMAL:float32, POSITION:float32, TANGENT:float32, TEXCOORD_0:float32 │ 1 │ 14.77 KB │
├─────┼───────────────────────────────────────────────┼───────────┼────────────┼──────────────┼──────────┼─────────┼───────────────────────────────────────────────────────────────────────┼───────────┼───────────┤
│ 4 │ polySurface5_surfaceShader1_0 │ TRIANGLES │ 1 │ 124 │ 248 │ uint32 │ NORMAL:float32, POSITION:float32, TANGENT:float32, TEXCOORD_0:float32 │ 1 │ 13.08 KB │
└─────┴───────────────────────────────────────────────┴───────────┴────────────┴──────────────┴──────────┴─────────┴───────────────────────────────────────────────────────────────────────┴───────────┴───────────┘
¹ size estimates GPU memory required by a mesh, in isolation. If accessors are
shared by other mesh primitives, but the meshes themselves are not reused, then
the sum of all mesh sizes will overestimate the asset's total size. See "dedup".
MATERIALS
────────────────────────────────────────────
┌───┬────────────────┬───────────┬──────────────────┬───────────┬─────────────┐
│ # │ name │ instances │ textures │ alphaMode │ doubleSided │
├───┼────────────────┼───────────┼──────────────────┼───────────┼─────────────┤
│ 0 │ surfaceShader1 │ 103 │ baseColorTexture │ OPAQUE │ ✓ │
└───┴────────────────┴───────────┴──────────────────┴───────────┴─────────────┘
TEXTURES
────────────────────────────────────────────
┌───┬──────┬─────┬──────────────────┬───────────┬───────────┬────────────┬───────────┬──────────┐
│ # │ name │ uri │ slots │ instances │ mimeType │ resolution │ size │ gpuSize¹ │
├───┼──────┼─────┼──────────────────┼───────────┼───────────┼────────────┼───────────┼──────────┤
│ 0 │ │ │ baseColorTexture │ 1 │ image/png │ 1024x1024 │ 480.76 KB │ 5.33 MB │
└───┴──────┴─────┴──────────────────┴───────────┴───────────┴────────────┴───────────┴──────────┘
¹ gpuSize estimates minimum GPU memory allocation. Older devices may require
additional memory for GPU compression formats.
ANIMATIONS
────────────────────────────────────────────
No animations found.