Search Unity

Other [Solution] Oculus Quest 2 Contrast Fix for Dark Scenes

Discussion in 'VR' started by Kennosuke, Oct 29, 2020.

  1. Kennosuke

    Kennosuke

    Joined:
    Jun 29, 2018
    Posts:
    16
    For anyone that has used or developed for the Oculus Quest 2, you may have noticed that the LCD (instead of OLED) screen in the Quest 2 has a lack of contrast in dark game environments. A game I am developing in Unity, for example, is quite dark, which amplified this to be an actual problem rather than an inconvenience.

    Well, I stumbled on to a fix. I put a UI panel in front of the VR camera (Screen Space - Camera) with the following Color settings (0.6f, 0.6f, 0.6f, 0.0039f) which equates to a medium gray panel at 0.0039% opacity. For some reason that I haven't quite figured out why, looking through this faint panel has restored dark contrast to levels similar to my HTC Vive.

    So, if anyone else needs to be able to see a certain level of detail in dark environments in a Unity game, that might help.
     
    darkesco and JoeStrout like this.
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    That is interesting, strange, and useful. Thanks for sharing it!
     
  3. darkesco

    darkesco

    Joined:
    Mar 19, 2015
    Posts:
    61
    Definitely trying this. My scenes are underground and this will help. Thank you.
     
  4. Geist2501

    Geist2501

    Joined:
    Jun 29, 2019
    Posts:
    25
    Sound like that will be a total fill rate killer though - so keep that in mind. Sometimes you have to take that hit for the benefits necessary, but you know. Don't be surprised if your fps tank - would be great if there would be another solution. I guess testing a hard coded, minimal color grading shader would be worth it - i see about that once i get to darker parts in my game...
     
    darkesco likes this.
  5. darkesco

    darkesco

    Joined:
    Mar 19, 2015
    Posts:
    61
    Good point, I wouldn't use screen space. I would create a 3d plane and parent it to the front of the camera. I use shader graph so I have to manually edit the ZTEST tag, but I've done it for all my UI elements.
     
  6. Geist2501

    Geist2501

    Joined:
    Jun 29, 2019
    Posts:
    25
    Whether you use a 3d space overlay (hovering over each camera lens) or a screen space overlay will not change anything about the screen wide added multiplication for the transparent object that as to be drawn to every single pixel in the frame buffer. The problem with the fill rate impact is that.

    Obviously i have not tested that myself yet to i am not sure what exactly the result is and to better tackle that problem. But i wanted to raise awareness of the cost and the whether you can do something better with that for for that. A low key tinted fog helps with readability in dark scenes for example. Or a simple dim blue tinted point light in the players head, that simulates the adaption of your eyes to the darkness.

    I did that on the N3DS for a tech/test demo thing some years ago... got a gif somewhere. You can totally not see it with the white Background though. Basically when the flashlight is switched off i activate a dim blue light, fading in to simulate the eyes getting used to the darkness. Just to offer an alternative ;)
    FlashlightEyeAdaptation.gif
     
    Recluse and Kennosuke like this.
  7. darkesco

    darkesco

    Joined:
    Mar 19, 2015
    Posts:
    61
    I see. I was going off tribal knowledge of "never use screen space in VR, make everything a 3d model." I'll have to test this as I use this method for every project. But it's usually for short periods of time, like a menu that pauses the rest of the game or a quick red flash for damage.
     
  8. Kennosuke

    Kennosuke

    Joined:
    Jun 29, 2018
    Posts:
    16
    I'm using the SteamVR asset package, so I am not sure if other VR workflows would be the same. However, when I set a canvas to Screen Space - Camera, and attach the SteamVR Camera to it, it seems to emulate a world-space UI panel. I like this method, though, because it automatically scales with different HMD resolutions. So no matter if I am testing my game with an HTC Vive, Oculus Rift CV1, or the Oculus Quest 2, the in-VR UI scales appropriately without me needing to add any special coding to manage it.

    And CptMoe's blue light idea is a stroke of genius. I really like that.
     
    darkesco likes this.
  9. Geist2501

    Geist2501

    Joined:
    Jun 29, 2019
    Posts:
    25
    Yeah, i think the "no screen space" thing comes from the distortion and chromatic aberration that is being performed on a platform level on most VR HMDs, i reckon. So any shapes and geometry would be distorted. Color modulation works, other than that post processing is really expensive. In my current tests a simple (really optimized to the max) bloom effect cuts away 1/3rd of the FPS at native resolution, 20´& at the default one (75% native resolution).

    So, i guess a vertex light (not important set in light's settings) might be the best performing way.

    Also, thanks Kennosuke, if you open the gif in a new tab (with dark background) you can actually see the effect :p