Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong depth buffer is submitted to OpenXR #420

Closed
Rectus opened this issue Mar 8, 2023 · 6 comments · Fixed by #685
Closed

Wrong depth buffer is submitted to OpenXR #420

Rectus opened this issue Mar 8, 2023 · 6 comments · Fixed by #685
Labels
bug Something isn't working

Comments

@Rectus
Copy link

Rectus commented Mar 8, 2023

Looking at a render with RenderDoc, Open Brush is submitting the wrong depth buffer to the OpenXR runtime. Instead of submitting the actual depth buffer, it is submitting one with only the VR occlusion mask drawn.

It also doesn't use the occlusion mask in the main render pass. Instead it is drawn in a separate render pass onto a copy of the finished frame, which is then discarded.

Open Brush version: 2.1.0 Steam release
OS: Windows 10
VR headset: Valve Index

Rendered depth (scaled range)
depth_actual

Submitted depth
depth_submitted

@mikeskydev mikeskydev added the bug Something isn't working label Mar 8, 2023
@mikeskydev
Copy link
Member

Thanks a lot @Rectus! I think this may be a key part of some issues I was experiencing with passthrough on some platforms.

@Rectus
Copy link
Author

Rectus commented Mar 8, 2023

I was actually working on passthrough depth occlusion, and got confused why it wasn't working in Open Brush even though it submits depthbuffers.

@mikeskydev
Copy link
Member

Ohh that'd be sweet! I'll look at getting this fixed then I'd love to give that a shot.

@mikeskydev
Copy link
Member

@Rectus is there an app I can use to see in realtime what unity is submitting to the runtime? how did you produce the image showing the occlusion mask?

@Rectus
Copy link
Author

Rectus commented Jul 17, 2023

I used RenderDoc to capture the frame. It's a bit tricky to use with VR apps, since it doesn't directly capture the VR frame submission functions. It triggers on submitting the desktop window though, so it should still record all the graphics API calls the VR renderer, any OpenXR API layers, and the runtime does on xrEndFrame.

@mikeskydev
Copy link
Member

I've finally had time to investigate this properly:

The issue was coming from RenderWrapper.cs, where an offscreen render texture is created so it can be reused and rescaled for performance when using the video recording tools. I'm not entirely sure why this is breaking our XR pipeline, as it appears the render texture is created properly.

As a stopgap, we keep using the normal camera, but switch to the offscreen render during recording.

This may be magically resolved when we upgrade Unity versions, I've left TODOs to that effect. I'll close this issue and create a new one to track a proper fix.

See #685

image

@mikeskydev mikeskydev linked a pull request Apr 10, 2024 that will close this issue
mikeskydev added a commit that referenced this issue Apr 19, 2024
This is a partial fix for the issue discussed in #420

The issue was coming from RenderWrapper.cs, where an offscreen render texture is created so it can be reused and rescaled for performance when using the video recording tools. I'm not entirely sure why this is breaking our XR pipeline, as it appears the render texture is created properly.

As a stopgap, we keep using the normal camera, but switch to the offscreen render during recording.

This may be magically resolved when we upgrade Unity versions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants