This is a Ocean Simulation shader based on my own GPU Raytracer The shader is mostly consists of 5 parts: Ambient wave, ripple interaction, caustics, procedural sand and light system.
My work includes Gerstner wave function for ambient ocean wave, circle wave function for ripples, generating sand using perlin noise and light system.
Try it out here:
GitHub Download
Here is the demo video. ↓
3 months, 2024.2 - 2024.4
2
Graphics Programmer, Technical Artist
OpenGL, C++, GLSL, Visual Studio
For the surface of the ocean, I aimed for a "quiet" feeling so I chose Gerstner wave function for surface simulation.
I calculated the Partial Differentiations of the Function along x and z axis to get the “tangent” and “binormal” value of the point. After all waves are accumulated, a simple cross results in the correct normal.
Ripples are essentially waves originated from a single point.
By adding a series of Gertner waves in different directions upon mouse-clicking, I created an interactive ripple wave.
I also applied point offsets to the objects in the ocean and resulted in a nice buoyancy effect. With the matching moving speed and the wavelength, the Gerstner wave results in great details.
Sand is generated by simple perlin noise to mimic the random color of the ocean floor.
The lighting is based on my own GPU raytracer and it allows 4 times reflection and refraction in order to simulate realistic scene.