ScreteMonge / creators-kit

BSD 2-Clause "Simplified" License
4 stars 1 forks source link

Add GLTF and OBJ model exports #7

Closed mlgudi closed 3 months ago

mlgudi commented 3 months ago

I've enabled the config option for selecting export file format, and have added GLTF/OBJ exporters. I have tried to match the output of the Blender exporter as closely as possible.

GLTF exports support vert colours, face colours, and animations. Vertex colours are still used for face colours - but each vertex of a face is assigned the face colour. I intend to add materials for each unique face colour in the future.

Alpha is only partially functional with GLTF. You must first connect the colour attribute alpha to the shader's alpha in. Only alpha hashed will work with GLTF models, as alpha blend doesn't appear to be compatible with vert colour alpha.

Animations are exported as morph targets (aka shape keys) with no interpolation.

https://github.com/ScreteMonge/creators-kit/assets/46876568/c86c4706-1295-46d4-947e-61494107d262

OBJ exports support vert colours and face colours, but not animations. If OBJ is selected and the user exports an animation, it will use the Blender format as a fall-back.

One remaining issue, which appears to also be an issue with the Blender exporter, is that fire cape/infernal cape seems to radically distort the mesh when animated. I don't know if this is limited to these items.