A little-known but incredibly useful feature in the Triton Ocean SDK is volumetric decals – this lets you place 2D textures, with some limited animation capabilities, on the water surface. While decals are usually nothing special, they are when applied to a dynamically animated surface such as Triton’s water. A technique called volumetric decals (also known as deferred decals) must be used to project your 2D texture onto the constantly changing 3D water surface. Fortunately, Triton hides all of this complexity from you; all you need to do is give it a decal texture, a size, and where you want it, and Triton does the rest. Customers have used this capability for several interesting effects:
- Jets from thrusters on ocean platforms or tugboats
- Floating debris on the water surface
- Custom rotor wash effects
- Custom eddy and tidal stream effects
- Films on the water, such as oil slicks
- Custom ship wake effects
The only limit is your imagination!
To use decals, start with the Triton::Ocean::AddDecal() method. This lets you position a given decal texture over a given point on the water, at a given size. Often, that’s all you need! Triton’s decal system is quite efficient, so it’s not much more work to render hundreds of decals than it is to render one of them – feel free to use them liberally.
For finer control of your decals, we allow you to scale, fade, and rotate them however you wish once they have been created. AddDecal() gives you back a DecalHandle you can use to modify this decal over time, in order to create basic animation effects. See Ocean::ScaleDecal(), Ocean::RotateDecal(), and Ocean::SetDecalAlpha(). For example, Triton’s built-in rotor wash effect uses several overlaid volumetric decals that expand and fade out over time in order to get that effect of expanding concentric rings emanating from the rotor wash.
When you’re done with a decal, use Ocean::RemoveDecal() to clean up its resources.
If you are using Triton’s “patch shader” capabilities to shade your own water geometry, be sure to read the documentation on Triton::Ocean::SetPatchShader() for some important details on supporting decals. When you’re doing your own drawing, an extra step is needed to ensure the depth map needed by the decal effect is generated.