> For the complete documentation index, see [llms.txt](https://docs.shadersource.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/ocean-and-shoreline.md). Agents can also search and read this documentation through its [MCP server](https://docs.shadersource.io/~gitbook/mcp).

# Ocean and Shoreline

Add an ocean to your level, choose its look and sea state, and bake waves that break on your coast. About ten minutes.

In this tutorial you add an ocean to a level, choose how it looks, and make its waves break on your coast. It is the standard setup, and every other tutorial starts from it.

![What you will have at the end: waves breaking along a baked shoreline](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FGSosiVd63eTsRKZfx6ea%2Ft1_hero.webp?alt=media)

|                  |                                                                                                                                                                              |
| ---------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Time**         | About 10 minutes                                                                                                                                                             |
| **You need**     | A level with some land that dips below sea level (a landscape or meshes), a **Sky Atmosphere**, a **Sky Light** and a **Directional Light** with **Atmosphere Sun Light** on |
| **You will use** | The editor mode's **Simple** tab: the **Sea** and **Shore** pages                                                                                                            |

{% hint style="info" %}
No level of your own to hand? Open `L_OceanTool2_Island` from the plugin's `Examples/Island/Maps` folder and follow along: its ocean is already set up the way this tutorial ends, so you can compare each step. See [Example Maps and the Playground](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/how-to-use/example-maps-and-the-playground.md).
{% endhint %}

## Part 1 - The ocean

{% stepper %}
{% step %}

### Open the Ocean Tool 2 mode

In the mode selector at the top of the level editor, choose **SHADERSOURCE: Ocean Tool 2**. The same entry is in the **SHADERSOURCE** button on the toolbar and under **Window > SHADERSOURCE**.

The mode's panel opens. With no ocean in the level yet, its **Sea** page says so and offers the presets.

![The panel before there is an ocean: the Sea page offers the presets](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FYXUt8H2HqbJhB0PNHsS7%2Ft1_no_ocean.png?alt=media)

{% hint style="info" %}
It is an ordinary editor mode: you can still select, move and place actors in the viewport while it is open.
{% endhint %}
{% endstep %}

{% step %}

### Create the ocean

Open the ocean picker under the banner (it reads **Select Ocean** until there is one) and choose **Create New > Ocean**. You get a default sea: the **Open Sea** style at Beaufort 4.5, a moderate breeze.

To start from a ready-made sea instead, choose **Create New > Ocean from Preset**, or click a preset on the Sea page.

The ocean is placed in front of the camera at height 0 and selected. It is infinite, so where it stands does not matter - only its height does.

![Before and after: the terrain alone, and with a new ocean](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2F50rm8ty4qpgYwG4oSHlz%2Ft1_before_after.jpg?alt=media)
{% endstep %}

{% step %}

### Set the sea level

On the **Sea** page, type the height of your waterline into **Sea level**, or drag the value. The ocean takes the new level when you let go.

![The Sea page: the ocean style and sea state on top, then the sea level](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2F1MrgIwkZaWbtRrQZ3BKO%2Ft1_sea_page.png?alt=media)
{% endstep %}

{% step %}

### Choose an ocean style

**Ocean Style** stays at the top of every Simple page. Choose it first: it decides what the sea looks like, what draws it, and what the other controls mean.

There are ten. **Open Sea**, **Standard**, **Swell** and **Classic** are realistic seas; **Stylized (FFT)**, **Stylized 2 (FFT)**, **Stylized (Gerstner)** and **Low Poly** are stylized; **Procedural** and **Native** are Gerstner seas. [Ocean Styles](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/how-to-use/ocean-styles.md) shows them all.
{% endstep %}

{% step %}

### Choose a sea state

Drag the **Beaufort** slider under **Sea State**. 0 is a flat calm, 4 a moderate breeze, 7 a near gale, 12 a hurricane. The line under the slider names the force and gives its wind speed.

One slider drives the waves, the foam and the fine detail together, so the sea always looks like its wind.

![The same sea at Beaufort 2, 5, 8 and 11](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FhGTgmtj2yaucM2eAoQt1%2Ft1_beaufort.jpg?alt=media)
{% endstep %}
{% endstepper %}

{% hint style="warning" %}
**Is the sea a plain blue with no foam?** The editor is running on Shader Model 5. Set **Project Settings > Platforms > Windows > Default RHI** to **DirectX 12** and **D3D12 Targeted Shader Formats** to **SM6**, then restart the editor.

**Can't see the far sea for fog?** Turn on **Sea haze** on the Sea page. It thins the level's height fog to a light haze, and gives the fog its own values back when you turn it off.
{% endhint %}

## Part 2 - The shoreline

So far the sea runs up to the land as open water. To make it shoal, break and wash up the sand, Ocean Tool 2 needs to know the shape of the ground under the water. You give it that by baking the coast inside a **Shoreline Volume**.

{% stepper %}
{% step %}

### Add a shoreline volume

Open the **Shore** page. It has three tabs: stay on **Volume** and press **Add volume**.

A box is placed round your landscapes, already sized to them. Its outline is drawn on the water in the viewport for as long as the mode is open, and the page now shows the volume's own settings with a note: **Not baked from this volume yet**.

![Shore > Volume: the four actions, and the volume's own settings below them](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2F3gKFuo7ZRjYx09sE4Fyh%2Ft1_volume_panel.png?alt=media)
{% endstep %}

{% step %}

### Fit it to the coast

**Fit to landscape** sizes the box to your terrain again at any time - after you have added land, say. Adjust the box if you need to:

* Type a **Width** and **Length**, or move, scale and turn the box in the viewport with the usual transform tools.
* Let it reach a little past the coast. Its outer edge is where the shoreline hands the water back to the open sea.
* For one beach on a large map, shrink the box to that beach. The same number of samples then covers less ground, so the shoreline is finer.

![The volume's outline from above, fitted round the island](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FcFQ70F7NAxl2mo2l382T%2Ft1_volume_top.jpg?alt=media)

{% hint style="info" %}
**Capture size** sets how many samples the bake takes along each side; a new volume starts at 1024. The presets are **Draft 512**, **Standard 2048** and **Fine 4096**. The readout under them tells you how many metres each sample covers: the smaller that number, the finer the shoreline. A big box needs a bigger capture size for the same detail.
{% endhint %}
{% endstep %}

{% step %}

### Capture & Bake

Press **Capture & Bake**. A bar under the readout shows how far the bake has come - it takes a few seconds. **Cancel** stops it and keeps the shoreline you had.

![While it bakes: the progress bar, and Cancel](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2For3q2L5KuhgfvyqBnak6%2Ft1_baking.png?alt=media)

When it finishes, the readout reads **Saved capture** and the coastline is drawn in the viewport. The bake is saved as an asset in your project - an **Ocean 2 Shoreline Capture** - in `/Game/OceanTool2/Bakes`.

![The baked coastline drawn over the water](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2Fn1EJ9j9brA5scyPuSEwc%2Ft1_baked_top.jpg?alt=media)
{% endstep %}

{% step %}

### Choose a shore model

Open the **Shoreline** tab. A row of buttons picks how the waves behave where they meet the land:

| Model         | What you get                                                                                              |
| ------------- | --------------------------------------------------------------------------------------------------------- |
| **None**      | No shoreline waves. The open sea runs up to the land.                                                     |
| **Authored**  | A hand-shaped breaking wave that curls over as it breaks. The default, and the classic surf look.         |
| **Simple**    | Surf that spills into foam as the water gets shallow, with no curl. Lighter.                              |
| **Simulated** | A live shallow-water simulation round the camera: the water really runs up the beach and round the rocks. |

![The same beach on Authored, Simple and Simulated](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FvVUxiBXnDWoumNcKI0at%2Ft1_models.jpg?alt=media)

Not sure which to use? [Baked or Simulated Shoreline?](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/baked-or-simulated-shoreline.md) compares them.
{% endstep %}

{% step %}

### Tune the waves

The rows under the buttons belong to the model you picked. On **Authored**, the ones you will reach for first are:

| Row                             | What it does                                                                                                      |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
| **Distance between waves**      | How far apart the breaking waves come in.                                                                         |
| **Breaking distance**           | How far out from the waterline they break. 0 leaves it to the depth of the water.                                 |
| **Curling waves**               | Whether the wave curls over as it breaks, with its **Curl amount**, **Curl width** and **Curl height**.           |
| **Limit shoreline wave height** | Holds the shore's waves to a height of your choosing in a storm, so a heavy sea offshore does not bury the beach. |
| **Foam trail length**           | How long a trail of foam each broken wave leaves behind it.                                                       |

Hover over any row's name to read what it does.
{% endstep %}

{% step %}

### Check the wet sand

**Persistent wash wetness**, under **Beach Wetness** at the bottom of the same tab, is on already: the wash darkens the sand it runs over, and the sand dries again over the **Drying half-life**.

It is a projected decal, so it works on any ground that receives DBuffer decals (**DBuffer Decals** in **Project Settings > Rendering**, on in a new project) - there is nothing to add to your landscape material.
{% endstep %}

{% step %}

### Save

Save the level. To keep the whole sea as a preset you can apply to any other ocean, open the **Advanced** tab and press **Save as preset**: it then appears under **Your Presets** in the Sea page's **Preset** dropdown.
{% endstep %}
{% endstepper %}

## When the coast changes

The bake is a snapshot of your terrain. When the Shore page sees that something it baked has changed - the volume, the sea level, the landscape, or a rock or mesh the bake took in - it shows an **Out of date** warning. Press **Capture & Bake** again.

It reads every landscape height under the volume, so even a small, local sculpt raises the warning, and it sees a rock or mesh moved, turned, scaled or swapped for another. A mesh re-imported with a new shape keeps its name and place: press **Capture & Bake** yourself after that.

If you are still shaping the coast, tick **Re-bake automatically** on the Volume tab: the shoreline then re-bakes by itself a moment after you stop moving things - for the same changes the warning sees.

{% hint style="info" %}
**Renamed or copied the level?** The bake stays up to date: the check knows the coast's actors by their names in the level, not by the level's path. Only a bake made with a pre-release build of the plugin reads **Out of date** there; press **Capture & Bake** once and it keeps its stamp from then on.
{% endhint %}

## Rocks, cliffs and jetties

A new volume bakes the landscapes inside it. Anything else that should shape the shoreline - cliff meshes, large rocks, a jetty - goes in the volume's **Include actors** list; bake again after adding to it. Actors in **Exclude actors** are left out.

## If the shoreline is in the wrong place

The bake decides by itself where the shoreline runs, and now and then it needs a hand - a shelf that stays shallow a long way out, say, where waves break far from the beach.

* On the **Paint** page, tick **Ocean painting** - the brush's rows are greyed until you do. Set the brush's **Layer** to **Shoreline** and press **Trim Shoreline**: it keeps the shoreline within the **Shoreline trim distance** of the waterline and takes it off the water beyond.
* Or paint it yourself: press **Paint**, then drag to add shoreline, and hold **Shift** and drag to take it off.

[Painting the Ocean](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/painting-the-ocean.md) covers the brush.

## Something not right?

| What you see                                                    | What to check                                                                                       |
| --------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
| No waves break at the shore                                     | The **Shoreline** tab's model is not **None**, and the Volume tab's readout says **Saved capture**. |
| The waves break in the wrong place after you edited the terrain | Press **Capture & Bake** again.                                                                     |
| A rock or a jetty is ignored                                    | Add it to the volume's **Include actors** and bake again.                                           |
| Waves break a long way out to sea                               | **Trim Shoreline** on the Paint page, with **Ocean painting** ticked (above).                       |
| The sea looks plain, with no foam                               | The editor is on Shader Model 5: see the warning box in Part 1.                                     |

More in [Troubleshooting](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/troubleshooting.md).

## Where next

* [Baked or Simulated Shoreline?](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/baked-or-simulated-shoreline.md) - choose a shore model.
* [Ocean Styles, Colour and Foam](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/ocean-styles-colour-and-foam.md) - change how the water looks.
* [Buoyancy and Boats](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/buoyancy-and-boats.md) - put things on it.
