Add Maya blendhsape weight names to gltf export

Hey all,
Babylon already exports blendshapes from maya to GLTF but I also need the names of the blendshape weights.

From the GLTF spec:

Implementation note: A significant number of authoring and client implementations associate names with morph targets. While the glTF 2.0 specification currently does not provide a way to specify names, most tools use an array of strings, mesh.extras.targetNames , for this purpose. The targetNames array and all primitive targets arrays must have the same length.

Adding the targetNames array to the maya exporter seems straightforward.

I’m not sure about reading the names into the Babylon structure first, though.
I can see BabylonMorphTarget already contains a “name” property but the value it’s assigned in Maya2Babylon::BabylonExporter is
name = $"{}_{}" which is not what I want.

Would it be OK to change the value of “name” to use the name of the weight attribute?

Hello and welcome!

pinging @bghgary and @Drigax

cc @Guillaume_Pelletier also

I’ve been experimenting with this and I noticed that is useful. So maybe name = $"{}.{}" would be more appropriate.
I’d rather use ‘.’ as delimiter as I regularly come across names that contain underscores.

Hi guy’s, I understand the point but this is subject to use case. How to find the right format wich is beeing usefull for every ones ?? do we need maybe to have a default format (which may come from json config file) and add a BabylonAttribute to specify custom format ?? In the last case, we experienced some bug with the use of the CustomAttribute API (either on Max And Maya) so i’m not a big fan of it. Once we find the best default value, we can update it accordingly.

Three.js and Blender use extras.targetNames. Is anyone aware of frameworks that use a different convention?
Or is this a Maya2Babylon issue?

About what actually goes into extras.targetNames, I’ve noticed that Blender only exports weightNames but if Babylon also exported the blendshapeDeformer name, it would make it posssible to deal with multiple blendshapes in a single mesh using the same weight names.

I am not the best placed to answer about exporters but I guess here this is a convention more than an underlying limitation. About the technic itself I ll definitely give the mic to @Guillaume_Pelletier, @Drigax and @bghgary for the most relevant answer.

I think this is an appropriate change, I originally went with the convention of “{deformer}_{mesh}” to make sure we have some sort of unique indentifier for the various blendshape deformers. As long as we make it clear what’s used for what in-scene, its should be good.

1 Like

I’ve raised

so you guys can have a look.
I’ve been using this version for the past few days in a Three.js renderer
1 Like