A downloadable game for Windows

Overview:

A custom ocean shader and Buoyancy system made in Unreal 5. Using Gerstner waves and iterative solutions for ease of use and reduced complexity, allowing for the creation of Oceans in minutes. 

The Shader:

The Shader is made with a combination of Material editor and custom HLSL nodes with over 40 parameters to control and fine tune to build a huge variety of oceans and open bodies of water. There are parameters to control: Waves, Colour (through Single Layer Water), Water Normals, Opacity, Roughness, Specular, Refraction, Wave Foam, distance fields Caustics as well as a switch to run the shader in Real time or control through BP (Used for Buoyancy).  

Showcasing some of the material parameter

Showcasing the main material graph
Generating Waves:

Waves are generated through an iterative method using a custom HLSL node to reduce complexity with ever growing parameter lists and set up each time you would like to add a new wave and for ease of user use. 

This done is with a custom HLSL node which takes in 1 wave as its starting parameters and the number of waves the user would like in their ocean, and iteratively through a for loop runs completes the Gerstner wave equation and applies Fractional Brownian Motion and domain warping to create smaller and faster waves each iteration all with realistic wave movement. All the waves are summed up into one Vector 3 output that can used in the "World Offset Position" to displace the vertices of mesh to create waves. 

In this HLSL node the Jacobian of the sum is also calculated to return the position where the waves are most distorted, which is then used to apply wave foam and the secondary colour variation in the waves.

Showcasing Wave Generator Material Function

Buoyancy:

Buoyancy is achieved by recreating the wave generator in a Wave Manager BP and gathering the same parameter setting from the material to achieve the same waves produced from the material onto the CPU to be used for Physics. A custom made buoyancy component is then used to sample the wave height at a given point and then apply the relevant buoyant force to a pontoon float on the owning actor. By making a custom component for the buoyancy any object can quickly be made to float in correspondence to the shader by a developer saving dev time and preventing repeatable code.

Buoyancy Component

Buoyancy Implementation on Rowboat 

The Buoyancy is not yet perfect and there are many challenges associated with creating buoyancy that reads from a shader due to GPU to CPU communication being difficult to achieve in a performative and fast enough method. I am still actively working on improving the buoyancy system and learning and attempting new methods of implementation.

Published 27 days ago
StatusReleased
PlatformsWindows
AuthorOwen Monaghan
Tags3D, No AI, Sailing, Shaders, Unreal Engine

Download

Download
OceanProjectBuild.zip 720 MB

Install instructions

Extract the zip file and run the application