2D fluid simulation
This is the final project I made for the Physics-based animation class during my school. The code is placed here.
I have implemented a 2D stable fluid method using OpenGl based on the NVIDIA article and this paper.
​
I'll omit the detailed explanation since there is a detailed theory explanation on the NVIDIA article.
However, if I simply explained it, this program is to simulate Naiver-Stokes Equation in continuous small-time (I know this sounds dumb, but I don't really know how to explain this otherwise XD)
Advection
Pressure
Diffusion
External Forces
There are 4 terms in this equation, Advection, Pressure, Diffusion, and External Forces. For each iteration, I stored those states as textures, and update the final picture based on the textures every frame. Below the transition of textures in 1 frame (I skipped the diffusion part for my implementation since it looks more natural to me)
Add external force
Current frame
Velocity map
Calculate divergence based on velocity
Divergence map
Calculate pressure
Pressuer map
Update velocity map based on pressure map
Updated velocity map
Next frame
This project was easier than I expected even though I knew nothing about physics and mathematics required for this simulation. I would like to challenge 3D fluid simulation using volumetric rendering next time :)
References:
​
1. https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf
2. https://developer.nvidia.com/sites/all/modules/custom/gpugems/books/GPUGems/gpugems_ch38.html
3. https://note.com/unshift/n/nceb8d05620d9
4. http://el-ement.com/blog/2015/03/16/gpu-fluid/
5. http://blog.livedoor.jp/toropippi/archives/52986.html
6. https://hipwallpaper.com/super-sonico-backgrounds/
​
​