wave-harmonic / crest

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

Local / movable spectrums or crest shapes #1122

Closed Danon5 closed 1 year ago

Danon5 commented 1 year ago

As far as I know, there is no way to currently have a movable crest shape (or spectrum) that can be blended into by some distance function. This would be required for something like localized weather effects that change the wave height, frequencies, etc. Sea of Thieves uses something like this for their storm that moves around the map. I believe it just uses a 2D radius around a point to blend from the standard wave parameters into the storm wave parameters.

The reason that you cannot just blend into different ocean parameters based on the player's location in the world is that it would change the entire ocean. For multiplayer games, this would be unacceptable. Even in singleplayer games you wouldn't be able to see a distant storm's wave height with this approach, for example.

Is this something that already exists and I have somehow missed it? If not, is this something that is reasonable? Or would it require a large rewrite.

daleeidd commented 1 year ago

You have missed it. It's covered in examples and documentation

Danon5 commented 1 year ago

You have missed it. It's covered in examples and documentation

If the "Waves Patch" example is what you are talking about, that is an entirely directional approach. How am I meant to do this with a radius and an easing blend? Am I supposed to manually place spline points in such a way that emulates a circle? I don't think so, because doing that affects the wave direction (makes all waves aim inwards or outwards). I simply want to blend from one wave preset to another within a radius, with falloff. With a spline, the falloff takes the wave direction into account and can therefore not be used to achieve the blending I want, as it was clearly designed for shorelines—as mentioned in the documentation.

If you instead mean the "Scale Waves" example, the wave scale factor is a slider from 0 to 1, meaning I could not use it to increase the waves within a region—only decrease.

daleeidd commented 1 year ago

I see. Have you tried the following? It might be workable for your use case. https://crest.readthedocs.io/en/stable/user/waves.html?highlight=spectrum#wave-placement

It is kind of a new feature so let me know how you go with it.