Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Foam does not respect floating origin on Y axis #1156

Open
2 tasks done
Revmatek opened this issue Aug 8, 2024 · 3 comments · May be fixed by #1157
Open
2 tasks done

Foam does not respect floating origin on Y axis #1156

Revmatek opened this issue Aug 8, 2024 · 3 comments · May be fixed by #1157
Labels
Milestone

Comments

@Revmatek
Copy link

Revmatek commented Aug 8, 2024

Is there an existing issue for this?

  • I have searched the existing issues.

Have you checked the documentation to resolve your problem?

  • I have read the linked documentation and could not resolve my issue.

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 daleeidd added this to the Next milestone Aug 14, 2024
daleeidd added a commit that referenced this issue Aug 14, 2024
Fixes incorrect depth values when away from zero, and greatly simplifies
everything. Caution must be taken as infinity can cause issues.

Water depth sampling had to be moved to the fragment shader, as it had
artifacts possibly from interpolation.

Additionally, improved fading out of shallow SSS towards the end of
cascades.
@daleeidd
Copy link
Collaborator

daleeidd commented Aug 14, 2024

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

@daleeidd daleeidd linked a pull request Aug 14, 2024 that will close this issue
@Revmatek
Copy link
Author

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

Will do.

@Revmatek
Copy link
Author

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

  • CREST_OCEAN_DEPTH_BASELINE is no longer used?
  • Example FloatingOrigin / ShiftingOrigin script could be updated to include y-axis.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants