r/oculusdev • u/McgeezaxArrow1 • Nov 02 '23
Q3 Depth API - Accessing depth sensor data directly
Has anyone had success accessing the Q3 depth sensor data directly? I'm using Unity but any successful example would help.
With Unity, I'm currently looking at the code in https://github.com/oculus-samples/Unity-DepthAPI, specifically the EnvironmentDepthTextureProvider, to try and learn how to access the depth sensor data from the Q3.
I made a new script that calls the depth sensor setup/enable methods in Start(), and in Update() I call GetEnvironmentDepthTextureId and retrieve the texture, which does seem to be returning something with 2000x2000 width and height. I store it in a RenderTexture type script variable, and then created a new RenderTexture asset and set that as the RenderTexture for the script.
However when I try to make a Canvas with a RawImage and then set the texture to that RenderTexture, it just renders solid black. As a Unity/VR dev noob I'm a bit lost here and not sure where I need to look for the problem.
1
u/jayd16 Nov 03 '23
Are you sure its solid black and not simply a buffer of low values? The I think the depth texture will be in heterogeneous device space coordinates and not something set up to be displayed without more shader math.
1
u/Special_Yogurt_4022 Nov 03 '23
This guy did it right in the browser:
https://jasonharron.github.io/
I'm only getting my Quest 3 in a few weeks and am also interested in this issue. If anyone manages to find a solution, please write about it here
1
u/[deleted] Dec 28 '23
Hey OP did you ever manage to extract the depth data in a useful way? I would like to try this too to use the data to help set the height off the floor of an NPC in my Unity app, I'm not using the boundary/guardian/Scene model so can't use these.