Skip to content

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.

  1. Place BP_DynamicRealWater at 0, 0, 0. See Setting up the ocean.

  2. Keep Compute Depthmap on (ocean, DRW Grid Settings) and Enabled on (ocean, DRW Shoreline). Both are on by default.

  3. Build the coast with a landscape, or put mesh land into a Shoreline Obstacle. Landscapes are found automatically, including World Partition landscape proxies.

  4. Make sure the coast lies inside the bake area around the ocean.

  5. 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 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 ResolutionBake areaCoasts must lie within
128 x 1288.2 km squareabout 4.1 km of the origin in X and Y
256 x 256 (default)16.4 km squareabout 8.2 km of the origin in X and Y
512 x 51232.8 km squareabout 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 QualityOne depth sample every
Low (1 px per cell)64 m
Medium (2 px per cell)32 m
High (4 px per cell), default16 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:

SettingDefaultWhat it does
GPU Depth CaptureOnOn: 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 Delay0.2 sWait 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 Threshold0.99Share 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 Radius2Smoothing 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 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.

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.

  1. Create a Blueprint class with DRW_ShorelineObstacle as its parent.

  2. Add your land meshes as Static Mesh components. Every mesh in the actor counts as land.

  3. Give the meshes collision that blocks the Visibility channel. The ocean finds the land through it.

  4. 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.

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.

SettingDefaultRangeWhat it does
EnabledOnTurns the surf on or off. Off also removes all surf cost.
Min Depth50 cm1 to 500 cmWater 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 Width12000 cm1000 to 50000 cmWidth of the band in front of the coast where the swell is carried in as surf.
Narrow Channel Fade10 to 1Fades 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 Width20000 cm500 to 20000 cmDistance 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 Radius20000 cm0 to 50000 cmCoasts 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 Resolution2048512 to 4096How 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 ResolutionCoastal cells it holds
512196
1024784
2048 (default)3,136
409612,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.

SettingDefaultRangeWhat it does
Amplitude Scale20 to 8Overall height multiplier of the swell carried in from offshore.
Gain Cap31 to 6Limit on how much the waves may grow between the band edge and the beach.
Swell Cutoff Fraction0.10.1 to 2Which 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 Components161 to 32Number of wave components the surf is built from. More gives a less regular surf at a higher GPU cost.
Crest Length Fraction30.5 to 20Length of the stronger and weaker stretches along each crest, as a fraction of the main wave length.
Crest Variation0.60 to 1How 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.

SettingDefaultRangeWhat it does
Crest Nonlinearity10 to 1.5How 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 Index0.30.2 to 1.5How 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.
Sharpness0.80 to 1.5Crest sharpness of the surf: peaked crests, flat troughs and forward motion instead of bobbing. Limited automatically so crests never fold over.
Max Face Slope0.70.2 to 1.5Steepest wave face allowed, as rise over run (0.7 is about 35 degrees). Steeper waves are flattened to this limit and treated as breaking.
SettingDefaultRangeWhat it does
Breaking Onset0.80.5 to 1How 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 Strength10 to 4Strength 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 Time1.5 s0.1 to 10 sHow 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 Fraction0.50 to 1How 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 Cycle2 s0.5 to 10 sLength 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.

SettingDefaultRangeWhat it does
Surf Caustics Strength10 to 3How 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.
SettingDefaultRangeWhat it does
Setup Scale10 to 3Rise 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 Scale0.40 to 4How 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 Thickness0.30.05 to 1Thickness of the water sheet running up the sand. Lower gives a thinner, more transparent sheet.
Swash Foam Width30 cm1 to 200 cmHeight band behind the swash tip that carries the foam line, measured vertically. Wider gives a broader foam edge, especially on flat beaches.
Max Runup Distance4000 cm500 to 20000 cmFurthest 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.

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.

  • 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.

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.