Author Topic: Issue with depth aware liquid rendering in VR  (Read 168 times)

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Issue with depth aware liquid rendering in VR
« on: September 27, 2021, 08:39:59 AM »
I'm using various depth-aware no-flask liquids in my VR game, and it seems that the depth awareness in particular causes a strange culling-like behaviour in the peripheral vision of the VR camera. More specifically, it seems the liquid begins to disappear in the eye closest to the liquid first (e.g: when turning to the right as the liquid approaches the left of the vision, the liquid disappears in the right eye). It appears as though one eye views the liquid as depth aware while the other does not, and they alternate as you turn your head. I've tried poking around but truthfully I'm pretty clueless about shaders, so any help would be appreciated.

For more context, I'm using the original Liquid Volume v4.6.2 with Unity 2020.1.2f1, and SteamVR SDK v1.13.10. Screenshots are a little hard given that the problem is only really noticeable with the headset on, but I think this video sheds a little light. Notice the liquid level going down when moving the camera to the left, and back up when moving to the right.

Thank you in advance!

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #1 on: September 27, 2021, 09:27:07 AM »
Does it occur same in Multi and Single Pass Stereo?

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #2 on: September 28, 2021, 12:57:48 AM »
Enabling Single Pass (Instanced) actually brings on a slew of other problems. For the LiquidVolume specifically, no liquids render in the right eye, and in the left eye, each liquid has a duplicate floating somewhere on the screen. Screenshot below.

Funnily, the original issue still exists in the left eye (turning left makes a liquid slowly disappear from view before it's actually obscured by the container)

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #3 on: September 28, 2021, 08:22:45 PM »
Could you please confirm if the issue occur using the latest beta of today?

Also, please include a screenshot of a Liquid Volume component used in those scenes. Thank you.

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #4 on: September 29, 2021, 04:40:50 AM »
Thanks for the responses and that (very!) quick beta :) Unfortunately the issue persists, but I've done some additional testing/documenting to hopefully facilitate figuring out the issue.

I checked various of the asset's prefabs and found that the issue exists with all of them! Interestingly though, they disappear from the bottom up, rather than my custom assets in which the liquids disappear from the top down. I tried with both single pass instanced and multi pass rendering, and the same thing happened in single pass. I think the other issues I mentioned in my earlier post had nothing to do with Liquid Volume, as it happened with unrelated materials too. Unsure what the issue there on my end is.

I made a short video showing the issue from both eye's perspectives here, hopefully it helps :) For clarity, for each pair of liquids, the one on the left is not depth aware, while the one on the right is.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #5 on: September 29, 2021, 12:25:24 PM »
I think it could be related to the SteamVR plugin. I've tested it on the Quest 2 using the Oculus Integration Plugin and OpenXR and it seems to run fine (Unity 2020.3.19f1) in both Multi-Pass and Multi-View modes. I'm sending you a copy of the project by pm so you can test it as well and we can work around it to build a repro.

You mentioned that Single Pass breaks completely the visualization. Does it happen with an empty scene as well? If so, please report a bug to Unity as well.

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #6 on: September 30, 2021, 08:40:56 AM »
Interesting development here. I updated every XR-related asset in my project, as well as the Unity version. Trying the project you sent me, everything worked flawlessly--the issue wasn't there.

Opening back up my project, the problem persisted still, so I did some extra testing and I believe the problem is related to proximity to a mesh. If I remove the liquid from the containers I made, the problem stops. I think this video will demonstrate what I mean.

Notice also how the green liquid closer to the counter begins disappearing from the bottom (i.e the part closest to the mesh of the counter). Similarly, the handle of the pitcher begins showing through the liquid placed over it.

Fortunately, somewhere along the line (probably when reinstalling the XR tools), Single Pass rendering started working again. The problem is present with it too, though :(

Thanks again for your diligence

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #7 on: September 30, 2021, 08:46:39 AM »
I realized after posting that I didn't acknowledge that it does in fact work fine in the project you sent me, so clearly something is wrong in my project in particular. Feel free to disregard until I do some more playing around to figure out exactly what could be happening differently. It's far past my bed time, but I'll try and pick it up again tomorrow and update when I hopefully figure it out.

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #8 on: September 30, 2021, 08:57:08 AM »
Sorry for the spam, one more update. I managed to recreate the issue in the project you sent me, so perhaps the issue isn't with my project? I'm not sure if I simply have to change the way I have my liquids placed in their respective containers (crossing my fingers not!), but the (depth-aware) liquids seem to consistently recede from meshes as the camera turns.

Here's another video with a cheap demonstration of what I'm talking about. The liquid disappears into the cube as the camera turns.

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #9 on: September 30, 2021, 09:11:57 AM »
Are you using "Irregular topology"? Try setting the "Double Sided Bias" to 0 under the Advanced section. If that doesn't change anything, please update the project I sent to you and send it back to me so I can figure out what's the reason. Thanks!

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #10 on: October 01, 2021, 06:28:43 AM »
It seems the topology doesn't make a difference. I've tried cylindrical, irregular, and parent-aware irregular, and they all exhibit the same bug when set to depth-aware. I haven't changed too much in the project you sent me, besides importing SteamVR and adding one of the liquids from my own project. Is there anything in particular you'd like for me to include to help you out?

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 7361
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #11 on: October 01, 2021, 10:05:19 AM »
So the issue only occurs when the depth aware option is enabled?

EDIT: I have reproduced the issue and sent a bug report to Unity. I'll get back to you as I get some response.
« Last Edit: October 01, 2021, 07:52:39 PM by Kronnect »

Ryan722

  • Newbie
  • *
  • Posts: 8
    • View Profile
Re: Issue with depth aware liquid rendering in VR
« Reply #12 on: October 04, 2021, 01:31:06 AM »
That's right, only with depth aware enabled! I'm tentatively happy to hear the issue is neither on my end nor yours, hopefully Unity will be able to suggest a fix or send one out sooner rather than later.

Thank you once again for your continued diligence in helping solve this problem! Let me know if there's anything else I can do to help :)