Forum Discussion
thomas.ratliff.9
1 year agoMeta Employee
How can I display hands over OVROverlay?
I am using the OVRCanvasMeshRenderer script to display a curved canvas using OVROverlay. Using this for a spatial web browser, and OVROverlay provides the best visual clarity.
Problem is that the canvas now displays over everything. I cannot figure out a way to mask the hands to display over the canvas. I read a few posts that suggested enabling XR Depth Submission, and this makes no difference. Is there an example of how to go about this anywhere?
Using Meta SDK V 62 on Unity 2022.3.11
5 Replies
Replies have been turned off for this discussion
- ScienceFictionMethodStart Member
Did anyone find an answer to this?
- lau.maggStart Partner
Hey, I am also trying to figure this out! This is my current setup:
- Created an extra camera (HandsOnlyCamera) as a child of the CenterEyeAnchor:
- same projection settings as the Main Camera.
- renders only HandRig Layer
- writes a HandsRenderTexture (Output Texture).
- Created a quad with OVR Overlay script also as a child of the CenterEyeAnchor:
- Overlay type
- layerPriority 0
- Renders HandsRenderTexture
- Main XR Camera ignores HandRig layer
- Hand meshes have HandRig layer
- The UI Overlay is set to the Overlay type with layerPriority 1 (renders behind 0)
My problem now is though that the hands look way too big. That is probably because of a mismatch in the Render Texture or the scale of the Quad. I haven't found out yet the right setup. Let me know if you try!
- lau.maggStart Partner
Hello again, I managed to fix it with this script that ensures that the camera for the hands has the same projection matrix as the main camera and that the render texture and the overlay quad have the correct scale:
using System.Collections; using UnityEngine; public class HandsProjectionSetter : MonoBehaviour { [SerializeField] RenderTexture handsRenderTexture; [SerializeField] Camera handsCamera; [SerializeField] OVROverlay handsOverlay; void Start() { handsCamera.projectionMatrix = Camera.main.projectionMatrix; StartCoroutine(DelayRTChange()); } IEnumerator DelayRTChange() { yield return new WaitUntil(() => UnityEngine.XR.XRSettings.eyeTextureWidth > 0); // Scale texture to match eyes handsRenderTexture.Release(); handsRenderTexture.width = UnityEngine.XR.XRSettings.eyeTextureWidth; handsRenderTexture.height = UnityEngine.XR.XRSettings.eyeTextureHeight; handsRenderTexture.Create(); // Assign new texture to overlay and camera handsOverlay.textures = new Texture[] { handsRenderTexture, handsRenderTexture }; handsCamera.targetTexture = handsRenderTexture; // Scale overlay from projectionMatrix (m11 = [1, tan(vFOV/2)]) Camera mainCamera = Camera.main; float vFov = 2f * Mathf.Atan(1f / mainCamera.projectionMatrix.m11); float h = 2f * 1f * Mathf.Tan(vFov * 0.5f); // at 1 m float w = h * mainCamera.aspect; handsOverlay.transform.localScale = new Vector3(w, h, 1f); } }Hope this helps, good luck!
[I am using Unity 6000.1.5f1, Meta SDK v78, OpenXR 1.14.3]
- Created an extra camera (HandsOnlyCamera) as a child of the CenterEyeAnchor:
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 6 months ago
- 1 year ago