Triton
Visual simulation library for ocean rendering.
Underwater rendering with Triton

Triton provides support for rendering the water surface from above or below sea level.

Rendering the rest of the scene's objects underwater is the responsibility of the application, but we provide hooks to ensure the sea surface is rendered consistently with the rest of your scene.

You'll want to take a look at the method Triton::Environment::SetBelowWaterVisibility(). In addition to rendering the water surface properly from below the water, this method will allow you to fog the water surface to a given visibility and fog color.

When underwater, setting a fog color that's consistent with the background and fog used for the rest of the underwater scene will yield good results. Clearing the backbuffer to match the color specified, or using a skybox with a specific color below the horizon, will work well. (If you're using SilverLining, Atmosphere::SetHaze() may be used for this purpose.) Remember that Triton by design ONLY draws the water surface - it will not affect the rendering of the other objects in your scene in any way. It's up to you to ensure the rest of your scene, and the sky, are fogged consistently with the values you passed into Environment::SetBelowWaterVisibility() when Triton::Ocean::IsCameraAboveWater() returns false.

Note that these methods take in a visibility value; this will be translated into an exponential fog extinction value using the Koschmieder equation: visibility = 3.912 / extinction.

Triton also has an underwater "God Rays" effect that may be triggered with the Triton::Ocean::EnableGodRays() method. When enabled, shafts of light will automatically be drawn while underwater and near the surface, looking toward the refracted sunlight vector. You may adjust the look of this effect with the God Rays section of the resources/Triton.config file. These shafts of light are generated from the wave motion at the water surface, so the animation of this effect will be more intense in rough seas, and less intense in calm seas.