I am trying to implement a particle system morph in between geometries, for some reason morphtargetinfluences stays undefined . I am using three r 143
const shaderMat = new ShaderMaterial( {
uniforms: {
color: { value: new Color( 0xffffff ) }, // pointTexture: { value: new THREE.TextureLoader().load( 'textures/sprites/disc.png' ) },
alphaTest: { value: 0.025 } ,
size: { value: minScale },
scale: { value: 1 }
},
vertexShader: vShader,
fragmentShader: fShader,
blending: AdditiveBlending,
depthTest: false,
transparent: true,
} );
shaderMat.morphTargets = true;
const particles = new Points( geometry, shaderMat);
//...
for (let i = 0; i < harmonySamplers.length; i++)
{
let vertices = [];
var tempPosition = new Vector3();
const tempBufferGeometry = new BufferGeometry();
for (let j = 0; j < maxParticles; j++)
{
harmonySamplers[i].sample(tempPosition);
vertices.push(tempPosition.x, tempPosition.y, tempPosition.z);
tempBufferGeometry.setAttribute("position", new Float32BufferAttribute(vertices, 3) );
}
geometry.morphAttributes.position[ i ] = tempBufferGeometry.attributes.position.array
}
//....
group.children[0].morphTargetInfluences[ 0 ] = 0
group.children[0].morphTargetInfluences[ 1 ] = 0.5
console.log("child " + group.children[0].morphTargetInfluences) //0 0.5
console.log("child " + group.children[0].material.morphTargets) // true