↓ Skip to main content

Realistic Wet Materials

Since physically based rendering (PBR) is now a standard in most games we try to simulate better and more lighting models that cover more material types. With the classic lighting model, everybody chose to darken the diffuse term and boost the specular term. With the method explained below you can provide a way to simulate wet surfaces while keeping your material physically accurate.

We can easily distinguish between a dry and wet surface. The best visual cue is that wet surfaces look darker, have a higher specular value, and exhibit subtle changes in saturation. This behavior is made by rough/porous materials (brick, clay, concrete, plaster…), Absorbent materials (cotton, fabric), and organic materials like hair. Materials that are smooth don’t change however since they are already reflecting a lot of light.

Darkening The Albedo
#

When looking at all the visual cues of wet materials, we can see that the surface looks darker. This depends on how porous the material is and how much light is absorbed. Another thing we can see is that brighter diffuse values stay bright but everything else darkens. At first, it seems reasonable to multiply to diffuse factor with a scalar value depending on the wetness. The problem with this method is that bright diffuse colors lose more color than supposed to and the materials appear rather black instead of darker.

A better way to darken the diffuse is to square it. This makes the brighter AND the darker colors lose less value while others at around 50% will be adjusted more accurately. Below you can see a graph that shows the difference between a squared diffuse and a diffuse multiplied with a low value (0.35 here).

The difference between the normal diffuse (left), the diffuse multiplied with a low value (middle), and the squared diffuse (right)

Input Properties
#

To keep the input intuitive for artists, we use as few material properties as possible. To control the wetness on the material itself we use a single greyscale texture that the artists can paint to keep visual consistency, physical correctness and still keep things intuitive.

We also use a single wetness float to scale the mask so we can dynamically change it via gameplay. Below you can find a visualization of multiple wetness masks.

Tip

An easy way to create a wetness map is to start with an inverted height map and apply some contrast to it!

Example materials with their wetness texture
PropertyTypeDescription
WetnessFloatThis drives the transition between the different phases and also acts as a scalar value of the wetness mask
Wetness MaskGreyscale TextureThis controls the material wetness
Tip

Since we want porous materials to darken when they’re wet, we could give this as a second property to the artist. However, since the porosity is based on the materials roughness value we can use the roughness map as input for this


The Shader Code
#

Here’s the shader code. The artists have control of the wetness parameter whereas the porosity parameter is the material’s roughness value. Wetness drives the transition and the porosity darkens the base color. To darken the material we lerp to a squared version of the base color. This is a reasonable approximation of the darkening and more accurate if we would multiply the base color with a low grayscale value.

We also force the vertex normal to point straight up of the wetness value gets above 98%. This convinces the player that the surface of the pool is flat like water.

float Remap(float input, float minimum, float maximum)
{
    return saturate((input - minimum) / (maximum - minimum));
}

float3 albedoSqr  = albedo * albedo;
albedo            = lerp(albedo, albedoSqr, Remap(wetness, 0.0, 0.35) * porosity);
roughness         = lerp(roughness, 0.1, Remap(wetness, 0.2, 1.0));
ao                = lerp(ao, 1.0, Remap(wetness, 0.45, 0.95));
normalTS          = lerp(normalTS, float3(0.5, 0.5, 1), Remap(wetness, 0.45, 0.95));
vertexNormalWS    = lerp(vertexNormalWS, float3(0, 1, 0), Remap(wetness, 0.98, 1.0));

References
#

The Technical Art of Uncharted 4
Physically based wet surfaces

Texture assets are from: Poly Haven