GLTF Loading Speed
There are two aspects of GLTF files that have non-optimal loading speed. First, the vertex data is not stored in the same exact layout and format as our vertex structure. I found the difference in performance for this was pretty small, even for large models, so I was willing to let it go. Tangents can take a bit longer to build, but those are usually included in the model if they are needed.
The second issue is the triangle tree structure which is used for raycasting (the pick commands). I found the difference in debug mode was really significant when using a large (two million poly) mesh. Here are the numbers. The big concern is building the pick tree in debug mode, which takes two minutes using this model.
GLTF Loading Speed (milliseconds)
Release Mode
- Vertices only: 1249
- Vertices + build tangents: 1276
- Vertices + build collision: 5563
Debug Mode
- Vertices only: 3758
- Vertices + build tangents: 12453
- Vertices + build collision: 120,000
I was able to improve this speed significantly by saving vertex and pick tree data to a cache file after processing.
Release Mode
- Cached data: 1233
Debug Mode
- Cached data: 2707
This is sort of a halfway step between using GLTF natively and converting to our faster-loading GMF2 file format.
I like the idea of keeping all files in easily-accessible formats like DDS and GLTF, but there are some big questions. Where and how should the mesh cache files be stored? A published game will not necessarily have write access for files in its own install folder, so any files written should be in the user Documents or AppData folders. How should the GLTF file be identified? By checksum? By full file path? The full file path will change when the game is installed on another computer. Should the mesh cache files be shipped with the game, or generated the first time it is run? Do we even need to worry about caching when release mode is used? It seems like only debug mode has a significant performance problem, so maybe this should be something that only gets used during development?j I need to think about this.
- 1
4 Comments
Recommended Comments