Skip to content
Procedural water shader for general use.
HLSL ShaderLab C# Batchfile
Branch: master
Clone or download
Latest commit 5370b57 Aug 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
screenshots updated preview image Aug 15, 2019
scripts some code cleanup Dec 17, 2017
shaders some code cleanup Dec 17, 2017
textures initial release Dec 14, 2017
.gitattributes Initial commit Dec 13, 2017
LICENSE Initial commit Dec 13, 2017
README.md updated preview image Aug 15, 2019

README.md

Procedural Water

A procedural water shader, multi platforrm support(Unity, GLSL, HLSL), for a variety of water types.

water-main

Features

The water shader is designed for various water types: lakes, ocean and rivers.

Current implemented features are:

  • multiple maps(height, normal, shore, sky)
  • configurable refraction and reflection
  • colour extiction based water depth
  • mean sky radiance
  • displacement
  • enabling/disabling features
  • bicubic filtering
  • configurable shore foam
  • HLSL/GLSL/Unity support(for GLSL use the conversion script to SPIR-V)

Usage

The shader requires refraction and reflection maps of the scene, the refraction map also requires the depth. See the textures folder for examples of sky, shore, foam, height and normal maps.

Certain features can be switched off via the following defines:

  • USE_DISPLACEMENT, adds displacement of gerstner and sinve waves, with an additional height map
  • USE_MEAN_SKY_RADIANCE, adds mean sky radiance reflectance, requires a sky map
  • USE_FILTERING, enable/disable bicubic filtering
  • BLINN_PHONG, use simplified specular

Preview

video

water-prev1

Composition of the water(final, shore, refraction+depth colour, reflection + distortion, diffuse + ambient, normals): water-layers

water-settings

Future improvements

Planned improvements are:

  • caustics
  • underwater mode with light rays
  • cascading depth maps
  • improved water displacement/simulation(FFT)

Contributing

Based on:

Bug reports and pull requests are welcome on GitHub at https://github.com/tuxalin/water-shader.

License

The code is available as open source under the terms of the MIT License.

You can’t perform that action at this time.