IMPORTANT:

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible: https://developer.oculus.com/quest-pitch/

For additional information and context, please see "Submitting Your App to the Oculus Quest Store".
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Depth in shader (Unity)

I'm struggling to get depth in a shader to work on the Quest. I've tried using the following to calculate depth.
o.depth = -UnityObjectToViewPos(v.vertex).z *_ProjectionParams.w;
That works in the editor but not on device. I've also tried using CameraDepthTexture. This only works if I blit my shader in OnRenderImage, which kills performance. I asked about replacement shaders and custom post processing in this post (https://forums.oculusvr.com/developer/discussion/81234/replacement-shader#latest) and the advice here (and elsewhere) was don't on the Quest. So I'm trying to switch to an object based effect, but I need depth info from the camera, and I can't seem to get it to work on the Quest.  I'm pretty new to shaders so it's possible that I've missed something obvious.

N.B. I'm using the built in render pipeline in Unity 2019.2. If I am no longer using post processing, I could switch to the URP/LWRP. Is anyone using depth data in a custom shader in the URP/LWRP? Is it working on device?

Comments

Sign In or Register to comment.