oculus-samples / Unity-DepthAPI

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

Occlusion for sprite renderer (without canvas) #62

Closed Squashi11 closed 3 weeks ago

Squashi11 commented 1 month ago

Hello , is there any way to make occlusion work for standalone Sprite Renderers without a canvas? using too many canvases can be demanding . Thanks image

TudorJude commented 1 month ago

I would start here. This shader seems to be the sprite renderer shader from Unity, but I can't quite tell for sure. You can find all of Unity's shaders on github if you search for a bit.

Then, apply the shader changes as in the docs.

Squashi11 commented 1 month ago

Hey , sorry for replying so late but the reason my occlusion didnt work was because of wrong rotation of my quad. So all good now. But a new problem I noticed started when I tried using panel for occlusion instead of a quad with a mesh collider for my raycast. The OVR Raycaster and input system for VR just doesnt work with the panel occlusion, even with raycast target turned off, it works just fine when I completely disable the panel with an occlusion material, of course I am at Unity 6 so that might be the reason for the strange behaviour

TudorJude commented 1 month ago

I am not that familiar with the OVR Raycaster, but does the occlusion material panel have any collider on it?

Squashi11 commented 1 month ago

No, the panel does not have any collider attached to it. I was using quad with a mesh collider just so my custom raycast script was detecting it , the OVR Raycast does not depend on colliders as far as I know. And the canvas panel component cannot have a mesh collider attached to it as it needs a mesh to work and panel is just an UI element. Of course the panel was always at the bottom of the hierarchy for occlusion to work properly, but then the input system stopped working for some reason.

Squashi11 commented 3 weeks ago

Occlusion works as expected thanks, but OVR Input System Gets blocked by a panel so I need to keep using quad