Paul Drummond

Design & Development

Water Visibility & Custom Passes

Floating Objects Water Visibility & Custom Data Passes

  • Unity C#
  • Shaders
  • Compute Shaders

Mindtech Chameleon is an ML/AI Synthetic data generation application, and one of its key features is the ability to output custom data passes and annotations. For example, an image sequence can include normal, depth and segmentation data. Segmentation enables scene objects to be given a specific solid colour, similar to a Material ID or Clown Pass in traditional 3D rendering.

A client required sequences showing human actors and other objects floating in the sea. The custom passes, such as segmentation, had to show the correct cutoff based on the visual appearance of the water surface. This appearance changes depending on properties such as the water refraction maximum distance, light absorption distance, scene lighting and camera angle. We couldn’t simply grab one of the internal buffers from the HDRP Water System because this would include visual distortion from refraction. The solution was to develop a C# / Compute Shader system which uses the water properties to calculate the correct alpha cutoff for the custom passes. The video below shows how the normal, depth and segment passes react to the changing water falloff visibility. When the water is clear the custom passes show more of the object under the surface. When the water is opaque the custom passes cutoff accordingly. This solution has minimal CPU / GPU cost and can be further optimised by changing the alpha cutoff from fragment to vertex in the shader.

Water visibility cutoff passes