Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

3D Skyboxes in the Oculus Rift...!

Discussion in 'VR' started by Reverend-Speed, May 4, 2019.

  1. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    I'm looking to build a 3D skybox for a client's Oculus Rift project. I've done a little work with 3D skyboxes before, but I'm kinda new at the Oculus and I don't have a headset on my development machine to check my work.

    Can anybody suggest what sort of cameras I should be changing the culling flags on, the rate of rotation, etc?

    Best regards,

    --Rev
     
    Last edited: May 4, 2019
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    The only special thing you need to do differently than the traditional 3D skybox setup is have your skybox camera be a child of a game object that’s been scaled to be relative to the the skybox’s scale. I believe all XR cameras in Unity now use their parents’ transform space to move in.

    So skybox camera set to depth -1, place a gameobject at the center of the skybox scaled down to 0.0001 or something, set the layers to only render the skybox. Then have your main camera set to clear depth only, and not render the skybox.
     
  3. Reverend-Speed

    Reverend-Speed

    Joined:
    Mar 28, 2011
    Posts:
    284
    That's VERY helpful, @bgolus , thank you!

    --Rev
     
  4. Innovine

    Innovine

    Joined:
    Aug 6, 2017
    Posts:
    522
    At what distance does the engine start to render 3d stuff in mono? From what I remember, ue4 does it at about 700m, so anything beyond that doesn't need to be 3d, it get optimized to mono. Does unity do the same?
     
  5. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    12,329
    Hybrid mono rendering. It was an optional, configurable thing in UE4 that was meant for use with mobile and has since been removed. Also, the default was 750 centimeters, not 700 meters, since Unreal’s default unit scale is measured in centimeters unlike Unity’s default of sorta-kinda meters.

    Unity never implemented this feature natively, though Oculus released a prototype with it working using c# scripts in the asset store. Personally I always thought it looked bad; it was obvious to me that there was a big, flat wall in the distance unless it was pushed out to ~1500 meters, at which point the benefits were less obvious. However I guess it could be repurposed for this situation. It would take a little more work to setup though as you’d need to render to a mono render texture and then blit to both eyes with slight offsets. Also I’m not sure if the asset is still on the store anywhere. Even if it was, it might not work anymore since they’ve changed so many things related to VR/XR settings and render textures in XR since it was released (unity 5.6).