# Sandbox.WaterBody

Renders a water surface with scene lighting, reflections and refraction.
The surface lies in the object's local XY plane, with a fluid volume below it.

- Kind: class
- Namespace: `Sandbox`
- Assembly: `Sandbox.Engine`
- Inherits: [Sandbox.Component](/api/Sandbox.Component)
- Modifiers: sealed

## Constructors

- [`WaterBody`](/api/Sandbox.WaterBody/.ctor)

## Fields

- [`SurfaceTag`](/api/Sandbox.WaterBody/SurfaceTag): Tag on generated surfaces, allowing cameras to exclude water.

## Properties

- [`Depth`](/api/Sandbox.WaterBody/Depth): Distance below the surface to the volume's bottom, in local inches. Changing depth preserves the water level and finite surface size.
- [`DetailTimeOffset`](/api/Sandbox.WaterBody/DetailTimeOffset): Detail-clock offset, preserving phase across material speed edits, swaps, cloning and serialization.
- [`DetailTimeSpeed`](/api/Sandbox.WaterBody/DetailTimeSpeed): The detail speed [Sandbox.WaterBody.DetailTimeOffset](/api/Sandbox.WaterBody/DetailTimeOffset) was last corrected for; negative before the first.
- [`Effects`](/api/Sandbox.WaterBody/Effects): Emit splashes when objects enter or players move across the surface.
- [`Material`](/api/Sandbox.WaterBody/Material): How the water looks: colour and opacity from above and below, roughness, detail normals, refraction and its fog, and the caustics it projects below. A material using the Water shader.
- [`Ocean`](/api/Sandbox.WaterBody/Ocean): Extend the surface to the horizon without a boundary. The visible patch follows the viewing camera while the water plane and texture coordinates remain fixed in the world.
- [`OverrideUnderwaterFogColor`](/api/Sandbox.WaterBody/OverrideUnderwaterFogColor): Tint underwater fog and the vignette with [Sandbox.WaterBody.UnderwaterFogColor](/api/Sandbox.WaterBody/UnderwaterFogColor) instead of the material's water fog colour, so the view below the surface can differ from the view down through it.
- [`ReflectionEnvironment`](/api/Sandbox.WaterBody/ReflectionEnvironment): What the water reflects where the screen-space or planar reflection has nothing, and everywhere when screen-space reflections are off in the settings.
- [`ReflectionEnvmap`](/api/Sandbox.WaterBody/ReflectionEnvmap): Cubemap reflected by the Custom Cubemap environment. Use a filtered HDR cubemap with roughness mipmaps. Missing or invalid textures fall back to scene probes.
- [`Reflections`](/api/Sandbox.WaterBody/Reflections): How the water reflects the scene. Either way the environment fills whatever the reflection can't see.
- [`Size`](/api/Sandbox.WaterBody/Size): Width and length of the surface in local inches.
- [`Underwater`](/api/Sandbox.WaterBody/Underwater): Apply this body's underwater fog, colour grading, vignette and blur beneath the rendered surface. Each camera selects its containing water body independently.
- [`UnderwaterBlur`](/api/Sandbox.WaterBody/UnderwaterBlur): Blur of the view below the surface. Zero removes it.
- [`UnderwaterColorGrade`](/api/Sandbox.WaterBody/UnderwaterColorGrade): How far the view below the surface is desaturated, darkened and given contrast. Zero removes the grade.
- [`UnderwaterDistortion`](/api/Sandbox.WaterBody/UnderwaterDistortion): Animated screen distortion while submerged, independent of surface refraction, clarity and fog. Zero leaves the underwater view undistorted.
- [`UnderwaterDistortionSpeed`](/api/Sandbox.WaterBody/UnderwaterDistortionSpeed): Screen distortion animation speed, independent of surface waves. Zero uses a stationary pattern. Changes preserve the current phase, including when stopping and resuming.
- [`UnderwaterDistortionTimeOffset`](/api/Sandbox.WaterBody/UnderwaterDistortionTimeOffset): Distortion-clock offset, preserving phase across speed edits, cloning and serialization.
- [`UnderwaterFogAttenuationDistance`](/api/Sandbox.WaterBody/UnderwaterFogAttenuationDistance): Distance beyond the fog start that removes approximately 63 percent of background light, in world inches. Smaller values give denser fog, independently of the screen effects and surface opacity.
- [`UnderwaterFogColor`](/api/Sandbox.WaterBody/UnderwaterFogColor): Tint of underwater fog and the vignette, when [Sandbox.WaterBody.OverrideUnderwaterFogColor](/api/Sandbox.WaterBody/OverrideUnderwaterFogColor) is on.
- [`UnderwaterFogMaximumOpacity`](/api/Sandbox.WaterBody/UnderwaterFogMaximumOpacity): Maximum fog coverage. Zero removes fog coverage without disabling the other underwater effects.
- [`UnderwaterFogNearDistance`](/api/Sandbox.WaterBody/UnderwaterFogNearDistance): Clear distance before underwater fog starts, in world inches.
- [`UnderwaterParticleColor`](/api/Sandbox.WaterBody/UnderwaterParticleColor): Colour of suspended sediment, independent of the surface and fog colours.
- [`UnderwaterParticleDensity`](/api/Sandbox.WaterBody/UnderwaterParticleDensity): Density of shader-generated suspended sediment. Zero skips sediment rendering.
- [`UnderwaterParticleDriftSpeed`](/api/Sandbox.WaterBody/UnderwaterParticleDriftSpeed): Speed of each speck's independent wandering motion. Zero freezes the world-anchored field. Changing speed preserves the current positions, including when stopping and resuming.
- [`UnderwaterParticleSizeRange`](/api/Sandbox.WaterBody/UnderwaterParticleSizeRange): Minimum and maximum diameters in world inches. Each speck keeps a stable random size in this range.
- [`UnderwaterParticleTimeOffset`](/api/Sandbox.WaterBody/UnderwaterParticleTimeOffset): Sediment-clock offset in seconds. Speed edits update it to preserve the current particle positions. Serialized with the body so copies and saved frozen fields retain their phase.
- [`UnderwaterVignette`](/api/Sandbox.WaterBody/UnderwaterVignette): Darkening toward the screen's edges in the fog colour. Zero removes it.
- [`UsesMeshBounds`](/api/Sandbox.WaterBody/UsesMeshBounds): A mesh on this object sets the water's extent: its top is the surface, its footprint the size and, unless it is flat, its height the depth. Works with an editable mesh, or a mesh tied to the object in Hammer. In game the mesh is switched off, so it neither draws nor collides.
- [`UsesMeshDepth`](/api/Sandbox.WaterBody/UsesMeshDepth): The mesh also sets the depth, which a flat mesh leaves to [Sandbox.WaterBody.Depth](/api/Sandbox.WaterBody/Depth).
- [`WaveDirection`](/api/Sandbox.WaterBody/WaveDirection): Direction of the dominant swell, in degrees from local +X toward +Y. Shorter bands spread around this heading.
- [`WaveHeight`](/api/Sandbox.WaterBody/WaveHeight): How far the waves rise above and fall below the mean surface, in inches. Zero disables wave deformation.
- [`WaveLength`](/api/Sandbox.WaterBody/WaveLength): Wavelength of the longest band in inches. The others are shorter multiples of it.
- [`Waves`](/api/Sandbox.WaterBody/Waves): Enable geometric surface waves without changing their saved settings.
- [`WaveSpeed`](/api/Sandbox.WaterBody/WaveSpeed): Speed multiplier for swell propagation. One is normal speed; zero stops propagation. Changes preserve the current wave phase, including when stopping and resuming. Surface Detail has its own animation controls.
- [`WaveSteepness`](/api/Sandbox.WaterBody/WaveSteepness): Sharpens crests and widens troughs independently of wave height. Zero gives rounded waves; one uses the full shared compression budget for the strongest chop without folding.
- [`WaveTimeOffset`](/api/Sandbox.WaterBody/WaveTimeOffset): Propagation-clock offset in seconds. Speed changes update it to preserve phase. Serialized with the water so clones and newly joined clients keep the same surface.
- [`WaveWidth`](/api/Sandbox.WaterBody/WaveWidth): Sideways scale of crest variation in inches, across WaveDirection. Smaller values give narrower, more frequent peaks along each crest; larger values give broader ridges.

## Methods

- [`Contains`](/api/Sandbox.WaterBody/Contains): Whether a world point lies inside the enabled fluid volume, including its surface and bottom.
- [`CreateBulletSplash`](/api/Sandbox.WaterBody/CreateBulletSplash): Create the upright bullet splash and its sound at this surface. The returned effect is local and destroys itself after playback.
- [`CreateSplash`](/api/Sandbox.WaterBody/CreateSplash): Create a small, medium or large splash, projected onto this surface. Sizes up to 32 use the small prefab; sizes up to 64 use medium. The returned effect is local and destroys itself after its particles and sound finish.
- [`Find`](/api/Sandbox.WaterBody/Find): Find an active fluid volume containing a world point. Finite volumes take precedence over infinite water; overlapping volumes of the same kind use scene order.
- [`FindSurface`](/api/Sandbox.WaterBody/FindSurface): Find the nearest active water surface whose footprint contains a world position. Finite surfaces take precedence over infinite surfaces at equal distances. Positions below an enabled volume's bottom are excluded.
- [`FromSurface`](/api/Sandbox.WaterBody/FromSurface): Convert surface-relative coordinates in world inches to a world position.
- [`SampleHeight`](/api/Sandbox.WaterBody/SampleHeight): Height of the animated surface above the mean plane at surface XY in world inches.
- [`SampleSurface`](/api/Sandbox.WaterBody/SampleSurface): Height and world normal at displaced surface XY, including Gerstner crest compression. Matches the unfiltered wave surface.
- [`ToSurface`](/api/Sandbox.WaterBody/ToSurface): Convert a world position to surface-relative coordinates measured in world inches. Positive Z lies above the water; X and Y follow the body's rotation without its scale.
