Newtonian Particles on the GPU: P and V textures

CS 482 Lecture, Dr. Lawlor

The basic idea for simulating Newtonian particles on the GPU is to keep the position P and velocity V in textures, and compute their changes in pixel shaders. 

The big challenge is in a 3D simulation, P is XYZ, and V is XYZ, so we have a total of 6 floats, but a shader's output can only be 4 floats.  Possible solutions include:
OK, now we can compute positions and velocities.  For newtonian mechanics, we can either have a separate force texture, or compute the force as a local variable inside the velocity shader.  Typically it's more efficient, and less code and hassle, to recompute things rather than store and load them later.