ROLE: Physics & Graphics Programmer
ENGINE: Custom Game Engine
DEV TIME: Aug 2023 - Present
LANGUAGES: C++, HLSL
TOOLS: Visual Studio, DirectX11, RenderDoc, ImGui
Fluid simulation is a challenging problem in terms of physics simulation and realistic rendering. This project focuses on both the simulation and rendering to make the fluid interactive and look satisfying.
For this project, I choose Position Based Fluid as the simulation solver and Screen Space Rendering for real time rendering. And I develop this project on my C++ custom game engine using DirectX11 and DX compute shader for parallelization computing.
Current features
Position Based fluid
The solver for physics simulation, it's a lagrangian-based system utilizing a Jacobi-style update for compute all particles in parallel on the GPU.
Screen space rendering
Generate depth, thickness image of all particles and get the normal map in view space using depth image, and render the final image by using Blinn-Phong reflection model and Beer's law for refraction.
Spatial hashing neighbor searching
A neighbor searching method for inserting all particles into cells based on the SPH kernel radius, each particle can easily get its neighbors in 27 cells of its local area to compute its density and velocity change by viscosity.
Smoothed depth / Thickness image
Get smoothed depth/thickness image by using bilateral filter to keep the boundary, which makes the surface of water look less particle-like.
skycube reflection with fresnel
Sample the sky cube texture based on reflection ray and adjust reflection and refraction based on Fresnel scaler.
caustics(Basic photon-mapping)
Use image-space technique, find the intersections of refracted rays and ground, and render the points with additive blending.
future work
optimize blur filter
Now the complexity is O(n^2), it can be optimized to O(n) according to Nvidia.
vOXELIZE OBJ
Voxelize 3D model so that it can construct rigid particles that can couple with fluid particles.
Add foam particles
To make the fluid look more realistic, foam and spray particles are needed.
Optimize compute shader
Optimize physics solver and run more particles in real time.