Is it possible to implement this in threejs?

Is it possible to implement this in threejs?
https://www.facetouchup.com/plastic-surgery-simulator/
This is webgl.
I tried to implement this way.
https://jsfiddle.net/wolfgangabersdorf/hjauxgsv/4/
Only it works very slowly.

I also tried method- setFromPoints

   for(i...){
...
        npoints.push(new THREE.Vector3( x, y, z));
   }
     .... 
     geometry.__dirtyVertices = true;
     geometry.setFromPoints(npoints);
     geometry.verticesNeedUpdate = true;
     geometry.attributes.position.needsUpdate = true;

But it still works slowly. I think you need to use shaders. Or can it be accelerated otherwise?

Try not to create Vector3 objects for every vertex in a loop, and certainly not in the render loop. Your JSFiddle with geometry.attributes.position.setXYZ( i, x, y, z ); looks much better. That doesn’t seem too slow to me, what issue are you seeing there?

1 Like