MorphTargetInfluences brakes gltf export if changed

After changing morphtargetinfluences on a loaded .gltf model, when I try to export it with the gltf exporter, if i don’t updateMorphTargets() which resets them to 0, the file is not readable.
How can I export the model with changed morph target values?

I change them with a range input, from 0 to 1, they work live in the viewport. So probably I’m doing something wrong while exporting.

const gltfExporter = new GLTFExporter();

const options = {
trs: params.trs,
onlyVisible: params.onlyVisible,
binary: params.binary,
maxTextureSize: params.maxTextureSize,
animations: [clip],
};

model.updateMorphTargets();

Could you clarify what is happening, and what “is not readable” means? Does the file pass validation in the glTF Validator? Does it work in viewers? Are there any errors? Anything you can share to help others reproduce the problem you face will get you to more useful responses more quickly.

I just realized that I wasn’t parsing to float from the range input, that was the problem. Everything is working now. Thank you.

1 Like