facebookincubator / FBX2glTF

A command-line tool for the conversion of 3D model assets on the FBX file format to the glTF file format.
Other
2.1k stars 332 forks source link

Added support for sparse accessors in blendshapes #241

Closed vfxgordon closed 4 years ago

vfxgordon commented 5 years ago

Blendshapes are one of those things where sparse accessors are incredibly useful, so this is a first pass at getting them working with FBX2glTF - it seems to work, glTF-validator seems completely happy with the file, but it appears that most software out there doesn't want to load them.

Blender doesn't like having an accessor with no bufferview (adding the base position bufferview to the accessor works, but does very strange things in Blender on account of not being a giant list of zeroes).

Although position, normal and tangents could all have their own sparse indices, it made more sense to use a shared index list based on the assumption that there would be significant overlap between each index list.

I'm not super happy with the giant initializer list in the overloaded Accessor constructor, so I wouldn't mind going back and changing that and I'm not 100% convinced that normals & tangents are stored as zero length normals for non deforming vertices.

Extending these to skin weights hopefully shouldn't be a big deal, I've tried to make the new methods as flexible as possible.

vfxgordon commented 5 years ago

Oh, my Blender was out of date, updated to the latest version and the file works fine.

vfxgordon commented 4 years ago

Found some issues with zero length accessors.