You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a demonstration of an effect for rendering fluids with implicit surfaces (similar to those found in the video game ‘Portal 2’), written in C++ and OpenGL.
Controls
Right click + mouse rotates the camera.
WASD moves the camera
1-3 to switch between different drawing modes (points, quads, spherical distance fields, final result)
F1-F4 to switch between different materials (water, glass, air bubbles, soap bubbles)
How does it work?
It works by first simulating particles on the CPU.
Then it renders a quad for each particle on the GPU.
And finally it traces a ray in the quad’s pixel shader against the implicit surface formed by the distance field formed by the set of particles. Each particle on its own defines a spherical distance field where the implicit surface is defined as being at distance X from the surface. This results in small spheres that can look like droplets.
By combining the distance fields of multiple particles, a more natural result can be achieved because the implicit surface now deforms according to the influences of multiple particles.
Requirements
GPU with support for OpenGL 3.3 or better
How to build
The project comes as a Visual Studio 2017 solution and already contains all dependencies. It should be built as x64.