Morph Targets: how to disable morph targets

I tried to overcome the limitation of morph targets numbers. But I couldn’t disable the morph targets in vertex shader when morph targets animation play. I looked at the materialHelper :

  public static PrepareDefinesForMorphTargets(mesh: AbstractMesh, defines: any) {
    var manager = (<Mesh>mesh).morphTargetManager;
    if (manager) {
        defines["MORPHTARGETS_UV"] = manager.supportsUVs && defines["UV1"];
        defines["MORPHTARGETS_TANGENT"] = manager.supportsTangents && defines["TANGENT"];
        defines["MORPHTARGETS_NORMAL"] = manager.supportsNormals && defines["NORMAL"];
        defines["MORPHTARGETS"] = (manager.numInfluencers > 0);
        defines["NUM_MORPH_INFLUENCERS"] = manager.numInfluencers;
    } else {
        defines["MORPHTARGETS_UV"] = false;
        defines["MORPHTARGETS_TANGENT"] = false;
        defines["MORPHTARGETS_NORMAL"] = false;
        defines["MORPHTARGETS"] = false;
        defines["NUM_MORPH_INFLUENCERS"] = 0;


It seems that only two way to disable morph target. One is removing the morphtTargetManger from the mesh.Another is keeping mananger.numInfluencers zero. But I need to keep both the influencers and manager alive.
And is there any other way to keep the morphTargets disbled?
So is it possible to add ‘enableMorphTarget’ property to the MorphTargetManager class? As far as I know, Three.js MeshStandardMaterial has morphTargets property that controls whether morph target takes effect. Thanks a lot:slightly_smiling_face:

What will be the difference between disabling the morph target and unplugging it from the mesh? Not sure to get the rationale here

Also worth noting: Add support for data texture for morph target · Issue #9560 · BabylonJS/Babylon.js (

1 Like

If you don’t want to remove completely the manager because you want to disable it temporarily, you can do something like:

mesh.saveManager = mesh.morphTargetManager;
mesh.morphTargetManager = null;
mesh.morphTargetManager = mesh.saveManager;

The main difference is whether to pass the morph target value to the vertex shader. If only disable the morph target influences in vertex shader, the morph target animation data is available and can be use somewhere else. If I unplug morphTargetManager from the mesh, these animation data is not available.
I have tried the method @Evgeni_Popov and it works. Thanks a lot!