# Overview

<figure><img src="https://2237393798-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FmyMovt6gEgotygp1N9oc%2Fuploads%2FUTBk5jJhPCMqdVdUZNTt%2Fimage.png?alt=media&#x26;token=78a87130-359e-424a-b004-9d112162d997" alt=""><figcaption></figcaption></figure>

{% embed url="<https://www.fab.com/listings/ea195c94-00af-43fb-bb1d-85a478320a27>" %}
Planetary Oceans of Fab
{% endembed %}

{% embed url="<https://discord.gg/SvHcuCcjMX>" %}
Our Discord
{% endembed %}

{% hint style="success" %}
The plugin is targeted at Unreal Engine versions 5.3, 5.4, 5.5, 5.6+.
{% endhint %}

The **Planetary Ocean Plugin** is designed to create highly customizable and scalable ocean systems for planetary environments. It leverages a combination of advanced techniques for wave simulation, mesh generation, buoyancy, and atmospheric effects, ensuring both visual fidelity and performance. Below is an overview of the core principles and architecture:

***

## Waves

The plugin uses **Gerstner waves** to simulate realistic ocean waves. These waves are calculated for three flat planes (X, Y, and Z) of a cube, which is then transformed into a sphere. The resulting wave data (World Position Offset (WPO) and normals) is bent around the sphere to create a seamless ocean surface. Waves are mirrored at negative X, Y, and Z axes, and everything is combined using a **triplanar mask** to ensure smooth transitions and avoid visible seams.

## Mesh

The ocean mesh is generated using **6 instances of a quadtree**, one for each face of the cube. The quadtree dynamically adjusts the level of detail (LOD) based on the camera's distance, ensuring optimal performance. Mesh geometry is computed on a **background thread** for efficiency, and the data is passed to a **custom mesh generator**, which is a heavily modified version of Epic's Procedural Mesh Component. This approach ensures that mesh generation is **extremely fast and reliable**, even for large-scale oceans.

## Buoyancy

Buoyancy is calculated by applying physics at specific locations. **Buoyancy points**, defined by the user around a vessel, sample the water height on the **CPU** using the same method as the vertex offset calculation on the GPU. While not an ideal solution, this approach is widely used (e.g., Unreal's Water plugin) and provides a balance between performance and accuracy.

## Scalability

The plugin is designed to handle massive scales. Ocean utilizes several techniques (mesh origin rebasing, camera relative world position and periodic world space), that prevent floating-point precision issues.

The plugin supports multiple oceans in the level, their movement at runtime.

## Other features

* **Runtime Movement**: The ocean can be moved dynamically during gameplay, allowing for flexible integration into various scenarios.
* **Multiple atmospheres**: The plugin includes a custom multiple atmosphere system that also includes space background.
* **Fog Effects**: Screen-space depth-based fog (both linear and exponential) is supported.
