Indeed, the geometry was empty. Here is the code should anyone need it:
//geometry
const sphereMesh = new Mesh(new SphereGeometry(2), polyMat)
const tetraGeo = new TetrahedronGeometry(2, 0) //const tetraGeo = new DecalGeometry( mesh, position, orientation, size );
const tetraMesh = new Mesh(tetraGeo, polyMat)
tetraMesh.rotation.y = Math.PI / 4
tetraMesh.rotation.x = (Math.PI / 4) * 3
const cubeMesh = new Mesh(new BoxGeometry(2, 2, 2), polyMat)
const icoMesh = new Mesh(new IcosahedronGeometry(2, 0), polyMat)
const octoMesh = new Mesh(new TorusKnotGeometry(1.5, 0.5, 80, 15, 2, 3), polyMat)
const sphereSampler = new MeshSurfaceSampler(sphereMesh).build()
const tetraSampler = new MeshSurfaceSampler(tetraMesh).build()
const cubeSampler = new MeshSurfaceSampler(cubeMesh).build()
const icoSampler = new MeshSurfaceSampler(icoMesh).build()
const octoSampler = new MeshSurfaceSampler(octoMesh).build()
const harmonySamplers = [sphereSampler, tetraSampler, cubeSampler, icoSampler, octoSampler]
const harmonyBuffers = []
//console.log( harmonySamplers[0])
for (let i = 0; i < harmonySamplers.length; i++) {
const vertices = []
const 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)
}
geometry.morphAttributes.position[i] = new Float32BufferAttribute(vertices, 3)
harmonyBuffers[i] = tempBufferGeometry
}
const systemGeom = new BufferGeometry()
systemGeom.setAttribute('size', new BufferAttribute(OGscales, 1))
systemGeom.setAttribute('position', new Float32BufferAttribute(OGPos, 3))
systemGeom.morphAttributes.position = geometry.morphAttributes.position
const particles = new Points(systemGeom, shaderMat) //mat_P);
particles.updateMorphTargets()
particles.morphTargetInfluences[0] = 0
//shader
const vShader = `
attribute float size;
varying vec3 vColor;
// uniform float morphTargetInfluences[ 5 ];
#include <morphtarget_pars_vertex>
void main() {
#include <begin_vertex>
#include <morphtarget_vertex>
vec4 mvPosition = modelViewMatrix * vec4( transformed, 1.0 );
gl_PointSize = size ;
gl_Position = projectionMatrix * mvPosition;
// gl_Position = vec4( transformed, 1.0 );
}`
const fShader = `
uniform vec3 color;
uniform float alphaTest;
uniform vec2 u_resolution;
varying vec3 vColor;
void main() {
vec2 xy = gl_PointCoord.xy - vec2(0.5);
float ll = length(xy);
gl_FragColor = vec4(color * 10.0 , step(ll, 0.5 ) * alphaTest);
}`
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
//, lighting : true
})
//Updating morph targets
group.children[0].morphTargetInfluences[i] += 0.001