wave-harmonic / crest

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

Foam does not respect floating origin on Y axis #1156

Open Revmatek opened 2 months ago

Revmatek commented 2 months ago

Is there an existing issue for this?

Have you checked the documentation to resolve your problem?

Current Behavior

Negative values below -1000 cause foam to appear constantly.

Expected Behavior

Foam should appear normally at any Y value (or at least with any floating origin Y)

Steps To Reproduce

1) Open the BoatWakes scene 2) Lower the Ocean GameObject to Vector3(0, -1000, 0) 3) Observe foam everywhere image

Unity Version

2021.3.26

Crest Version

4.19

Render Pipeline

Built-In

Editor or Standalone

Editor (Edit Mode), Editor (Play Mode), Standalone

Environment

No response

Anything else?

This seems to be broken for floating origin support. Seems to be related to k_DepthBaseline / CREST_OCEAN_DEPTH_BASELINE. It is unclear if increasing those values is a viable short term solution.

daleeidd commented 2 months ago

Thank you for reporting. Can you please test the linked PR below?

Revmatek commented 2 months ago

Thank you for reporting. Can you please test the linked PR below?

Will do.

Revmatek commented 2 months ago

Thank you for reporting. Can you please test the linked PR below?

Thanks!

It seems to be working as far as I can tell.

I did also test with underwater transparency briefly (seems fine), but I have not integrated that yet because I have extra work for above water transparent objects in my backlog related to that (clouds, particles, etc.).

Comments

I would double check every y usage, not just for this changeset, the whole baseline. Anything that has a default y value of any kind should problably initialize to the floating origin offset Y instead of 0 or some other constant. I had many spots in my code I had to fix for this because I had not initially intended to support it, but later extended the skybox. For example someY = 0, 1000, 100, etc. 0 may actually be -1000 or something with the offset. Even if it does not cause problems it may be better for consistancy to init to the correct value and in the event that default value is used it will not be 0 when it should be -1000 with the offset.