Hello guys, I’m stuck in this issue while taking some experiments and I really need your help.
I have a 3D model with shape keys animations exported from Blender. Blue dots are control points that I manually select vertex index in Blender and create sphereMesh at that vertex position. (Deforming purpose)
When I update morphTargetInfluences, I remove the old ‘control points group’ and then onFinish I create new control points using new vertices position from morphedPositionAttribute.array that I receive after use the computeMorphedAttributes from BufferGeometryUtils
let morphChange = (type: number, value: number) => {
removePoints(); // Remove old control points
if(faceMesh.morphTargetInfluences){
faceMesh.morphTargetInfluences[type] = value;
}
};
meshGUI.add(morphOptions, 'lowerLips', 0, 1, 0.01).onChange((value) => morphChange(1, value)).onFinishChange((finishvalue) => {
let morphed: any = computeMorphedAttributes(faceMesh);
faceMesh.geometry.setAttribute('position', morphed.morphedPositionAttribute);
generatePoints(morphed);
});
let pointsArray = !morphedAttributes ? faceMesh.geometry.attributes.position.array : morphedAttributes.morphedPositionAttribute.array;
let itemSize = !morphedAttributes ? faceMesh.geometry.attributes.position.itemSize : morphedAttributes.morphedPositionAttribute.itemSize;
Everytime I update the value, the vertices (only vertices that morph takes effect) keep moving up, though I update the same value each time. The bigger value I update, the more distance vertices move up.
I’m not really understand what computeMorphedAttributes do. Please tell me more about 4 properties that I receive from computeMorphedAttributes : positionAttribute
, normalAttribute
, morphedPositionAttribute
and morphedNormalAttribute
.
P/s: Sorry for my bad english.