'Distort multiple mesh on the same Sin wave path with Three.js and custom shaders

Im trying to create an effect where I have multiple images/meshes on the same sine wave. I can distort all separately, but of course they are not in sync.

In the vertex shader I have this line for the simple distortion:

pos.z += sin(pos.y);

My Idea would be to make the sin wave independent from the pos.y value and replace it with something like the current position y in the height of all of my images.

My other Idea would be to have only one mesh and paste every image on it, but I am not sure if it is a good practice or if that would work at all.

I would be greatful for any suggestion on how to implement this.

Thanks!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source