Wet Surface Shader (UE4)

I’ve been working at re-implementing (and refactoring) my Unity wet surface shader in Unreal Engine 4 – which in itself was based on work by Sébastien Lagarde.

In addition to his research, I added in some parallax occlusion mapping, that works with the water pooling, in order to give it more depth.

I was also researching various ways to get cascading water droplets across the vertical surfaces (as the ripples and pooling only work on up-facing surfaces) and came across Taizyd Korambayil ‘s blog.

His approach to the cascading water was pretty cheap, but it didn’t work so great with Sébastien’s ripple implementation, so I also implemented his ripple solution (which was also cheaper). That said, I found his Ripple Fade section completely redundant as I could get the same time/sample offset trick using the already calculated 1-frac(Time*RippleSpeed) value.

The other issue of course is that cascading water will only cascade over non-porous or completely saturated surfaces. So I modulate the cascading water by the porosity maps that are required for my implementation of Sébastien’s work.

So what exactly does this shader do that the other two don’t?

  • It takes Sébastien’s research into the modification of the underlying albedo, specular and roughness values
  • Adds in POM, makes the pooling only happen in up-facing areas
  • Combines that with Taizyd’s cheap cascading water & ripples (properly masking out all metallic/roughness/albedo/normal values on the way)
  • Modulates cascading water by porosity

It’s essentially a “complete” solution that can take any dry surface, create a porosity mask and you can dry out/soak a surface to any value and watch it cascade or pool, depending on its orientation.

Wetness/Pooling Values Demo
Water Cascading Demo

Leave a Reply

Your email address will not be published. Required fields are marked *