Search Unity

Optimal Skybox for Mobile VR Oculus Quest/Go/GearVR

Discussion in 'VR' started by ROBYER1, Nov 6, 2019.

  1. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    What's everyone else using for a mobile Skybox on Oculus Quest?

    In the developing for Android guidelines from Oculus it says

    "Avoid Unity’s Default-Skybox, which is computationally expensive for standalone. We recommend setting Skybox to None (Material), and Ambient Source to Color in Window > Lighting. You may also wish to set Camera.clearFlags to SolidColor (never Skybox)."

    https://developer.oculus.com/documentation/quest/latest/concepts/unity-mobile-performance-intro/
     
  2. kilogold

    kilogold

    Joined:
    May 28, 2013
    Posts:
    9
    Gonna necro this, because it's an obvious thing that turns out not to be so obvious.
    Going with a 6 Sided Shader means binding 6 different textures to the graphics pipeline. We can atlas the whole thing, but there doesn't seem to be an out-of-the-box shader for such a thing...

    I'm interested in hearing other people's suggestions.
     
    ROBYER1 and JoeStrout like this.
  3. kilogold

    kilogold

    Joined:
    May 28, 2013
    Posts:
    9
    FWIW, we opted for simply modeling our own inverted cube, and laying out our own UVs.
    We atlassed the texture and simply anchored it to the camera.

    What's left is to play with the render order to ensure it's last opaque element to draw (we are using Forward Renderer in VR).
     
    ROBYER1 and DanDan_VrMAN like this.
  4. DanDan_VrMAN

    DanDan_VrMAN

    Joined:
    Nov 1, 2016
    Posts:
    4
    Hi KiloGold, Your solution sounds amazing! I'm trying to do just that, but can't get a shader which I can put on my inverted cube which will be rendered first.. Render Queue won't work. Any ideas??
     
  5. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    I wonder if messing with the render queue and everything else is just as unperformant as just using Unity skybox instead? For now I'm just using the Unity Skybox, it wasn't a huge problem for us.
     
  6. liam_unity628

    liam_unity628

    Joined:
    Mar 10, 2020
    Posts:
    7
    For Quest, I am using a small 100 vert sphere mesh (as opposed to the default 5k Unity one) with a slightly tweaked unity panoramic skybox shader and it's working well for me. I draw it in it's own call after opaques and before tranparents using a buffer.DrawMesh().
     
    gjf and JoeStrout like this.
  7. gjf

    gjf

    Joined:
    Feb 8, 2012
    Posts:
    53
    Can you share the shader? Thanks in advance.
     
  8. liam_unity628

    liam_unity628

    Joined:
    Mar 10, 2020
    Posts:
    7
    It's just the default Unity one with
    posWorld += _WorldSpaceCameraPos; 
    added so it moves with the camera. Think the SRP APIs .DrawSkybox() method does it CPU side so you have to alter the shader a bit to get it working with a .DrawMesh() call instead.
     
    ROBYER1 likes this.
  9. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
  10. Jonas-Neuston

    Jonas-Neuston

    Joined:
    Jun 10, 2017
    Posts:
    70
    You might be interested in this:

    Skybox Performance Measurements on Oculus Quest

    • CPU/GPU level set to 2
    • Unity 2019.4.5f1
    • Built-in Standard render pipeline
    • Single Pass stereo mode
    • Development Mode
    No skybox (camera clears with color):
    • Looking at wall that fills entire screen: GPU ~5.4ms.
    • Looking straight up into the sky: GPU ~4.3ms.
    Skybox/Cubemap (exposure 1, rotation 180):
    • Looking at wall that fills entire screen: GPU ~5.2ms.
    • Looking straight up into the sky: GPU ~4.3ms.


    The test is not perfect, as the head transform is not guaranteed to be exactly the same. But my takeaway is that a simple cubemap skybox is very cheap on the Oculus Quest.
     
    Last edited: Aug 25, 2020
    davidandrade89 and ROBYER1 like this.
  11. samueljonasson

    samueljonasson

    Joined:
    Apr 19, 2012
    Posts:
    7
    Do you know of any shader for a stereoscopic skybox that would work on Oculus Quest?

    I have been toying with this one without success:
    https://medium.com/@mheavers/implem...x-into-unity-for-virtual-reality-e427cf338b06

    I can't get it to render correctly. I have a stacked image so I did split it into two separate images and then apply them separately to the material. I get a decent result when I apply the same image on both eyes - but then it isn't stereo so I could just as well use a normal skybox.