Original Post
I'm trying to implement simple physics on the graphics card, is it possible to put the physics equations into a vertex or pixel shader? Will it be faster then doing it on the cpu? I've read a few posts by other on this and other sites, and they seem to be saying that it's hard to do because vs and ps can't write the positions of the transformed vertecies back to system memory, that means you have to encode those vertices as textures etc. But I don't understand why I need to get the vertices back from the card. As far as I know, physics simulations (where there is no collisions involved) are not dependent on the previous positions of the objects. All thats required is time, which can be easily sent every frame. Inside the shader I would have techniques that would represent what sort of a physics field I want to simulate. Is this doable? p.s I know there are bunch of libraries that are natively implemented on the GPU like Havok, PhysX, but I want to write my own equations because this project is more for my physics class then for a game. I want to be able to visualize the formulas that we're going through, and since I know how to program I thought it would be useful to implement each chapter that we go through in code, that way I have a small physics engine by the time the class is done. Thanks