babylon-vrm-loader icon indicating copy to clipboard operation
babylon-vrm-loader copied to clipboard

Why the morphTarget is an array ?

Open sknightq opened this issue 2 years ago • 2 comments

I want to replace three-vrm with babylon-vrm-loader, but I have confusion about the morph target: In three-vrm, change blendeshape using as following (demo):

// set value
currentVrm.blendShapeProxy.setValue( THREE.VRMSchema.BlendShapePresetName.A, 0.5 + 0.5 * s );
currentVrm.blendShapeProxy.setValue( THREE.VRMSchema.BlendShapePresetName.BlinkL, 0.5 - 0.5 * s );
// get value
currentVrm.blendShapeProxy.getValue( THREE.VRMSchema.BlendShapePresetName.A);
currentVrm.blendShapeProxy.getValue( THREE.VRMSchema.BlendShapePresetName.BlinkL);

In babylon-vrm-loader, I think using morphing method can set value.

currentVrm.morphing('A', 1)
currentVrm.morphing('Blink_L', 1)

However, I don't know how to get the morphTarget value because the target is an array. And the array has the same object as this: Screenshot from 2022-01-07 13-27-05

three-vrm get value method source code

sknightq avatar Jan 07 '22 05:01 sknightq

There are MorphTargets per Mesh.morphTargetManager, so we need to set influence every related meshes.

Currently, there is no API to retrieve runtime morphTarget value.

I think it is good to add API like VRMManager.getMorphing(label: string): Nullable<number>.

il-m-yamagishi avatar Jan 07 '22 07:01 il-m-yamagishi

@il-m-yamagishi Thanks for your reply! But how to calculate the result of influence value? Just compare the counts of value 1 and value 0, or if has 0 then return 0, or other rules? I'm not familiar with the VRM.

sknightq avatar Jan 10 '22 02:01 sknightq