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

VR underwater mask is incorrect #620

Open
alandtse opened this issue Oct 10, 2024 · 1 comment
Open

VR underwater mask is incorrect #620

alandtse opened this issue Oct 10, 2024 · 1 comment
Labels
bug Something isn't working VR VR only issue

Comments

@alandtse
Copy link
Collaborator

alandtse commented Oct 10, 2024

This is a vanilla bug.
As demonstrated by this picture, there is a mask that is being rendered that is incorrect in two ways.
image

  1. The angle of the mask does not match the water surface.
  2. It isn't stereo aware and applied across the entire image so there is an eye mismatch.

This is the mask generated by ISUnderwaterMask via water.hlsl.
image

I have confirmed that this is only generated with partial submersion. Full submersion uses a different effect without a mask.

Here are the vertex meshes for the mask in Flat:
image

and in VR
image

@alandtse alandtse added bug Something isn't working VR VR only issue labels Oct 10, 2024
@alandtse
Copy link
Collaborator Author

alandtse commented Oct 10, 2024

The issue seems to be the underwater mesh is not a flat plane but two triangles that are not perfectly flat. The issue is that because of the fact there are only 6 vertexes, the triangle gets culled and results in a the break in the mask.

One alternative may be to build the mask with the depth buffer. During partially submerged scenes, the water line looks to be where the depth goes near 0 (but not 0). The air and water below and above quickly increase in depth. It may be possible to use that depth stencil to decide the water line. We could then put a mask below that water line (of course their is a question of determining up vs down but we can probably assume down is underwater).
image

In one example, the gradient waterline pixel is depth 0.00258, and immediately below it in the water, the depth goes to .994262.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working VR VR only issue
Projects
None yet
Development

No branches or pull requests

1 participant