oculus-samples / Unity-DepthAPI

Examples of using Depth API for real-time, dynamic occlusions
Other
192 stars 24 forks source link

Occlusion Lit URP shader not occluding #11

Closed maddievision closed 10 months ago

maddievision commented 10 months ago

I think there might be a bug with the Lit URP shader where occlusion does not seem to work on it at all. This only seems to be an issue on URP because the Occlusion Standard BiRP shader works fine on a BiRP project.

Here's an example video. I'm using a Quest 3. The cube on the left is using URP Occlusion Lit shader, and the cube on the right is using URP Occlusion Unlit. You'll see the occlusion only works on the unlit cube.

https://github.com/oculus-samples/Unity-DepthAPI/assets/327893/7975eab1-99a1-404a-b62f-7dc1f0c79873

I'm on the latest versions of the Depth API and Depth API URP support packages, and have 4.2.0-exp-env-depth.1 of the Oculus XR plugin.

Screenshot 2023-11-20 at 00 38 43

I have the EnvironmentDepthOcclusion prefab in the scene.

Screenshot 2023-11-20 at 00 39 04

I also have the OVRSceneManager prefab in the scene with a Global Mesh having a shadow receiver. I also tried using the Selective Passthrough shader on the Global Mesh and that doesn't solve the issue (the Selective Passthrough shader in general doesn't seem to work in URP, but I believe that's a separate issue, since Depth API should be able to do occlusion regardless if I'm understanding right?)

Screenshot 2023-11-20 at 01 44 35

And all PST checks pass as well!

TudorJude commented 10 months ago

Hey maddievision,

Sorry for the late reply. This does seem odd, since the URP samples use the Lit occluded shader and it works. Could you please also double check that you have the right material with the right shader on the cube again?

Since one of your cubes is occluding that means that your setup is correct, it just seems to be an issue with that particular item.

Thanks for all the feedback.

BogomilP commented 10 months ago

Hey maddievision,

Could you possibly provide a sample scene or project to test on?

I have tried to replicate your scenario on my own project and everything is working as expected on my Quest 3.

I have used the same packages and setup as mentioned above and my Occlusion Lit shader for URP works at the same time as the unlit.

Maybe there is something else causing a conflict in your project.

maddievision commented 10 months ago

The occlusion in the URP sample in this repo does indeed seem to work for me. If I try to bring those assets into my project, they don't. I've been trying to work out the delta between project settings that might be causing my project to act unusually. And through that I've managed to get the occlusion to work but I have another issue now where Lit and Occlusion Lit materials are now half transparent.

If I get a chance I may try to strip my project down and really figure out the root cause of the issues. For now, I think I will use the opportunity to just export things and start over, maybe using the URP sample project as a basis, as I'm now pretty sure it's an issue with my project setup. Wouldn't surprise me as it's gone through a lot of changes like conversion from BiRP -> URP.

Thanks for looking at this on your end, and apologies for the false alarm! Feel free to close this out.

TudorJude commented 10 months ago

This feature is still work in progress, so who knows what corner cases we may have missed. Thank you for the feedback and please keep us posted in this thread.

TudorJude commented 10 months ago

Closing this thread due to inactivity. If you experience more issues, kindly create a new thread.