exporter unecessarily splits geometry in blocks of 65535 vertices
See original GitHub issueDescribe the bug Tried to export a huge scene, the exporter is splitting unnecessarily the vertex buffers in blocks of a max of 65535 vertices
12:00:01 | DEBUG: Adding primitive with splitting. Indices: 123480 Vertices: 65535 12:00:01 | DEBUG: Adding primitive with splitting. Indices: 210033 Vertices: 65534 12:00:02 | DEBUG: Adding primitive with splitting. Indices: 292386 Vertices: 65533 12:00:02 | DEBUG: Adding primitive with splitting. Indices: 160830 Vertices: 39829
this was caused by this code
# NOTE: Values used by some graphics APIs as "primitive restart" values are disallowed.
# Specifically, the value 65535 (in UINT16) cannot be used as a vertex index.
# https://github.com/KhronosGroup/glTF/issues/1142
# https://github.com/KhronosGroup/glTF/pull/1476/files
range_indices = 65535
The index that marks a primitive restart is 65535, but that is only true when you are using triangle strips and 16bits index buffers. For other instances, like in my case where we are exporting triangle lists and 32 bit index buffers this doesn’t apply. Actually I made that value bigger and the scene exported and loaded fine.
12:05:48 | INFO: Starting glTF 2.0 export 12:05:48 | INFO: Extracting primitive: Mesh_0 12:06:04 | DEBUG: material_idx 0 12:06:04 | DEBUG: Adding primitive without splitting. Indices: 786801 Vertices: 236431 12:06:04 | INFO: Primitives created: 1 12:06:06 | INFO: Finished glTF 2.0 export in 17.52252435684204 s
To Reproduce Just generate a huge sphere and export it, notice the many primitive nodes
Expected behavior I’d expect just a big vertex buffer
Version 2.80
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:12 (2 by maintainers)
Top GitHub Comments
Can confirm, the new exporter that ships with Blender 2.82 solves this problem. Now that 2.82 is the latest stable version, it can be found in the standard downloads page.
@tomm1996 Sorry, I did a mistake on branch it was solved. 2.81 still split at 65534, but it should be ok in blender 2.82 alpha (you can test downloading it here : builder.blender.org )