wave-harmonic / crest

A class-leading water system implemented in Unity
MIT License
3.5k stars 478 forks source link

Tearing on lake with spline waves above sea level #864

Closed daleeidd closed 3 years ago

daleeidd commented 3 years ago

Describe the bug User eckhart3d reported tearing on the ocean surface. Their setup is a lake which is ~40m above sea level (~251m). It only occurs when a ShapeGerstner is used with a spline so the waves themselves cause tearing.

Screenshots / video 1 2

Versions

To Reproduce TODO: Need to reproduce it myself first.

Additional context Setting the lake to sea level solved the problem for them. I think also setting the sea level to zero also solves the problem. But investigating the issue may be worth it. Not sure if this HDRP specific.

huwb commented 3 years ago

The final local water body change will store the sea level in a channel, because the precision of half floats dies quickly with large values. A y displacement of 40 might be sucking out all the precision. I'm not certain that this is the issue, but hacking the texture type to be floats may be a hacky fix, or test at least.

daleeidd commented 3 years ago

Turns out it was precision and increasing precision from 16 to 32 solved it. Going to add the texture format as an option. For anyone wanting this now, change R16G16B16A16_SFloat to R32G32B32A32_SFloat in the following: Crest/Crest/Scripts/LodData/LodDataMgrAnimWaves.cs

daleeidd commented 3 years ago

4.13 will have an option to change the texture format for increased precision to solve this problem.

daleeidd commented 3 years ago

4.13 is out which solves this issue.