vpenades / SharpGLTF

glTF reader and writer for .NET Standard
MIT License
467 stars 75 forks source link

BlendShape / MorphTarget #86

Closed EricBeetsOfficial-Opuscope closed 3 years ago

EricBeetsOfficial-Opuscope commented 3 years ago

Hi there,

I would like to encode my own 3d asset with BlendShapes. I saw the WithMorphTargetAccessors but i don't know kow to convert my IEnumerable<Vector3> to IEnumerable<MemoryAccessor> and if it's the good way to do it .. Help will be very appreciated ;)

Thank in advance, Eric

vpenades commented 3 years ago

You could try to use WithMorphTargetAccessors, yes, but that's a very low level API that's only recomended if you know very well what are you doing, and you have a good understanding on glTF architecture.

The recomended way of creating or importing a mesh into glTF is by using the MeshBuilder API you can find in the toolkit library. MeshBuilder has an API to add morph targets, although it's a bit ugly.

You can find an example here