-
Notifications
You must be signed in to change notification settings - Fork 65
Description
currently reading glTF data that utilizes byteStride in its accessors is not supported
(for example, the avatars at Ready Player Me use byteStride, see https://models.readyplayer.me/678703d63cb298e56bf50122.glb?morphTargets=ARKit&textureAtlas=1024)
I think this would need some refactoring of the gltf-loader gltf2.py:
currently, the Accessor and BufferView are intermixed in some places which prevents a easy implementation for reading buffer-data with defined byteStride.
See for example VBOInfo, or more precisely the creation of it from GLTFAccessor.info() which tries to merge data from GLTFAccessor and GLTFBufferView, and then implements its own read() method for reading & preparing the gl buffer, see implementation of GLTFMesh.load().
I think, the reason for this was, to be able to merge multiple accessors & buffer-views, to make the rendering more efficient. But the current implementation cannot i.m.o. easily changed to also support byteStride, since an efficient implementation would require information from the accessor & buffer-view.
I think it would be more clean, to implement & use an appropriate method in GLTFAccessor that supports byteStride.
As an example for how to read data with byteStride, see e.g. trimesh's implementation
I did try out the trimesh implementation and got it to work with gltf2.py, but as I mentioned, without some refactoring, the code is quite hacky.