Stylized Unreal Water Shader (WIP)

Work in progress stylized water shader.

The goal is to layer multiple levels of displacement, and all be dynamic so as to play well with a weather or biome system.

Still screen-cap from in-engine. Note the stepped shadows and reflections

Completed so far

  • Flipbook displacement map workflow

  • Power and Scale controls on displacement to affect wave height

  • Direct scale control of displacement texture (value of 10 = texture is mapped to 10m in-world)

  • Normals recalculated after displacement

  • Automatic UV Offset (effectively a blur) before DDX/DDY check, and Normal Strength adjustments, allowing texture to be scaled at improbable scales without revealing pixels.

  • Linear interpolation between frames to play flipbook at any framerate. Looks good enough without the need for a flowmap flipbook.

  • Wind direction and wind speed affecting a Panner node.

  • NdotL function controls surface opacity to allow shadows to appear on the water surface.

  • Shadow NdotL is stepped and offset to allow for stylization of water surface

  • Normals are stepped after calculation to stylize the reflections.

Next, I am hoping to execute the following

  • Re-render flipbook at fewer frames to allow for a more crisp shape.

  • Pack cavity map into flipbook texture to control foam on crests

  • Use SDF boundaries to control sine-form concentric waves and foam against terrain and other objects on the water.

  • Project additional noise and offset along waves according to stored XY displacement from wave simulation

Animated result of normal and shadow controls

Animated result comparing different scales of Time and Size