Unreal Engine 5: Nanite and Water

Unreal Engine 5: Nanite and Water

Nanite in Unreal Engine 5 enables far greater geometry density. When using this awesome technology for floor geometry, some of the older techniques for achieving visual effects no longer work.

A prime example of this is the use of water puddle shaders. When using normals to fake geometry, layering puddles onto the texture is an effective way of selling the illusion that the floor is uneven and that water really would pool there. With Nanite, the geometry is real, and these effects break down. The one saving grace, however, is that we can now use water planes to achieve the same effect.

Once a water plane is placed, there is still the matter of making the geometry look wet. Below is the result of the first attempt at doing this using decals.

While the contrast in colour of the submerged rock looks good, the shininess is a problem. Materials that are underwater aren't more or less reflective than in air. Currently, this effect looks like the rock has a thin layer of something covering it. Trying to avoid the layering effect is problematic with the Unreal Engine decals. There does not appear to be a way to modulate only base colour in deferred decals, so instead, the roughness and specularity are blended too. However, this decal approach looks really good for small wet areas, and it can be masked to create a very natural-looking wet spot in levels where other techniques are less well suited.

Achieving the effect shown in the title image actually completely dodges the decal problem. The water plane in these shots is something akin to a water table, the base opaque material used by the Nanite geometry can be extended to support a single height where everything below it has its base colour modified based on the porousness of the object. This approach doesn't support multiple water planes; however, it works well for this singular case.