How to change vertex positions without separating edges

I’m following a tutorial for making low poly procedural clouds . I tried using buffergeometry because geometry is deprecated but when it comes to the jitter part I got this.
image
How do to make the edges connected between them?

        const mergedGeoms = [];

        const tuft1 = new SphereGeometry(1.5,7,8)
        tuft1.translate(0,0,2)
        mergedGeoms.push(tuft1)
        const tuft2 = new SphereGeometry(1.5,7,8)
        tuft2.translate(0,0,-2)
        mergedGeoms.push(tuft2)
        const tuft3 = new SphereGeometry(2,7,8)
        tuft3.translate(0,0,0)
        mergedGeoms.push(tuft3)

        const cloud = BufferGeometryUtils.mergeGeometries(mergedGeoms)

        const rangeMap = (percentage, rMax, rMin)=>{
	       return percentage*(rMax-rMin) + rMin
        }

        cloud.attributes.position.array.forEach((_, i, arr) => {
            arr[i]+=rangeMap(Math.random(),0.2,-0.2)
        })

        const mesh = new Mesh(cloud, new MeshLambertMaterial({color:'white', flatShading:true, side: DoubleSide}))
        scene.add(mesh)
  1. If applicable, open the model in blender and make sure vertices are not disconnected there.
  2. If non-applicable, make sure you’re using an indexed geometry - non-indexed geometries triangles are separated (you can use BufferGeometryUtils.mergeVertices to approximate an indexed geometry from a non-indexed one. Also, a related longer thread.)
2 Likes