Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question How to make only the contents of a canvas seen in the screen of Oculus Quest 2 ?

Discussion in 'VR' started by GerenMeric, Aug 24, 2023.

  1. GerenMeric

    GerenMeric

    Joined:
    May 15, 2023
    Posts:
    47
    Hi everyone,

    Inside a canvas i have a display screen that shows a video with a resolution 640 x 480 using RawImage inside Oculus Quest 2 with a size of 3664 x 1920, i am trying to get only the entire canvas with it's contents seen in the Quest 2. I have tried changing both Physical Camera settings and Canvas Scaler settings. In Physical Camera settings, when i try to set X and Y values of sensor size i can't actually target both X and Y at the same time to set it as 3664 x 1920. Instead, it changes X or Y regarding FOV Axis selected. On the other hand, when i try to use Canvas Scaler and set it to Scale with Screen Size, 3664 x 1920 and expand, the canvas and thus the content gets too big and i can't see the entire canvas. I have also tried changing Texture2D size as 3664 x 1920 inside the code where i take the video and apply it to the RawImage. But, it didn't make a difference. Am i missing something? Or is it impossible to make only the contents of the menu, or video in my case, seen and keeping everything in the canvas inside FOV at the same time? And Should i use OVROverlay instead?
     
    Last edited: Aug 24, 2023
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,846
    Might I ask why you don't use a world space canvas?
     
  3. GerenMeric

    GerenMeric

    Joined:
    May 15, 2023
    Posts:
    47

    Because, want to make the display stay on the screen. Just like camera space overlay. Besides, you can't do stereoscopic rendering in world space canvas anyway.
     
    Last edited: Aug 24, 2023
  4. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,846
    Child the canvas to the camera and it stays in view. Use overlay shader and it's rendered as overlay.

    Stereoscopic rendering definitely works in world space.
     
  5. GerenMeric

    GerenMeric

    Joined:
    May 15, 2023
    Posts:
    47
    Just tried world space canvas and something strange happened. On the left eye i saw left canvas and right canvases constantly flickering. On the right eye i couldn't see any canvases.
     
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,846
    Which unity version, render pipeline, and shaders are used
     
  7. GerenMeric

    GerenMeric

    Joined:
    May 15, 2023
    Posts:
    47
    Unity 2021.3.25f1 lts, built-in render pipeline and without any shader.
     
  8. GerenMeric

    GerenMeric

    Joined:
    May 15, 2023
    Posts:
    47
    Thanks. Just managed to get stereoscopic view. About the overlay shader do you mean setting materials of each UI element, images in my case, to overlay dynamic texture and then setting the shaders to UI/Default (Overlay)?
     
  9. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    4,846
    If that shader works, then sure. Otherwise look for a shader online.
    I've only done this with URP, so cannot help much
     
  10. GerenMeric

    GerenMeric

    Joined:
    May 15, 2023
    Posts:
    47

    Thanks for the suggestion. That shader and material i mentioned earlier didn't make a difference.