A downloadable tool

Test: Gerstner waves

Approach: This project was all about testing Unity’s ability to handle ocean waves and buoyancy. I drew inspiration from Gerstner waves to create a system that could simulate waves in real-time and directly affect how objects like boats would move on the surface.

You can read more about Gerstner waves here: https://en.wikipedia.org/wiki/Trochoidal_wave


Wave and Buoyancy Implementation: The wave effect was built using the visual shader graph that mimics rolling water with sine and cosine waves—essentially a simplified version of Gerstner waves. For buoyancy, I had to sync the shader’s vertex data (handled on the GPU) with Unity’s physics engine (which runs on the CPU). This setup was heavily inspired by the trochoidal wave model, where water particles follow circular paths.

Jittery boat movement: I decided to focus more on the wave system rather that how the physics system and the shader graph interact with each other. The end result is the glitchy movement on the boat as its moving around. 


Technical Challenges and Solutions:

  • Shader Implementation: Creating the shader for rolling waves was the easy part. The challenge came when trying to connect that with Unity’s physics system. The GPU and CPU don’t naturally sync, so I had to dive into some external resources to figure out how to make it work.
  • Physics and Real-Time Interaction: Unity’s physics engine wasn’t built for this kind of interaction. I ended up simplifying the calculations to make it functional without causing major performance hits.
  • Refraction Rendering: Adding realistic water refraction was tricky. I borrowed some ideas and code from other projects to get it looking decent.

Reflection on Technology: The trochoidal wave model was a great reference for understanding wave dynamics. Here’s how Unity stacks up compared to other engines:

  • Unity: It’s flexible, but that flexibility comes at the cost of having to build everything yourself. For something like buoyancy and wave simulation, it’s more work than it’s worth.
  • Unreal Engine: Unreal has these systems ready to go. You can jump straight into designing and refining as the functionality is built into the engine.

Lessons Learned: This project taught me a lot about shaders, physics, and how to work around engine limitations. But it also reminded me that the tools you choose matter. If I were to do this again, I’d pick Unreal or Godot.

This guide was extremely helpful in helping me when I got lost: https://ameye.dev/notes/stylized-water-shader/

Published 2 days ago
StatusReleased
CategoryTool
Authordkarlberg

Download

Download
Gesrtner Waves.zip 37 MB

Leave a comment

Log in with itch.io to leave a comment.