google / usd_from_gltf

Apache License 2.0
547 stars 86 forks source link

GLTF_ERROR_ID_OUT_OF_RANGE when more than 65535 accessors #53

Open norgeotloic opened 4 years ago

norgeotloic commented 4 years ago

Hello there :wave:

I've stumbled upon "exotic" GlTF files which have more than 65535 accessors (imagine a GlTF file with 12k primitives, each having a POSITION, indices, NORMAL, TANGENT and 2 TEXCOORDS accessors -> 72k accessors in total).

In the code, an entity "Id" is defined as a uint16: https://github.com/google/usd_from_gltf/blob/c49b1b1abce65fdc6e1bbcd11e6240138225e9f1/gltf/gltf.h#L29 which makes it impossible to convert a GlTF with more than 65535 of one type of data (acessors, buffers, animation channels...): the conversion fails with both GLTF_ERROR_MISSING_ACCESSOR and GLTF_ERROR_ID_OUT_OF_RANGE errors.

My question is then quite simple, ignoring the fact that such files are far from being optimized and that I should probably not try to convert them in the first place:

Is there a "hard" limit in USD to use uint16 indices for this data other than size optimization, or can I safely replace this type with uint32_t for such files ?