May 24, 2015

How to create water wakes in Unity?

The question is: How do you create water wakes in Unity? If you have ever seen a boat on a lake, you notice that it will leave small waves behind it while it is floating forward. But how do you create those waves, and how do you combine them with a moving sea in a computer environment like Unity? I've earlier made a boat that will float in Unity with realistic buoyancy, and now I felt I wanted to learn how to add water wakes. No boat is complete without them.
The answer to the question is using an algorithm called iWave. There are other alternatives, but I believe iWave is the most popular algorithm. It was first published in 2008 in a report called Simulation of Interactive Surface Waves. The report was written by Jerry Tessendorf, who is an expert in the field. If you've ever seen a computer animated sea in a movie, like the sea in Titanic, the algorithm behind the realistic moving sea was written by Jerry Tessendorf.
The algorithm itself is not that easy to understand, but the simplified version is actually very easy to implement - and it is super fast. The only expert tip I have is to change the parameter alpha if you encounter gigantic waves. The algorithm itself is not that stable, so alpha is like a damping parameter. 
My final results look like this:



You can interact with the surface with your mouse, and the small cube will float with my old buoyancy algorithm. The difference now is that the cube will leave ripples whenever it is bouncing up and down. 
Looks interesting? Don't worry, because I will soon write a tutorial on how to do it in Unity. It will be published here: Tutorial on how to make a boat in Unity.  

No comments:

Post a Comment