Exploring a Trochoidal Wave Shader @WorldOfZeroDevelopment
Exploring a Trochoidal Wave Shader  @WorldOfZeroDevelopment
Uploaded March 2020 | Updated November 2026, 2 hours ago
Let's try to craft some trochoidal waves - a type of fluid simulation that is both fairly simple and also looks pretty good for creating basic waves in an ocean or other fluid. Trochoidal waves are simulated by moving vertices in a circular motion that causes vertices to condense and expand from one another. This can create the swells and dips that you'd expect from an ocean.

We'll be implementing this using a vertex shader that can manipulate the position of a meshes vertices based on distance.

The vertex shader that creates this effect for us looks like this (this effect is based on changes along the x axis in world space only, some modifications are required if we want this to work along different axis):

```shader
void vert (inout appdata_full v) {
float3 worldSpace = mul(unity_ObjectToWorld, v.vertex);
float3 rotatedOffset = float3(0,0,0);
rotatedOffset.x = sin(_Time.x * _DeltaSpeed + worldSpace.x * _Offset) * _Radius;
rotatedOffset.y = cos(_Time.x * _DeltaSpeed + worldSpace.x * _Offset) * _Radius;
v.vertex.xyz += mul(unity_WorldToObject, rotatedOffset);
}
```


Freya's tweet on Trochoidal Wave's with examples: twitter.com/FreyaHolmer/status/1236079824575369219
Her twitch stream: twitch.tv/acegikmo

Some more background on Trochoidal Wave's: bubblepins.com/blog/trochoidal-the-shape-of-ocean-waves

More information on writing Surface Shaders in Unity can be found in the Unity manual: docs.unity3d.com/Manual/SL-SurfaceShaders.html

Join the World of Zero Discord Server: discord.gg/hU5Kq2u
Exploring a Trochoidal Wave ShaderCreating Custom GitHub Issue TemplatesLive Code Reloading with `dotnet watch` - Quick TipImplementing C# Extension MethodsSupporting Grid Rendering - LINQ for Unity - Part 3Lets Make a Lazy String Parser in C#I Learn Blazor - C# in Your Web BrowserTurning OpenSCAD Files into STL Meshes with GitHub ActionsLive Coding a Basic 6 Degree of Freedom Flight ControllerExploring Unity DebuggingExploring Gui.cs - Custom Terminal UIs in .NETRendering 3D Objects in your UI Using Multiple Cameras
World of Zero |

Exploring a Trochoidal Wave Shader

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER