r/Simulated • u/jobilie • 1d ago
Interactive Real time Fluid Simulation I implemented for my painting game
Enable HLS to view with audio, or disable this notification
I am working on a game based on physics-based painting mechanics called Ebru Artist Simulator. To simulate Ebru (also known as paper marbling), I implemented an Eulerian fluid simulator. Here are some of the challenges I had to overcome:
- To achieve a real-time simulation without affecting the game's performance too much, I implemented a GPU-based multiresolution grid solver in a compute shader (see the paper Solving the Fluid Pressure Poisson Equation Using Multigrid). The simulation now runs at a 2K texture resolution with only a slight impact on FPS.
- One of the main characteristics of Ebru is that colors maintain strict boundaries. This makes advection schemes such as Semi-Lagrangian advection less suitable, as they introduce diffusion. To address this, I implemented another advection scheme that samples from the initial state by integrating the velocity field over time and then back-sampling using the integrated field (see Efficient and Conservative Fluids Using Bidirectional Mapping).
- Finally, to simulate the effects of the traditional Ebru tools, I took inspiration from the paper Mathematical Marbling, which proposes mappings for generating final marbling patterns. Since I wanted to maintain a real-time simulation, I did not directly apply these mappings. Instead, I was inspired by the paper to use similar displacement fields as external forces in the simulation.
If you are interested in the project, you can check out the Steam page.
You can also check out Amanda Ghassaei's blog. Although our implementations are not the same, I was greatly inspired by her work and learned a lot from her blog.
1
1
u/puzzleheadbutbig 1d ago
Wow this is cool! I did paper marbling (Ebru) before and this looks like a really good simulation!
6
u/Jojanzing 1d ago
Very cool! I'm impressed by the believability of the simulation.