wave-harmonic / crest

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

Make Ocean Depth Cache depth relative #1116

Closed daleeidd closed 1 year ago

daleeidd commented 1 year ago

If a baked depth cache is moved after baking, the depth will be incorrect. This solves that by making the depth relative to the transform. Now it can be moved providing the contents (terrain etc) are also moved with it.

To avoid breaking current depth caches, this is only applied to new ODCs or after hitting Save cache to file. There is an edge case which will break existing baked depth caches where a user swaps out a relative baked depth cache texture for a non relative one which can be solved by simply re-baking.