I’ve come across this problem several times now when working with parametric models. I think you have a few options and the first one seems to fit your case the best:
-
Since you’ve separated the edge and the meshes you’re morphing seem to be basically a cuboid, you could avoid the complexity of modifying UV maps and simply scale the texture X/Y repeat values.
-
If you wanted to include the edge and make do with a single mesh, you could prepare a UV map where you’d seam cut and distribute each side of the mesh as its own UV island around the same origin, basically mimicking how your mesh is physically laid out. Then you could move (not scale, that would eventually deform the texture due to the diagonal edge) the relevant UV coords in the direction of your morphTarget transformation.
-
In more complex cases you can work with several UV maps - a base and one more for each shape key / morphTarget extremity. Then you can interpolate the active UV map by calculating the deltas between the base and the target UV coords multiplied by the influence ratio.
You can find some hints at the boilerplate around updating UVs here How do I update the UV mapping for a shapeGeometry? · pmndrs/react-three-fiber · Discussion #1488 · GitHub
Another discussion on the UV topic Updating UV coordinates of BufferGeometry