Shoreline surf
Near land, the ocean changes from open-sea waves to surf. In a band in front of the coast, the long ocean waves are replaced by waves that roll in toward the shore, grow and steepen as the water gets shallower, break into whitewater (bigger waves break in deeper water), and run up and slide back down the beach. The water level in the surf zone also rises slightly toward the beach, as it does on real coasts. Floating objects and Get Water Surface At Location follow the surf and the run-up too.
The ocean builds all of this from your level when play starts. You do not paint anything: landscapes are found automatically, and mesh land goes into a Shoreline Obstacle.
What you need
Section titled “What you need”-
Place
BP_DynamicRealWaterat 0, 0, 0. See Setting up the ocean. -
Keep Compute Depthmap on (ocean, DRW Grid Settings) and Enabled on (ocean, DRW Shoreline). Both are on by default.
-
Build the coast with a landscape, or put mesh land into a Shoreline Obstacle. Landscapes are found automatically, including World Partition landscape proxies.
-
Make sure the coast lies inside the bake area around the ocean.
-
Press Play. The surf exists only while playing (Play In Editor, Simulate, standalone or packaged). The editor viewport never shows it, because it is built when play starts.
The bake area and depth detail
Section titled “The bake area and depth detail”The ocean maps the seabed and the land in a square centered on the ocean actor. Its size is set by Grid Resolution (ocean, DRW Grid Settings), in 64 m cells:
| Grid Resolution | Bake area | Coasts must lie within |
|---|---|---|
| 128 x 128 | 8.2 km square | about 4.1 km of the origin in X and Y |
| 256 x 256 (default) | 16.4 km square | about 8.2 km of the origin in X and Y |
| 512 x 512 | 32.8 km square | about 16.4 km of the origin in X and Y |
Land outside the bake area gets no surf, and the ocean mesh is not removed under it (the land simply covers the water). Get Depth World Coverage on the ocean returns the side length of the bake area in cm.
Depth Quality (Advanced) sets how finely the depth map samples the seabed and the coastline:
| Depth Quality | One depth sample every |
|---|---|
| Low (1 px per cell) | 64 m |
| Medium (2 px per cell) | 32 m |
| High (4 px per cell), default | 16 m |
| Ultra (8 px per cell) | 8 m |
Land smaller than about one depth sample (16 m at High) may produce little or no surf. Higher Depth Quality and Grid Resolution make the bake when play starts take longer and the depth map use more memory; see Performance and quality settings.
The other depth map settings, all Advanced under DRW Grid Settings:
| Setting | Default | What it does |
|---|---|---|
| GPU Depth Capture | On | On: the seabed and land come from landscapes, Shoreline Obstacles and World Partition HLOD stand-ins only, and river channels that flow into the sea are not taken for sea. Off: every mesh with Visibility collision below sea level also counts as seabed (a sunken wreck, for example), and unloaded World Partition cells shown as HLOD are not seen. Dedicated servers always work as if it were off. |
| Client Depth Map Delay | 0.2 s | Wait before the bake starts (0 to 10 s), so landscape streaming can finish first. Useful after Open Level. Not used on dedicated servers. |
| Grid Removal Threshold | 0.99 | Share of a 64 m cell that land must cover before the ocean mesh is removed there. The default removes only cells the land covers completely. |
| Blur Radius | 2 | Smoothing of the depth map used for the water color and the shallow-water wave fade. It does not move the coastline the surf uses, so small land keeps its surf. |
When the bake runs
Section titled “When the bake runs”- When play starts. After Client Depth Map Delay, the ocean removes its mesh from cells fully covered by land, builds the depth map, then builds the surf. On long coastlines the surf can take a few seconds to appear. The ocean fires On DRW Ready once the depth map is ready.
- When land streams in or out. When a level or World Partition cell containing a landscape, a Shoreline Obstacle or an HLOD stand-in inside the bake area streams in or out, the ocean rebakes once streaming has been quiet for one second. It also re-checks which ocean cells that land covers.
- When a Shoreline Obstacle appears or disappears. Spawning, streaming in, streaming out or destroying an obstacle rebakes automatically.
- When you ask. Call Rebake Shoreline on an obstacle after moving it, or Request Shoreline Rebake on the ocean, for example after changing a landscape at runtime.
- When a river mouth into the sea changes, for example a river edited or moved at runtime.
- When you change Shoreline settings. Shore Band Width, Min Depth, Narrow Channel Fade, Channel Fade Width, Small Coast Radius, Gain Cap, Max Runup Distance and Atlas Resolution rebuild the surf automatically. The other Shoreline settings apply immediately.
- When the sea state changes. The surf follows the length of the main ocean waves (the wind sea, or the swell when it is longer). When that length changes, the surf is rebuilt and, in game, the new surf fades in over the old one over the ocean’s Wave Change Blend Time once the change is large or has settled.
A rebake takes a few frames. A request that arrives while a bake is running waits for it to finish. If a rebake changes which cells are coastal, the surf pauses until the new coast is ready.
Shoreline Obstacles
Section titled “Shoreline Obstacles”A Shoreline Obstacle (DRW_ShorelineObstacle) is an actor whose meshes all count as land: for the surf, for the depth map, and for the shallow-water wave fade that floating objects feel. Use it for islands, breakwaters and harbor walls built from static meshes. Large obstacles give accurate surf; small rocks and pillars produce little or none, because land smaller than about one depth sample (16 m at High Depth Quality) is too small to form a coastline.
-
Create a Blueprint class with DRW_ShorelineObstacle as its parent.
-
Add your land meshes as Static Mesh components. Every mesh in the actor counts as land.
-
Give the meshes collision that blocks the Visibility channel. The ocean finds the land through it.
-
Place the obstacle in the level. If it is there when play starts, it is part of the normal bake.
Remove Ocean Below (default on, under DRW Shoreline) removes the ocean mesh from 64 m cells the obstacle covers completely, the same rule as for landscapes. It applies to obstacles present when the ocean bakes and to obstacles that stream in with a level. It is not re-checked for obstacles spawned or moved during play: those still count as land for the surf, but the ocean mesh under them stays.
Rebake rules:
- Spawned, streamed-in, streamed-out and destroyed obstacles rebake automatically.
- After moving an obstacle, call Rebake Shoreline on it. On the server, the rebake is replicated to all clients, and the obstacle’s movement replicates with it.
- The rebake takes a few frames, so an obstacle that moves continuously is not supported.
Shoreline settings
Section titled “Shoreline settings”All on the ocean under DRW Shoreline, in the sub-groups below. They replicate from the server. In these settings, “swell” means the long waves carried in from offshore, whatever made them: the wind sea’s main waves, or the ocean’s Swell when that is longer.
| Setting | Default | Range | What it does |
|---|---|---|---|
| Enabled | On | Turns the surf on or off. Off also removes all surf cost. | |
| Min Depth | 50 cm | 1 to 500 cm | Water shallower than this carries no surf. It is also where the surf treats the land as starting, and run-up is measured from where the water is this deep. |
| Shore Band Width | 12000 cm | 1000 to 50000 cm | Width of the band in front of the coast where the swell is carried in as surf. |
| Narrow Channel Fade | 1 | 0 to 1 | Fades the surf along lines where waves from different shores meet, such as the middle of narrow channels and the lee of headlands. 0 keeps full surf there. |
| Channel Fade Width | 20000 cm | 500 to 20000 cm | Distance from such a meeting line over which the surf fades back to the open ocean. Near its lower end it is rounded to the depth map’s detail. Editable while Narrow Channel Fade is above 0. |
| Small Coast Radius | 20000 cm | 0 to 50000 cm | Coasts that curve tighter than this radius, such as small rocks and narrow points, get proportionally weaker surf that fades toward the open ocean, since waves bend around small obstacles instead of breaking on them. 0 keeps full surf everywhere. |
| Atlas Resolution | 2048 | 512 to 4096 | How many coastal 64 m cells can carry surf (see below). It does not change the surf’s detail. |
A coastal cell is a 64 m cell that lies in the shore band or next to it. Atlas Resolution holds this many:
| Atlas Resolution | Coastal cells it holds |
|---|---|
| 512 | 196 |
| 1024 | 784 |
| 2048 (default) | 3,136 |
| 4096 | 12,769 |
If your coast needs more cells than that, the cells beyond the limit get no surf. Long coastlines, many islands and a wide Shore Band Width use more cells. Higher Atlas Resolution costs more GPU time every frame and more video memory.
| Setting | Default | Range | What it does |
|---|---|---|---|
| Amplitude Scale | 2 | 0 to 8 | Overall height multiplier of the swell carried in from offshore. |
| Gain Cap | 3 | 1 to 6 | Limit on how much the waves may grow between the band edge and the beach. |
| Swell Cutoff Fraction | 0.1 | 0.1 to 2 | Which ocean waves the surf replaces inside the band, as a fraction of the main wave length: longer waves become surf, shorter ones stay as ordinary ripples on top of it. |
| Swell Components | 16 | 1 to 32 | Number of wave components the surf is built from. More gives a less regular surf at a higher GPU cost. |
| Crest Length Fraction | 3 | 0.5 to 20 | Length of the stronger and weaker stretches along each crest, as a fraction of the main wave length. |
| Crest Variation | 0.6 | 0 to 1 | How much crest height varies along the shore. 0 gives uniform crests along the whole coast. |
The surf takes its size from the live ocean waves, so a calm sea gives small surf and a storm gives big breakers.
Wave Shape
Section titled “Wave Shape”| Setting | Default | Range | What it does |
|---|---|---|---|
| Crest Nonlinearity | 1 | 0 to 1.5 | How strongly waves change shape as the water gets shallower: peaked crests and flat troughs first, then steep, forward-leaning fronts near breaking. 0 keeps them as smooth, even waves. |
| Breaker Index | 0.3 | 0.2 to 1.5 | How tall a wave can get for the water depth before it breaks. Higher lets bigger waves reach shallower water before breaking; lower makes them break farther out. |
| Sharpness | 0.8 | 0 to 1.5 | Crest sharpness of the surf: peaked crests, flat troughs and forward motion instead of bobbing. Limited automatically so crests never fold over. |
| Max Face Slope | 0.7 | 0.2 to 1.5 | Steepest wave face allowed, as rise over run (0.7 is about 35 degrees). Steeper waves are flattened to this limit and treated as breaking. |
| Setting | Default | Range | What it does |
|---|---|---|---|
| Breaking Onset | 0.8 | 0.5 to 1 | How close a wave must come to breaking before it makes whitewater: 0.5 breaks further out with lots of foam, 1 only fully broken waves. |
| Foam Strength | 1 | 0 to 4 | Strength of the surf whitewater, on top of the ocean’s Foam Strength. 1 keeps it as strong as the ocean foam, 0 removes it. |
| Foam Trail Time | 1.5 s | 0.1 to 10 s | How long the whitewater trail behind each breaking crest lasts. The foam rides the crest toward the beach and thins out behind it over this time. |
| Foam Drift Fraction | 0.5 | 0 to 1 | How fast the whitewater pattern travels toward the beach, as a fraction of the wave speed. Higher keeps the foam riding with the breaker; lower lets it fall behind like residual foam. |
| Foam Flow Cycle | 2 s | 0.5 to 10 s | Length of one foam flow cycle, which lets the foam pattern keep moving without stretching. Shorter cycles distort less but pulse more visibly. |
The surf foam uses the ocean’s Foam Texture and Foam Normal Texture.
Caustics
Section titled “Caustics”| Setting | Default | Range | What it does |
|---|---|---|---|
| Surf Caustics Strength | 1 | 0 to 3 | How strongly the surf focuses and spreads sunlight on the seabed, multiplying the ocean caustics in the surf zone. Whitewater blocks the caustics underneath it. 0 leaves the ocean caustics unchanged. |
Run-up
Section titled “Run-up”| Setting | Default | Range | What it does |
|---|---|---|---|
| Setup Scale | 1 | 0 to 3 | Rise of the mean water level inside the surf zone caused by breaking waves, highest at the beach. 1 is the physical amount, 0 turns it off. |
| Runup Scale | 0.4 | 0 to 4 | How far each broken wave rushes up the beach. 1 matches real beaches on average; bigger wave groups always run further than smaller ones. 0 turns run-up off. |
| Swash Thickness | 0.3 | 0.05 to 1 | Thickness of the water sheet running up the sand. Lower gives a thinner, more transparent sheet. |
| Swash Foam Width | 30 cm | 1 to 200 cm | Height band behind the swash tip that carries the foam line, measured vertically. Wider gives a broader foam edge, especially on flat beaches. |
| Max Runup Distance | 4000 cm | 500 to 20000 cm | Furthest distance up the beach, from where the water is Min Depth deep, that run-up can reach. Larger covers flatter beaches but makes the bake when play starts take longer. |
River mouths
Section titled “River mouths”A river that flows into the sea calms the sea’s waves where it enters. With GPU Depth Capture on (the default), the river channel is not taken for sea, so the surf does not run up the river. Changing a river mouth at runtime rebakes the shoreline. How to connect a river to the sea is covered in Rivers.
Multiplayer and dedicated servers
Section titled “Multiplayer and dedicated servers”- Every machine builds its own depth map and surf from the level it has loaded. Streaming rebakes happen on each machine as it streams.
- The Shoreline settings replicate from the server, and Rebake Shoreline called on the server rebakes on every client.
- A dedicated server starts its bake at once (Client Depth Map Delay is not used there), always builds the depth map as with GPU Depth Capture off, and does not run the surf, since it draws nothing.
Common problems
Section titled “Common problems”No surf at all
- You are looking at the editor viewport. The surf only exists while playing.
- Enabled (DRW Shoreline) or Compute Depthmap (DRW Grid Settings) is off. Map Check warns when Shoreline is on and Compute Depthmap is off.
- The coast is outside the bake area: the ocean is not at X = 0, Y = 0 (Map Check warns), or the coast is farther from the origin than half the bake area. Raise Grid Resolution or move the coast.
- The land is a plain static mesh. Only landscapes and Shoreline Obstacles count as land.
- The obstacle’s meshes have no collision on the Visibility channel.
- The sea is calm. The surf takes its size from the ocean waves; raise the sea state or Amplitude Scale.
- The coast is long and the surf is still being built. Wait a few seconds after play starts.
Surf on only part of the coast
- The coast needs more coastal cells than Atlas Resolution holds. Raise Atlas Resolution or lower Shore Band Width.
- Part of the coast lies outside the bake area.
Surf in the wrong place, or where land used to be
- A Shoreline Obstacle was moved without calling Rebake Shoreline.
- The landscape streamed in after the bake. Streaming rebakes automatically one second after streaming goes quiet; after Open Level, raising Client Depth Map Delay avoids the first wrong bake.
- GPU Depth Capture is off, so submerged meshes count as seabed.
- Unwanted surf in narrow channels or behind headlands: raise Narrow Channel Fade or Channel Fade Width.
Surf on small rocks, or none where you want it
- Small rocks and narrow points get weaker surf by design. Raise Small Coast Radius to weaken it further, lower it to give small islands more surf.
- Land smaller than about one depth sample (16 m at High) may get none. Raise Depth Quality to Ultra (8 m), or leave small rocks out of the Shoreline Obstacle when they should get no surf.
Waves too big or too small at the beach, or not breaking
- Height: Amplitude Scale and Gain Cap. Where waves break: Breaker Index. Whitewater amount: Breaking Onset and Foam Strength.
- Run-up too short on flat beaches: raise Max Runup Distance or Runup Scale.