[Updated]
Compute Shaders
Compute Shaders are a really really cool stuff! It's meant to expand the GPU capabilities to run any kind of massively parallel computation.
My final career project, several years ago, was about CUDA. That was technology developed by nVidia to do exactly the same thing on their GPUs, but it was not compatible with ATI cards. But now Compute Shaders works on every card that supports DirectX 11 and it is very very similar to CUDA, the language is HLSL, very similar to C :)
Demo
I've made a Demo that shows how several balls can interact with a ground with 1 Million leafs running at 30 FPS in the next hardware; GPU nVidia Geforce GTX 680 and CPU Intel i7 920.
The same simulation in CPU is running around 0.1 FPS.
For every leaf I calculate two distances, the impact radius "less than 0" to flatten the leafs and the expansive wave radius "less than 2" meters to twist them simulating the impact of the wind generated by the impact of a ball with the floor.
The Compute Shader is configurated by a grid of 32x32 Threads per Thread Group and 32x32 Thread Groups.
All the Grass are painted in a single Render Call with Intancing and the primitive Point.
In geometry shader I recreate the quads per every point and read from the Compute Buffer the physics data that must be applied on every leaf
The same simulation in CPU is running around 0.1 FPS.
For every leaf I calculate two distances, the impact radius "less than 0" to flatten the leafs and the expansive wave radius "less than 2" meters to twist them simulating the impact of the wind generated by the impact of a ball with the floor.
The Compute Shader is configurated by a grid of 32x32 Threads per Thread Group and 32x32 Thread Groups.
All the Grass are painted in a single Render Call with Intancing and the primitive Point.
In geometry shader I recreate the quads per every point and read from the Compute Buffer the physics data that must be applied on every leaf
Code
https://github.com/mqmtech/ShadersDemo