
Bachelor's Project: Fluid Simulation Raytracing Rendering
-Context
This project is the practical part of my bachelor’s thesis, which explores the question:
“What are the challenges of representing a dynamic and implicit fluid in a raytracing pipeline using the DXR API?”
The analysis is based on a particle-based fluid simulation.
The project is still under development.
The aim of the project is to evaluate the feasibility and limitations of using the DXR API for implicit surface rendering in real time, and to better understand the strengths and weaknesses of this new technology.
The SPH simulation was originally developed by fellow Games Programming student at SAE Institute Geneva, Constantin Verine, as part of his bachelor’s project.
Click here to view his project
Together, we converted his CPU-based simulation into a compute shader, enabling me to render it using DXR ray tracing.
Showcase
To investigate the question, I implemented two distinct algorithmic approaches.
The first uses a raymarching algorithm within a custom intersection shader, enabling fluid rendering without the need to build a mesh.
Here is a raymarching prototype rendering with a large smoothing radius for the particles:
Here is another raymarching prototype rendering with a smaller smoothing radius for the particles.
The physical simulation doesn’t work very well, but the raymarching rendering is more realistic:
The second approach constructs a mesh using the marching cubes algorithm, allowing the pipeline to leverage hardware-accelerated ray-triangle intersections.
Here is a marching cubes prototype rendering testing the normals of the mesh with reflection rays.
It currently has visual bugs with triangles. It is very complicated to rebuild the DXR acceleration structure for each frame for this type of dynamic mesh.
What did I learn ?
- Using the DXR raytracing pipeline
- Creating custom intersection shaders
- The main optical properties of a fluid and their implementation in raytracing
- Reflection
- Refraction
- Absorption
- Scattering
- The raymarching algorithm
- The Marching Cubes algorithm
- Change the values of a mesh’s vertices in real time in the DXR acceleration structure
- Use compute shaders with DirectX
- Using StructuredBuffer and AppendBuffer
- Storing and sampling physical simulation data in 3D textures
- Adapting a particle-based CPU physical simulation to the GPU in Compute Shaders
- Creating a bitonic sort iterative algorithm on the GPU