I got a conceptual question I cant wrap my head around. I made a picture from particles, so I have 50000 particles that make a nice picture. Now Id like to make a wave go through the picture / particles. all particles have x and y coord with z = 0.0 so z value this is what I want to animate over time
I have a basic vertex shader code
precision mediump float;
attribute float uColor;
attribute float uRnd;
uniform float uTime;
uniform float uMouseX;
uniform float uMouseY;
uniform bool uAnimate;
varying float uCol;
varying vec2 vUv;
varying vec2 vMousePos;
void main(){
uCol = uColor;
vUv = uv;
vMousePos = vec2(uMouseX, uMouseY);
vec3 pos = position;
vec4 modelPosition = modelMatrix * vec4(pos, 1.0);
vec4 viewPosition = viewMatrix * modelPosition;
vec4 projectedPosition = projectionMatrix * viewPosition;
gl_PointSize = 3.0;
gl_Position = projectedPosition;
}
Problem is I dont understand how can I influence only certain particles independet of others at any given time. for instance writing
vec4 modelPosition = modelMatrix * vec4(pos, 1.0);
modelposition.z += 100.0 * sin(uTime);
vec4 viewPosition = viewMatrix * modelPosition;
vec4 projectedPosition = projectionMatrix * viewPosition;
will influence every particle z position at any given time so entire picture moves. Iets say id want the wave to flow from left to right, so Id have to first start with particles on left side and then gradually move over to right side. what do I have to do to be able to select out certain vertexes from the rest ?