Water Appearance#

Lighting#

As other shaders would, the water will get most its lighting from the primary directional light (ie sun or moon).

See Chunk Template for advanced configuration.

Reflections#

Reflections contribute significantly to the appearance of the water. The look of the water will dramatically changed based on the reflection environment.

Crest uses Shader Graph which makes it by default ready to receive all the various sources of reflections Unity provides.

Furthermore, Crest provides Planar Reflections via the Reflections foldout on the Water Renderer for both above and below the water (known as TIR).

Refractions#

Refractions sample from the camera’s colour texture. Anything rendered in the transparent pass or higher will not be included in refractions.

See Transparent Object In Front Of Water Surface for issues with Crest and other refractive materials.

Chunk Template#

Crest uses Mesh Renderers to render chunks of water throughout the scene. Mesh Renderers have many settings for configuring how a mesh responds to different lighting components like probes.

The Chunk Template allows you to provide a pre-configured Mesh Renderer to override Crest’s defaults. Some settings cannot be overriden as they make no sense or require support from Crest.

To use this feature, create a prefab with a Mesh Renderer. The only other requirement is to not have a Water Chunk Renderer present in the prefab.

Tip

Clicking “New” next to Water Renderer ‣ Surface Renderer ‣ Chunk Template will create a new one for you.

Settings which cannot be overriden are:

  • Receive Shadows

  • Motion Vectors

Other settings may not have any effect depending on the level of support with the render pipeline.

Foam#

Overview#

Crest simulates foam generation by choppy water (ie pinched wave crests) and in shallow water to approximate foam from splashes at the shoreline. Each update (default is 30 updates per second), the foam values are reduced to model gradual dissipation of foam over time.

To turn on this feature, enable Water Renderer ‣ Simulations ‣ Foam ‣ Enabled.

To configure the foam simulation, create a Foam Lod Settings with Assets ‣ Create ‣ Crest ‣ Simulation Settings ‣ Foam Sim Settings, and assigning it to the Water Renderer component in your scene.

Tip

Clicking “New” next to Water Renderer ‣ Simulations ‣ Foam ‣ Settings will create a new one for you.

User Inputs#

Crest supports inputting foam data into the system, which can be helpful for fine tuning where foam is placed.

The Foam Input component can write data to the simulation and supports the Texture Mode, Spline Mode, Paint Mode and Renderer Mode. The Texture Mode is the most efficient mode.

The following shaders are available under Crest/Inputs/Foam if using the Renderer Mode:

  • Add From Texture adds foam values read from a user provided texture. Can be useful for placing ‘blobs’ of foam as desired, or can be moved around at runtime to paint foam into the simulation. This is an alternative to the Texture Mode as it can provide more properties to adjust.

  • Add From Vertex Colors can be applied to geometry and uses the red channel of vertex colours to add foam to the simulation. Similar in purpose to Add From Texture, but can be authored in a modelling workflow instead of requiring a texture.

Simulation Settings#

Simulation properties are covered with tooltips. This are overviews of each category.

Whitecaps: Crest detects where waves are ‘pinched’ and deposits foam to approximate whitecaps. Shoreline Foam: If water depth input is provided to the system (see Depth Simulation), the foam simulation can automatically generate foam when water is very shallow, which can approximate accumulation of foam at shorelines.

Shadows#

The shadow data consists of two channels. One is for normal shadows (hard shadow term) as would be used to block specular reflection of the light. The other is a much softer shadowing value (soft shadow term) that can approximate variation in light scattering in the water volume.

This data is captured from the shadow maps Unity renders before the transparent pass. These shadow maps are always rendered in front of the viewer. The Shadow simulation then reads these shadow maps and copies shadow information into its LOD textures.

To turn on this feature, enable Water Renderer ‣ Simulations ‣ Shadows ‣ Enabled.

User Inputs#

The Shadow Input component can write data to the simulation and supports the Renderer Mode. There are currently no shadow specific shaders, but the general purpose shaders under Crest/Inputs/All will accomplish most things (especially Override).

Simulation Settings#

The shadow simulation can be configured under Water Renderer ‣ Simulations ‣ Shadows.

In particular, the soft shadows are very soft by default, and may not appear for small/thin shadow casters. This can be configured using the Jitter Diameter Soft setting.

There will be times when the shadow jitter settings will cause shadows or light to leak. An example of this is when trying to create a dark room during daylight. At the edges of the room the jittering will cause the water on the inside of the room (shadowed) to sample outside of the room (not shadowed) resulting in light at the edges. Reducing the Jitter Diameter Soft setting can solve this, but we have also provided a Shadow Input component which can override the shadow data. This component bypasses jittering and gives you full control.

Custom Albedo#

Overview#

The Albedo feature allows a color layer to be composited on top of the water surface. This is useful for projecting color onto the surface like duckweed.

This is somewhat similar to decals, except the color only affects the water.

Note

HDRP has a Decal Projector feature that works with the water shader, and the effect is more configurable and may be preferred over this feature. When using this feature be sure to enable Affects Transparent.

URP 2022 has a decal system but it does not support transparent surfaces like water.

User Inputs#

The Albedo Input component can write data to the simulation and supports the Renderer Mode.

Any geometry or particle system can add color to the water. It will be projected from a top down perspective onto the water surface.

The following shaders are available under Crest/Inputs/Albedo if using the Renderer Mode:

  • Color a basic shader for writing a color or texture to the Albedo data including blend modes.

Note

If using a shader with multiple passes (or Shader Graph), if the output looks incorrect then change the Shader Pass Index.

Orthographic Projection#

Crest supports orthographic projection, but it might require some configuration to get a desired appearance.

Crest uses the camera’s position for the LOD system which can be awkward for orthographic which uses the size property on the camera. Use the Viewpoint property on the Water Renderer to override the camera’s position. Increasing the minimum scale (Water Renderer ‣ Level of Detail ‣ Scale) will help spread the detail out to make the water appear more uniform. Pick a minimum scale that looks best.

Adjusting the camera’s Y value is important in preventing a hard seam running across the surface. The camera’s height will need to be reasonable as per the size value.

Underwater only works with a positive near clip plane.

Motion Vectors#

Crest supports motion vectors, but only for HDRP and Unity 6 URP.

These should be enabled by default, but to enable motion vector support:

Note

If you are using URP, and have upgraded from an earlier version of Unity to Unity 6, you will need to re-import the water Shader Graph from the package manager again for motion vectors to work.

Post-Processing#

The water surface writes to the depth buffer, and supports copying the water from the depth buffer into the depth texture for post-processing effects like Depth of Field (HDRP and URP only).

These should be enabled by default, but to enable depth write for post-processing:

  • On the water material, enable Surface Options ‣ Depth Write to set to Force Enabled

  • For URP:

    • Enable Water Renderer ‣ Surface Renderer ‣ Write to Depth Texture. This will copy the depth buffer into the depth texture after the transparent pass (it could include more than just water)

Level of Detail#

There are a small number of parameters that control the construction of the water shape and geometry. All the information is in tooltips under Water Renderer ‣ Level of Detail.