GPU GEMS 2D Fluid Simulation by Scrawk - 4

Shaders & Effects

2D fluid simulation in Unity

Unity 2020.1.6f1MIT LicenseUpdated 25 days agoCreated on June 21st, 2017
Go to source


This a port of the GPU GEMS article on fluid simulation to Unity. Well kinda. Its is mostly based on a 2D fluid sim found on the Little Grasshopper blog. That project was based on the GPU GEMS article also. I found he had simplified the code a little and his way of doing things was much easier to read.

There are a lot of stages to perform per frame and getting these to all work in the right order was a little bit of a pain. I was quite surprised by how many graphics blit operations need to be performed each frame. There needs to be about 60 per frame. This is a huge amount of work for the GPU to do but the frame rate is still about 60 fps which is not bad. You can decrease the number of jacobi iterations which take up the majority of the work that needs to be done. The quality of the fluid simulation will suffer if it is decreased too much as they are needed to compute a divergent free fluid simulation.

2D Fluid Sim

Show all projects by Scrawk