Underwater#

Crest supports seamless transitions above/below water. It can also have a meniscus which renders a subtle line at the intersection between the camera lens and the water to visually help the transition. This is demonstrated in the Main.unity scene in the example content.

For performance reasons, the underwater effect is disabled if the viewpoint is not underwater.

Tip

Use opaque or alpha test materials for underwater surfaces. Transparent materials do not receive the underwater effect. This can be solved with Integrate Water Volume (Shader Graph).

Underwater Renderer#

The Underwater Renderer is built into the Water Renderer and executes a fullscreen underwater effect before the transparent pass. Transparent objects by default do not receive the underwater effect.

Tip

You can enable/disable rendering in the scene view by toggling fog in the scene view control bar.

Setup#

  • Configure the water material for underwater rendering. Under Surface Options make sure both sides are enabled with either Render Face to Both or Double-Sided enabled.

  • Enable Crest Water ‣ Underwater ‣ Enabled.

  • Make sure that Crest is set to the underwater material.

Note

If you are using the underwater effect in URP, it is recommended to set Opaque Downsampling to None. Opaque Downsampling will make everything appear at a lower resolution when underwater. Be sure to test to see if recommendation is suitable for your project.

Appearance#

The underwater effect gets its appearance from two sources: the water material and the underwater material.

The water material can be overriden by setting Water Renderer ‣ Volume Material to a material variant of the water material. Not every property on the water material affects the underwater effect. To see what can be overriden, see the read-only properties on the underwater material.

The underwater material has more properties which can further adjust the underwater effect.

Integrate Water Volume (Shader Graph)#

Transparent objects do not receive the underwater effect due to the effect rendering before the transparent pass. We provide a Shader Graph node, Integrate Water Volume, to conditionally apply underwater fog.

Additionally, this can exclude Unity’s own fog when underwater (for transparent and opaque).

Meniscus Renderer#

The Meniscus Renderer is integrated into the Water Renderer under the Meniscus foldout. It renders a meniscus effect where the surface intersects the near plane (or in case of portals, the edge of the portal).

To configure the meniscus effect, there are options under foldout, and the material inspector appears at the bottom of the Water Renderer component.

Detecting Above or Below Water#

The Water Renderer component has the Viewer Height Above Water property which can be accessed with WaterRenderer.Instance.ViewerHeightAboveWater. It will return the signed height from the water surface of the camera rendering the water.

There is also the Query Events component which uses UnityEvents to provide a scriptless approach to triggering changes.

Portals & Volumes#

Underwater rendering can be restricted to a mesh.

Please see Portals & Volumes.

Underwater Only#

The underwater effect can render without the surface to save performance. Simply disable Water Renderer ‣ Surface ‣ Enabled.

Furthermore, disable all of the simulations to save performance further.

Legacy Underwater#

For those who need the older implementation of the underwater/meniscus effect, enable Project Settings ‣ Crest ‣ Legacy Underwater. It may take a minute for recompilation to begin.

The legacy effect typically has worst performance, and there should not be a need to use it. It renders after the transparent pass, which means transparents will receive the underwater effect without an integration, albeit incorrectly.