I am new to graphics and physics simulation.
I am trying to perform a mass-spring simulation on CPU on individual vertices inside a mesh, and wondering how to best handle this.
If working with a rigid body, this is easy as every vertex is translated/rotated in the same way, so we can just supply a single transformation matrix with
glUniformMatrix4fv and don't have to touch the VBO for the positions.
With the mass-spring system, however, I'm a little lost. Am I just supposed to buffer entirely new vertex position data into the VBO on every frame? That's the only way I can see of doing it, but it feels very inefficient to have to replace the data for every single model in the scene on every draw call. Is there some better way of handling this?
I have thought of potentially being able to do the physics simulation on GPU inside the vertex shader, but then am not sure of how I would handle things like collision detection.
How are these kinds of simulations usually handled for real time rendering/game engines/etc? Is there a better way of handling this kind of per-vertex updating?