> 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/simulated-shoreline.md). Agents can also search and read this documentation through its [MCP server](https://docs.shadersource.io/~gitbook/mcp).

# Simulated Shoreline

Turn on the shallow-water simulation - surf that runs up the beach, pours round rocks and reacts to what is in it.

The **Simulated** shore model runs a shallow-water simulation round the camera. Waves from the open sea are fed in at its edge; inside it they shoal, break into bores, run up the sand and drain back over the real ground - round the rocks, the jetty and anything else standing in the water.

![The simulated shore at Surf Cove](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FHJxr54hiWlTZj9p4NbVR%2Fsim_hero.webp?alt=media)

|                  |                                                                                                                                                                 |
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Time**         | About 10 minutes                                                                                                                                                |
| **You need**     | An ocean with a baked shoreline - do [Ocean and Shoreline](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/ocean-and-shoreline.md) first |
| **You will use** | **Simple > Shore**, **Simple > Perf**, **Advanced > Shoreline** and **Debug > Simulation**                                                                      |

{% hint style="info" %}
**See it running first.** Open `L_OceanTool2_SurfCove_SimulatedShoreline` from the plugin's `Examples/SurfCove/Maps` folder: a surf beach on the simulated shore, with weed and rubbish washing about by the jetty. Press Play, choose **Third Person** and walk into the surf.
{% endhint %}

## Part 1 - Turn it on

{% stepper %}
{% step %}

### Check the bake

Open **Simple > Shore > Volume**. The readout should say **Saved capture**, with no **Out of date** warning. If it warns, or you have sculpted near the water since the bake, press **Capture & Bake**.

The simulation runs on the baked ground, so a stale bake means water running over ground that is no longer there.
{% endstep %}

{% step %}

### Choose the Simulated model

Open the **Shoreline** tab and press **Simulated**.

The rows under the buttons change to the simulation's own, and a **Reset simulation** button appears.

![Shore > Shoreline with the Simulated model chosen](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2Fflq7sGFEiyMGM3S9wFza%2Fsim_panel.png?alt=media)
{% endstep %}

{% step %}

### Turn on Realtime in the viewport

The simulation runs in the editor's viewports as well as in play, but only in a viewport with **Realtime** on. Check the viewport's menu (**Ctrl + R** toggles it).

Now fly down to the beach. The simulation follows the camera, so there is nothing to place.
{% endstep %}

{% step %}

### Let it warm up

When the simulation first shows, it has already run ten seconds of waves, so the surf is there from the start. It warms up again whenever you press **Reset simulation** or the camera jumps a long way.

Give it a few wave periods after a big change to the sea state: the new sea builds up as its waves arrive.
{% endstep %}
{% endstepper %}

## Part 2 - Rocks, jetties and anything else in the water

The simulated water meets solid things in two ways. Use whichever fits the object.

|                | **Baked into the bed**                                                              | **Shaping the water live**                                                                                   |
| -------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ |
| How            | Add the actor to the Shoreline Volume's **Include actors**, then **Capture & Bake** | Nothing to do - it is on by default (**Objects shape the water**)                                            |
| Good for       | Cliffs, jetties, big rock formations: everything that is part of the coast          | Rocks, props and foliage standing in the water; anything that moves                                          |
| How it is read | Captured from above with the terrain                                                | From the object's collision - complex collision too, so a scanned rock with no simple collision still counts |
| Leave one out  | **Exclude actors** on the volume                                                    | **Exclude actors**, or tag the actor `Ocean2IgnoreWater`                                                     |

{% stepper %}
{% step %}

### Add the big things to the bake

On **Shore > Volume**, press the **+** beside **Include actors** and pick your cliff, jetty or rock formation. Repeat for each, then press **Capture & Bake**.
{% endstep %}

{% step %}

### Check what the water can see

Open the **Debug** tab's **Simulation** page and set **View on the water** to **Collision**.

A grid is laid over everything the water runs on. Ground and rocks held by the bake are grey; rocks and props read from their collision are orange. A rock that stands bare out of the grid is not in the simulation: add it to **Include actors** and bake again, or give its mesh collision.

![Debug > Simulation: the Collision view lays a grid over what the water runs on](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FnKB68fdTZ1hkwxLN3aTJ%2Fsim_collision.jpg?alt=media)

Set the view back to **Off** when you are done.
{% endstep %}
{% endstepper %}

## Part 3 - Shape the surf

These rows are on **Simple > Shore > Shoreline** while the Simulated model is chosen.

| Row                                                   | What it does                                                                                                                                                                                                             |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Distance waves**                                    | What the coast shows past the simulation's reach: the **Simple** model's waves (the default), the **Authored** model's, or none.                                                                                         |
| **Foam amount**, **Foam life**                        | How much foam the breaking waves and the edge of the run-up make, and how long the water carries it.                                                                                                                     |
| **Foam volume**                                       | Draws the breaking white water near the camera as 3D foam instead of flat sprites. **Foam look** picks how: **Joined** (lit blobs that merge), **Soft volumetric** or **Solid lit**. **Size** is the size of its pieces. |
| **Splash**                                            | How much spray the 3D foam throws - up the faces of what the water runs into, and off its breaking fronts.                                                                                                               |
| **Front angle**, **Front roughness**, **Lip breakup** | How a breaking front is drawn: how steep its face stands, how rough and tumbling it is, and how unevenly it lays down its band of white.                                                                                 |
| **Flow normals**                                      | Ripples and boils carried by fast-running water - the swash, the backwash, round rocks and piles. 0 leaves the water smooth.                                                                                             |
| **Turbidity**                                         | How much sand the wash stirs up round rocks and in the surf: a cloud on the bed that hides its detail. 0 is off and costs nothing.                                                                                       |
| **Limit shoreline wave height**                       | Holds the waves reaching the coast to a height, while the open sea keeps its own.                                                                                                                                        |
| **Reset on change**                                   | Restart and warm up the simulation whenever the sea or a shoreline setting changes. Off, the water runs on and the new sea builds up over a few wave periods.                                                            |

![Foam volume on and off](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2Fc7Oywp6eUPY7yqAYcLbc%2Fsim_foam_volume.jpg?alt=media)

## Part 4 - Reach and detail

The settings you will change most are on **Simple > Perf**, in the **Simulated Shore** category:

| Row                     | What it does                                                                                                                                                                                                                                                            | Default           |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| **Simulation detail**   | The cells along the simulated square's side. **From mesh quality** chooses for you (see below); or pick **Low** (256), **Medium** (512), **High** (1024), **Cinematic** (2048, for offline renders) or **Extreme** (4096). Each step up costs about four times as much. | From mesh quality |
| **Simulation distance** | How far round the camera the shore is simulated. Past it the **Distance waves** draw the shore. Shorter makes its cells finer; further reaches more coast with coarser cells. Its cost is set by **Simulation detail**, not by the distance.                            | 300 m             |
| **3D foam detail**      | How many and how fine the 3D foam's particles are.                                                                                                                                                                                                                      | From mesh quality |
| **3D foam distance**    | How far round the camera the 3D foam reaches. Shorter makes it finer, with more and smaller particles near the camera; further reaches more coast with coarser foam. Its cost is set by **3D foam detail**, not by the distance.                                        | 150 m             |

The rest are on **Advanced > Shoreline**, in the **Simulation** category:

| Setting             | What it does                                                                                                                                                                | Default           |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
| **Simulation area** | **Follow the camera**: a square round the camera that moves with it. **Shoreline Volume**: the volume's box, fixed - one stretch of coast simulated wherever the camera is. | Follow the camera |
| **Detail distance** | A second, finer simulation inside the first.                                                                                                                                | 50 m              |
| **Warm-up**         | Seconds of waves simulated before the simulation first shows. 0 starts from still water.                                                                                    | 10 s              |
| **Run in editor**   | Run it in editor viewports as well as in play.                                                                                                                              | On                |

{% hint style="info" %}
**Simulation detail** follows the ocean's mesh quality by default, and so the engine's scalability settings: Low runs 256 cells, Medium and High 512, Epic 1024; Cinematic runs 1024 in play and 2048 in an offline render. Leave it there unless you have a reason not to - your players' machines then get a simulation that fits them.
{% endhint %}

## Part 5 - Put things in it

The simulated water is the one model where the water reacts.

* **Floating objects ride it.** Barrels, logs and rubbish in the simulated area ride its bores and are carried up the sand and back with its wash. This is **Float on the simulated shore** on the **Buoyancy & Wakes** page, and it is on by default.
* **Boats push it.** A boat's bow and stern waves run up the beach (**Hulls push the water**, on by default).
* **Characters wade through it.** The playground's third person character presses the water as it wades and churns it white behind it.

![Rubbish and weed drifting on the simulated water by the jetty](https://2855220899-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mk51ACJUA5E3mZvLb9h%2Fuploads%2FWKR9wN89QVfFyRCdUVGw%2Fsim_floating.webp?alt=media)

[Buoyancy and Boats](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/buoyancy-and-boats.md) makes the floating objects; [Underwater, Caustics and Swimming](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/underwater-caustics-and-swimming.md) covers the character.

## Watching it work

The **Debug** tab's **Simulation** page is the simulation's control room. Nothing on it changes what ships.

* **Pause** / **Resume** and **Restart** (start again from still water).
* **Show area** draws the simulated square in the viewport.
* **View on the water** draws depth, speed, foam, cells, particles, collision, flow normals or turbidity on the surface itself.
* **Debug pictures** shows the simulation's own maps. Click one to open it in a window: the wheel zooms, dragging pans, a double-click fits it.

The status line at the top says what is running: the area, the cell sizes, and how far out the ocean drives it.

## What it costs

The simulation is the most expensive shore model, and it costs nothing at all unless it is selected. To make it cheaper:

* Lower **Simulation detail**, or let it follow a lower mesh quality.
* Lower **3D foam detail**, or turn **Foam volume** off on **Shore > Shoreline**.

These rows are on **Simple > Perf**, under **Simulated Shore**. **Simulation distance** and **3D foam distance** are not among them: the cells, rings and particles are set by the detail rows, so a shorter distance only makes them finer.

[Performance and Scalability](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/performance-and-scalability.md) goes through the rest.

## Something not right?

| What you see                                        | What to check                                                                                                                                                                            |
| --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| The water is still in the editor                    | **Realtime** is on in the viewport, and **Run in editor** is on (**Advanced > Shoreline > Simulation**). The **Debug > Simulation** page has not been left on **Pause**.                 |
| Water runs through a rock                           | The **Collision** view (Part 2): add the rock to **Include actors** and bake again, or give its mesh collision.                                                                          |
| Something in the water should not shape it          | Add it to the volume's **Exclude actors**, or tag the actor `Ocean2IgnoreWater`.                                                                                                         |
| The surf looks wrong after the terrain changed      | **Capture & Bake** again, then **Reset simulation**.                                                                                                                                     |
| The first frame of a rendered shot shows flat water | The simulation has not warmed up: see [Sequencer and Movie Render Queue](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/sequencer-and-movie-render-queue.md).    |
| The simulated water is not drawn at all             | The editor is on Shader Model 5 - the full ocean needs Shader Model 6. See [Troubleshooting](https://docs.shadersource.io/assets-and-plugins/ocean-tool-2/tutorials/troubleshooting.md). |
