Realtime PBR Rendered Fluid Simulator

Realtime PBR Rendered Fluid Simulator

Realtime PBR Rendered Fluid Simulator

During the summer of 2025, I made an optimized realtime fluid simulation and renderer in Unity using C# and HLSL. Here's a link to the Github Repository. I used Unity as a graphics programming environment; all of the shading is written in HLSL. The features of the project include


  • Particle-Based Fluid Simulation based on Smoothed Particle Hydrodynamics (SPH) run using Compute Shaders

  • Physically Based Raymarched Fluid Renderer written with HLSL, ~60+ fps on RX 5700 XT.

  • Physically Based Screenspace Fluid Renderer written with HLSL (faster than raymarched with about 120fps on RX 5700 XT, but not as accurate)

  • Particle-Based Foam Simulation for crashing waves run using Compute Shaders

  • Foam rendering using using volumetric raymarching or billboard sprites written with HLSL

  • Shadows Rendered using either shadow maps or raymarching

  • Caustics Rendered using backwards raytracing

  • Spatial Hashing and different GPU sorting algorithms to allow the simulation to run at high framerates


This project taught me a lot about GPU programming, PBR, and SPH Fluid Simulation. Sebastion Lague's Fluid Simulation and Fluid Rendering videos taught me a lot for this project.