Class WaterSurface
Inherited Members
Component.GetComponentIndex()
Object.InstantiateAsync<T>(T)
Object.InstantiateAsync<T>(T, Transform)
Object.InstantiateAsync<T>(T, Vector3, Quaternion)
Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)
Object.Instantiate(Object, Scene)
Object.FindObjectsByType<T>(FindObjectsSortMode)
Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)
Object.FindFirstObjectByType<T>()
Object.FindAnyObjectByType<T>()
Object.FindFirstObjectByType<T>(FindObjectsInactive)
Object.FindAnyObjectByType<T>(FindObjectsInactive)
Assembly: Unity.RenderPipelines.HighDefinition.Runtime.dll
Syntax
[DisallowMultipleComponent]
[ExecuteInEditMode]
public class WaterSurface : MonoBehaviour
Fields
absorbtionDistanceMultiplier
Sets the multiplier for the Absorption Distance when the camera is under water. A value of 2.0 means you will see twice as far underwater.
Declaration
[Tooltip("Sets the multiplier for the Absorption Distance when the camera is under water. A value of 2.0 means you will see twice as far underwater.")]
public float absorbtionDistanceMultiplier
Field Value
absorptionDistance
Controls the approximative distance in meters that the camera can perceive through a water surface. This distance can vary widely depending on the intensity of the light the object receives.
Declaration
[Tooltip("Controls the approximative distance in meters that the camera can perceive through a water surface. This distance can vary widely depending on the intensity of the light the object receives.")]
public float absorptionDistance
Field Value
ambientScattering
Controls the intensity of the ambient scattering term. This can be adjusted for artistic purposes.
Declaration
[Tooltip("Controls the intensity of the height based scattering. The higher the vertical displacement, the more the water receives scattering. This can be adjusted for artistic purposes.")]
public float ambientScattering
Field Value
caustics
When enabled, the water surface will render caustics.
Declaration
[Tooltip("When enabled, the water surface will render caustics.")]
public bool caustics
Field Value
causticsBand
Controls which band is used for the caustics evaluation.
Declaration
[Tooltip("Controls which band is used for the caustics evaluation.")]
public int causticsBand
Field Value
causticsIntensity
Sets the intensity of the under-water caustics.
Declaration
[Tooltip("Sets the intensity of the under-water caustics.")]
public float causticsIntensity
Field Value
causticsPlaneBlendDistance
Sets the vertical blending distance for the water caustics.
Declaration
[Tooltip("Sets the vertical blending distance for the water caustics.")]
public float causticsPlaneBlendDistance
Field Value
causticsResolution
Specifies the resolution at which the water caustics are rendered (simulation only).
Declaration
[Tooltip("Specifies the resolution at which the water caustics are rendered (simulation only).")]
public WaterSurface.WaterCausticsResolution causticsResolution
Field Value
cpuEvaluateRipples
Specifies if the CPU simulation should evaluate the ripples as part of the simulation. Including ripples will allow a higher visual fidelity but the cost of the simulation will increase.
Declaration
public bool cpuEvaluateRipples
Field Value
cpuFullResolution
Specifies if the CPU simulation should be evaluated at full or half resolution. When in full resolution, the visual fidelity will be higher but the cost of the simulation will increase.
Declaration
public bool cpuFullResolution
Field Value
cpuSimulation
When enabled, HDRP will evaluate the water simulation on the CPU for C# script height requests. Enabling this will significantly increase the CPU cost of the feature.
Declaration
public bool cpuSimulation
Field Value
customMaterial
Sets a custom material that will be used to render the water surface. If set to None a default material is used.
Declaration
public Material customMaterial
Field Value
decalLayerMask
Specifies the decal layers that affect the water surface.
Declaration
[Tooltip("Specifies the decal layers that affect the water surface.")]
public DecalLayerEnum decalLayerMask
Field Value
directLightBodyScattering
Controls the intensity of the direct light scattering on the body of the waves. The effect is more perceivable at grazing angles.
Declaration
[Tooltip("Controls the intensity of the direct light scattering on the body of the waves. The effect is more perceivable at grazing angles.")]
public float directLightBodyScattering
Field Value
directLightTipScattering
Controls the intensity of the direct light scattering on the tip of the waves. The effect is more perceivable at grazing angles.
Declaration
[Tooltip("Controls the intensity of the direct light scattering on the tip of the waves. The effect is more perceivable at grazing angles.")]
public float directLightTipScattering
Field Value
displacementScattering
Controls the intensity of the displacement based scattering. The bigger horizontal displacement, the more the water receives scattering. This can be adjusted for artistic purposes.
Declaration
[Tooltip("Controls the intensity of the displacement based scattering. The bigger horizontal displacement, the more the water receives scattering. This can be adjusted for artistic purposes.")]
public float displacementScattering
Field Value
endSmoothness
Declaration
[Tooltip("")]
public float endSmoothness
Field Value
foam
Declaration
[Tooltip("")]
public bool foam
Field Value
foamMask
Set the texture used to attenuate or suppress the simulation foam.
Declaration
public Texture2D foamMask
Field Value
foamMaskExtent
Sets the extent of the foam mask in meters.
Declaration
[Tooltip("Sets the extent of the foam mask in meters.")]
public Vector2 foamMaskExtent
Field Value
foamMaskOffset
Sets the offset of the foam mask in meters.
Declaration
[Tooltip("Sets the offset of the foam mask in meters.")]
public Vector2 foamMaskOffset
Field Value
foamTexture
Set the texture used to attenuate or suppress the simulation foam.
Declaration
[Tooltip("Set the texture used to attenuate or suppress the simulation foam.")]
public Texture2D foamTexture
Field Value
foamTextureTiling
Set the per meter tiling for the foam texture.
Declaration
[Tooltip("Set the per meter tiling for the foam texture.")]
public float foamTextureTiling
Field Value
geometryType
Specifies the type of geometry used to render the water surface.
Declaration
public WaterGeometryType geometryType
Field Value
heightScattering
Controls the intensity of the height based scattering. The higher the vertical displacement, the more the water receives scattering. This can be adjusted for artistic purposes.
Declaration
[Tooltip("Controls the intensity of the height based scattering. The higher the vertical displacement, the more the water receives scattering. This can be adjusted for artistic purposes.")]
public float heightScattering
Field Value
largeBand0FadeDistance
Declaration
[Tooltip("")]
public float largeBand0FadeDistance
Field Value
largeBand0FadeStart
Declaration
[Tooltip("")]
public float largeBand0FadeStart
Field Value
largeBand0FadeToggle
Declaration
public bool largeBand0FadeToggle
Field Value
largeBand0Multiplier
Declaration
public float largeBand0Multiplier
Field Value
largeBand1FadeDistance
Declaration
[Tooltip("")]
public float largeBand1FadeDistance
Field Value
largeBand1FadeStart
Declaration
[Tooltip("")]
public float largeBand1FadeStart
Field Value
largeBand1FadeToggle
Declaration
[Tooltip("")]
public bool largeBand1FadeToggle
Field Value
largeBand1Multiplier
Declaration
[Tooltip("")]
public float largeBand1Multiplier
Field Value
largeChaos
Declaration
Field Value
largeCurrentOrientationValue
Declaration
public float largeCurrentOrientationValue
Field Value
largeCurrentSpeedValue
Declaration
public float largeCurrentSpeedValue
Field Value
largeWindOrientationValue
Declaration
public float largeWindOrientationValue
Field Value
largeWindSpeed
Declaration
public float largeWindSpeed
Field Value
lightLayerMask
Specifies the light layers that affect the water surface.
Declaration
[Tooltip("Specifies the light layers that affect the water surface.")]
public LightLayerEnum lightLayerMask
Field Value
maxRefractionDistance
Controls the maximum distance in meters used to clamp the under water refraction depth. Higher value increases the distortion amount.
Declaration
[Tooltip("Controls the maximum distance in meters used to clamp the under water refraction depth. Higher value increases the distortion amount.")]
public float maxRefractionDistance
Field Value
mesh
Sets the geometry to use when rendering in quad and custom geometry type mode. The vertical position of the vertices will be overridden to keep the surface of water leveled.
Declaration
Field Value
refractionColor
Sets the color that is used to simulate the under-water refraction.
Declaration
[Tooltip("Sets the color that is used to simulate the under-water refraction.")]
[ColorUsage(false)]
public Color refractionColor
Field Value
repetitionSize
Declaration
[Tooltip("")]
public float repetitionSize
Field Value
ripples
When enabled, the water system allows you to simulate and render a ripples simulation for finer details.
Declaration
Field Value
ripplesChaos
Declaration
[Tooltip("")]
public float ripplesChaos
Field Value
ripplesCurrentMode
Declaration
[Tooltip("")]
public WaterPropertyOverrideMode ripplesCurrentMode
Field Value
ripplesCurrentOrientationValue
Declaration
[Tooltip("")]
public float ripplesCurrentOrientationValue
Field Value
ripplesCurrentSpeedValue
Declaration
[Tooltip("")]
public float ripplesCurrentSpeedValue
Field Value
ripplesFadeDistance
Declaration
[Tooltip("")]
public float ripplesFadeDistance
Field Value
ripplesFadeStart
Declaration
[Tooltip("")]
public float ripplesFadeStart
Field Value
ripplesFadeToggle
Declaration
[Tooltip("")]
public bool ripplesFadeToggle
Field Value
ripplesWindOrientationMode
Declaration
[Tooltip("")]
public WaterPropertyOverrideMode ripplesWindOrientationMode
Field Value
ripplesWindOrientationValue
Declaration
[Tooltip("")]
public float ripplesWindOrientationValue
Field Value
ripplesWindSpeed
Declaration
[Tooltip("")]
public float ripplesWindSpeed
Field Value
scatteringColor
Sets the color that is used to simulate the under-water scattering.
Declaration
[Tooltip("Sets the color that is used to simulate the under-water scattering.")]
[ColorUsage(false)]
public Color scatteringColor
Field Value
simulationFoamAmount
Controls the simulation foam amount. Higher values generate larger foam patches. Foam presence is highly dependent on the wind speed and chopiness values.
Declaration
[Tooltip("Controls the simulation foam amount. Higher values generate larger foam patches. Foam presence is highly dependent on the wind speed and chopiness values.")]
public float simulationFoamAmount
Field Value
simulationFoamDrag
Controls the life span of the surface foam. A higher value will cause the foam to persist longer and leave a trail.
Declaration
[Tooltip("Controls the life span of the surface foam. A higher value will cause the foam to persist longer and leave a trail.")]
public float simulationFoamDrag
Field Value
simulationFoamSmoothness
Controls the simulation foam smoothness.
Declaration
[Tooltip("Controls the surface foam smoothness.")]
public float simulationFoamSmoothness
Field Value
smoothnessFadeDistance
Declaration
[Tooltip("")]
public float smoothnessFadeDistance
Field Value
smoothnessFadeStart
Declaration
[Tooltip("")]
public float smoothnessFadeStart
Field Value
startSmoothness
Declaration
[Tooltip("")]
public float startSmoothness
Field Value
surfaceType
Specifies the nature of the water body that the water system needs to simulate.
Declaration
public WaterSurfaceType surfaceType
Field Value
timeMultiplier
Sets the speed of the water simulation. This allows to slow down the wave's speed or to accelerate it.
Declaration
public float timeMultiplier
Field Value
transitionSize
Sets a vertical distance to the water surface at which the blending between above and under water starts.
Declaration
[Tooltip("Sets a vertical distance to the water surface at which the blending between above and under water starts.")]
public float transitionSize
Field Value
underWater
When enabled, HDRP will apply a fog and color shift to the final image when the camera is under the surface. This feature has a cost even when the camera is above the water surface.
Declaration
[Tooltip("When enabled, HDRP will apply a fog and color shift to the final image when the camera is under the surface. This feature has a cost even when the camera is above the water surface.")]
public bool underWater
Field Value
virtualPlaneDistance
Sets the distance at which the simulated caustics are projected. High values generate sharper caustics but can cause artefacts.
Declaration
public float virtualPlaneDistance
Field Value
volumeBounds
Sets a box collider that will be used to define the volume where the under water effect is applied for non infinite surfaces.
Declaration
[Tooltip("Sets a box collider that will be used to define the volume where the under water effect is applied for non infinite surfaces.")]
public BoxCollider volumeBounds
Field Value
volumeDepth
Sets maximum depth at which the under water effect is evaluated for infinite surfaces.
Declaration
[Tooltip("Sets maximum depth at which the under water effect is evaluated for infinite surfaces.")]
public float volumeDepth
Field Value
volumePrority
Sets a priority value that is used to define which surface should be considered for under water rendering in the case of multiple overlapping surfaces.
Declaration
[Tooltip("Sets a priority value that is used to define which surface should be considered for under water rendering in the case of multiple overlapping surfaces.")]
public int volumePrority
Field Value
waterMask
Sets the texture used to attenuate or supress the swell, agiation and ripples water frequencies.
Declaration
public Texture2D waterMask
Field Value
waterMaskExtent
Sets the extent of the water mask in meters.
Declaration
[Tooltip("Sets the extent of the water mask in meters.")]
public Vector2 waterMaskExtent
Field Value
waterMaskOffset
Sets the offset of the water mask in meters.
Declaration
[Tooltip("Sets the offset of the water mask in meters.")]
public Vector2 waterMaskOffset
Field Value
windFoamCurve
Controls the foam amount depending on the wind speed.
Declaration
public AnimationCurve windFoamCurve
Field Value
Methods
FillWaterSearchData(ref WaterSimSearchData)
Function that fills a WaterSimSearchData with the data of the current water surface.
Declaration
public bool FillWaterSearchData(ref WaterSimSearchData wsd)
Parameters
Returns
Type |
Description |
bool |
A boolean that defines if the function was able to fill the search data.
|
FindWaterSurfaceHeight(WaterSearchParameters, out WaterSearchResult)
Function that attempts to evaluate the water surface height at a given location.
Declaration
public bool FindWaterSurfaceHeight(WaterSearchParameters wsp, out WaterSearchResult wsr)
Parameters
Type |
Name |
Description |
WaterSearchParameters |
wsp |
The water simulation search parameters that defines the location we are targeting and additional parameters.
|
WaterSearchResult |
wsr |
The water simulation search result that contains the result height, error, etc.
|
Returns
Type |
Description |
bool |
A boolean that defines if the function was able to execute the evaluation.
|
GetSimulationResolutionCPU()
Function that returns the water surface CPU simulation resolution.
Declaration
public WaterSimulationResolution GetSimulationResolutionCPU()
Returns
Type |
Description |
WaterSimulationResolution |
A value of time WaterSimulationResolution that defines the current water surface CPU simulation resolution.
|