I’ve seen tons of questions and discussion related to finding how to calculate terrain water wave height. However, as far as I can tell nobody has actually got it working perfectly and without any hiccups.
I wanted to create this thread to get some discussion going towards solving this once and for all as a quick search will tell you a number of people are interested in this.
However, before getting into that I want to review a few useful things that have already been found. My hope is that this gets us all on some baseline level of knowledge.
The first bit of knowledge is this tweet:
I was able to reproduce it by adjusting the formula slightly:
1.8 * math.sin(TAU/85 * x + PI2) * math.sin(TAU/85 * z)
Note that this only seems to work with
Terrain.WaterWaveSize = 1
The second bit of knowledge comes from this post:
A lot of useful stuff here, but definitely not 100% accurate and even if it was, it has a weird clause where you have to load in with wave speed at zero. Also, much like the first example it only seems accurate for certain values.
You can see examples of both these techniques in this place file:
Terrain water.rbxl (26.3 KB)
The last useful thing I’ve seen was tipped off to me by @Maximum_ADHD. If you look in the shader.pack files with a text editor you can find some machine generated shader code.
It’s not easily readable, but it may help us figure out some small details we would have had to guess otherwise.
So I guess here’s a summary of things that need to be solved:
WaterWaveSpeed = 0can we find the height at any
zcombo for any
- Using @blobbyblob’s technique can we solve for when values of
WaterWaveSpeed > 0?
- Is it possible to move away from blobby’s technique of forcing us to load in with
WaterWaveSpeed = 0?
Number 3 may not be possible, but given what people have solved thus far I think 1 & 2 should be possible.