Below the told WIP post:
The last few months I have been working on a water shader, mainly to learn shader programming. All my work has been focused on getting a realistic surface motion. I’m now at a point where the surface is starting to look liquid enough for my taste.
Since I don’t have a real use for the shader, I want to make it available on the Marketplace once it’s finished.
For the next video, I replaced the water material in the Vehicle Game example with my water shader:
I use the JONSWAP wave spectrum to generate parameters for Gerstner waves. The user needs to provide two parameters as input: Wind speed and fetch. From these parameters, the corresponding JONSWAP spectrum is created and used to sample Gerstner wave parameters (this part is not implemented outside of UE4). The list of wave parameters is imported into UE4 and used as input for the Gerstner equations.
The advantage of this approach is that you automatically get physically correct Gerstner wave parameters. No matter which wind speed and fetch you chose as input, you will always get a good looking surface motion.
I’ve implemented the dispersion relation for gravity-capillary waves, so it is possible to generate large ocean waves or small capillary waves with wavelengths of millimeters or anything in between. The motion will always be correct.
Is anyone interested in having this released?
I think I can provide an ocean surface that works out of the box. Just place it in your map, set the values for wind speed and fetch and you will get surface motion like you see in the video above. There is still a lot of work to do, but I think it can be done.
To do / feature list:
- Automatic buoyancy for simple objects DONE
- Automatic buoyancy for arbitrary objects DONE
- Read Gerstner wave parameters from csv file DONE
- Generate library of csv files with wave parameters for different combinations of wind speed and fetch length DONE
- Make the water plane follow the camera to simulate an infinite ocean DONE