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
Copy file name to clipboardExpand all lines: _posts/2026-03-08-ocean-simulation.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,14 +97,14 @@ void CSMain(uint3 id : SV_DispatchThreadID)
97
97
98
98
The ocean surface is made up of thousands of waves, all travelling in different directions with different sizes and speeds. To simulate this, we model the ocean as a sum of sine waves, each with their own frequency, direction and amplitude. The question then becomes: how do we decide how big each of those waves should be?
99
99
100
-
This is where oceanographers come in. Over decades, researchers measured real ocean surfaces using buoys, photographs and radar to figure out exactly how wave energy is distributed across different frequencies in a fully developed ocean. A fully developed ocean simply means the ocean has had enough time and distance to reach an equilibrium with the wind blowing over it. The result of this research is a spectrum function, which tells us how much energy each wave frequency should have given a set of wind conditions.
100
+
This is where oceanographers come in. Over decades, researchers measured real ocean surfaces using buoys, photographs and radar measurements to figure out exactly how wave energy is distributed across different frequencies in a fully developed ocean. A fully developed ocean simply means the ocean has had enough time and distance to reach an equilibrium with the wind blowing over it. The result of this research is a spectrum function, which tells us how much energy each wave frequency should have given a set of wind conditions.
101
101
102
-
Now, evaluating thousands of sine waves individually for every point on the ocean every frame would be far too slow even for a modern GPU. This is where the FFT comes in. Instead of working in the spatial domain (the real world positions of the waves), we work in the frequency domain, where each point represents a wave frequency rather than a world position. The FFT then converts the entire frequency domain into real world displacements in one efficient pass.
102
+
Now, evaluating thousands of sine waves individually for every point on the ocean every frame would be far too slow even for a modern GPU. This is where the FFT comes in. Instead of working in the spatial domain (the real world positions of the waves), we work in the frequency domain, where each point represents a wave frequency rather than a world position. The FFT then converts the entire frequency domain into real world displacements in one efficient pass. // TODO explain this a bit better
103
103
104
104
In his paper, Jerry Tessendorf describes the Phillips Spectrum as the model for defining wave energy. After implementing it I found it too limiting since its only parameters were wind speed and direction. So I switched to the JONSWAP spectrum, a more widely adopted model that gives much more creative freedom.
105
105
With JONSWAP you can control things like how many waves follow the wind direction, the choppiness of the waves, the distance over which the wind affects the surface, and the sharpness of the spectrum peak. This lets you model anything from a calm open ocean to a stormy sea with large aggressive swells.
106
106
107
-
Now the question, how do we setup this JONSWAP spectrum? // show images of the spatial and frequency domain
107
+
Now the question, how do we setup this JONSWAP spectrum? // TODO show images of the spatial and frequency domain
0 commit comments