Real-Time 3D Fluid Dynamics
using GPU (OpenCL)
Language: C++, Middleware: OpenCL, OpenGL
Overview of the project
Motivation
- How to simulate interactive fluid simulation (by wind) and render in 3D.
Problem which I had
- Fluid dynamics (Navier-Stokes equations) is extremely expensive to compute.
- Volume rendering in 3D space is completely different matter. We need to fill in inside cube rather than drawing surface of the cube.
Which features are included in this project
- Navier-Stokes equation: Compute diffusion and advection of fluid in each time step.
- OpenCL: In this project, I needed to render 200,000 vertices and, in order to render colour of the vertices, the system runs many for-loops up to 4 for-loops. This computation is needed to compute on GPU using openCL.
- Volume Rendering: I used 3D texture to fill in space.
How to solve the problem
- Compute Fluid Dynamics (Navier-Stokes equation) on GPU side, because we need to compute the colour of all vertices as analysing the coherence with neighbouring vertices.
- Using 3D texture, I actually fill in the 3D space rather than using billboard or particle system so that fluid has real volume in the space.
Limitation
- Advection is computed on the CPU so that 'bottle neck' happens, which slows down the system. It should be improved for the performance of system.
- Since I used the stack of 2D texture to fill in 3D space, the quality of output is dependent on the view position, which sliced the space along z axis so that we can see good rendered image only in front side. I need to implement different slicing strategy depending on viewing position.