Gerstner Wave implementation

Did an implementation of Gerstner Waves from Gpu Gems for nice looking water surfaces. Uploading the Unreal materials for free here:

Gif: https://thumbs.gfycat.com/FineWhisperedAnophelesmosquito-size_restricted.gif

This is basically only the waves (offsets + normals), no translucent water material or anything (there seem to be other very nice ongoing projects for that like the community Weather & Ocean shader). Hopefully this can come in handy as a nice simple reference for someone trying to implement gerstner waves - I couldn’t find any complete implementation online when trying to figure out some trouble I had with the normals.

The zip includes a material function for calculating a single gerstner wave + normals, and also one for creating and combining four waves, plus some example materials and a simple scene.

Suggestions for improvements would be welcome, the gerstner wave material function itself for example is a bit messy. I think the math is basically correct, anyway it looks that way :slight_smile: Not completely sure about the “speed from wavelength”-calculation.

Link for the math and other nice info: Chapter 1. Effective Water Simulation from Physical Models

Absolutely thank you!!!