Custom shape in image not working

Re-compute of UVs:

    const geometry = new THREE.ShapeGeometry(heartShape);
    
    let pos = geometry.attributes.position;
    let b3 = new THREE.Box3().setFromBufferAttribute(pos);
    let b3size = new THREE.Vector3();
    b3.getSize(b3size);
    let uv = [];
    for(let i = 0; i < pos.count; i++){
      let x = pos.getX(i);
      let y = pos.getY(i);
      let u = (x - b3.min.x) / b3size.x;
      let v = (y - b3.min.y) / b3size.y;
      uv.push(u, v);
    }
    geometry.setAttribute("uv", new THREE.Float32BufferAttribute(uv, 2));

gives this:

4 Likes