by soheil · 2y ago · 0 comments
You absolutely could do this using WebGL2 compute shaders too, but I thought it would be fun to try this newer API.
Here is a very basic shader for what you want:
float freq1 = 2.0;
float freq2 = 3.0;
float amp = 0.5;
pos.z += sin(pos.x * freq1 + uTime) * amp;
pos.z += cos(pos.y * freq2 + uTime) * amp;
gl_Position = projectionMatrix * modelViewMatrix * vec4(pos, 1.0);