Stylized Water 3
4.4.Waves
Waves can play an important part in water for a scene, both for its visual characteristic and spatial presence.
This asset features wave animations in the form of layered “trochoidal” waves, also known as “Gerstner waves”. Because the amount of variations are virtually endless, a profile-based design makes it possible to easily pick from different pre-made wave animations.
Wave Profiles
You’ll notice a Wave Profile is assigned to any material that uses waves:
In the Stylized Water 3/Profiles folder you’ll find a selection of pre-made profiles, ready to assign to a material
These profile are all finetuned to approximate certain types of waves, as their names imply.
On each material that uses them you can still scale the Height, Wave length and Steepness being applied.
Concept
It’s important to understand that an individual wave layer is defined by three primary parameters:
- Length: the horizontal distance (in meters) between each peak/crest
- Amplitude: the vertical length between its bottom and top
- Steepness: the amount of horizontal movement
These parameters are then used as inputs for the wave algorithm in the shader.
When several layers, each with different parameter values, are added on top of each other a “wave scape” is created.
Editor
A wave profile defines the characteristic of the wave animation pattern. Games, such as Fortnite, often use a set of pre-defined parameters finetuned by artists. This editor provides such control.
Variation, between each layer, is key. Therefore a Procedural Editor utility is available. This sets parameters to a random value within the specified range.
The included pre-made profiles are also created using this utility. Settings will be saved to the profile, so you are free to experiment with it and come back to it at a later time.
Scripting
Wave profiles can also be created or modified through code. You may want to do this to dynamically adjust the Amplitude multiplier, for instance based on weather conditions. Wave Profiles are Scriptable Objects
so creating them is nothing unique.
A profile contains an array of Wave
objects, each of which defines the parameters of an individual wave. Combined they make up “layers”.
In order for changes made to the profile, or its layers, to sync to materials that use it the UpdateShaderParameters()
function must be called. This creates a lookup table from all the layers, which is readable on the GPU.