I have a running particle system which emits particles in a given radius. Now I want to add some gravity to it. The particles and velocities of each particle is saved in a 2D Texture, now I want another 2D Texture, where I can save the gravity, but i'm missing the knowledge to do so. What's the actual formula on creating some gravitation or how can it be simulated?
For example to save particle's vel, I have
uniform sampler2D pv;
which is just an image which outputs an image and takes the output as input into the shader. (Kind of transform feedback)
uniform float spread;
vec2 vel = ...;
gl_FragColor = vec4(spread*vel, 0.0, 0.0);
(Part of my code)
And now I simply want another uniform sampler2D pg;
which holds gravity and right here, I'm missing the math...