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

2017.2.0f3 Single Pass Stereo Instanced and Realtime Lights Rendering Issue

Discussion in 'AR/VR (XR) Discussion' started by swirvithan, Oct 16, 2017.

  1. swirvithan

    swirvithan

    Joined:
    May 26, 2017
    Posts:
    13
    Hey all,

    I've been checking out the new single pass stereo instanced feature in 2017.2.0f3 and discovered an issue with realtime lights illuminating standard shader materials: Depending on distance and range of the light it doesn't render in the right eye when you're far enough away. If you get closer or increase the range of the light, a line will travel across the light from right to left as you approach.

    I've attached 2 images of the issue, the first being the light fully culled from the right eye, and the second of that weird culling line traveling across the light after increasing the range of the point light.

    I tried changing the material of the plane to use Mobile/Bumped Diffuse and that seems to fix it (Likely due to the mobile shader using vertex light rather than per pixel lighting), but obviously I'd much rather use the standard shader in my projects, and also have the super nice performance boost from Stereo Instanced. :)

    StereoInstLight.PNG StereoInstLight2.PNG

    Anyone else experiencing this? If so, discovered any workarounds?
     
  2. MadeFromPolygons

    MadeFromPolygons

    Joined:
    Oct 5, 2013
    Posts:
    3,967
    Do you definately have forward rendering enabled? (Forward not defered)

    Have you tried changing your color space? (Linear < > Gamma)

    EDIT: looks like a flare layer, does both cameras have a flare layer?
     
  3. swirvithan

    swirvithan

    Joined:
    May 26, 2017
    Posts:
    13
    Hey Daemonhahn, thanks for the reply!

    I was using forward rendering, but I went through the other options real quick:
    • Deferred seems completely broken with single pass stereo instanced on. The plane is entirely white in my right eye, and slightly grey in the left... strange. (Just to make sure I'm not crazy, I tried regular single pass stereo deferred too. Everything renders fine)
    • Legacy vertex lit looks correct. The light renders in both eyes and there's no stereo convergence weirdness. But its vertex lit. :(
    • Legacy Deferred has the same results as forward rendering.
    I was using Gamma color space, but I tried switching to linear. No change.

    Removed the flare layer on my camera as well. No change. (The intensity on that point light in my pictures is pretty high btw, just so its visible. There shouldn't be any flare on it)
     
  4. swirvithan

    swirvithan

    Joined:
    May 26, 2017
    Posts:
    13
    Did a bit more digging. It seems to be an issue with Unity using a scissor rect to bound the point light's contribution. I'm guessing in regular single pass stereo this rect is re-calculated for each eye before running the forward additive pass. Now, since stereo instanced writes to 2 render targets in 1 pass, it only gets calculated for the left eye and is then applied to both.

    I've attached an image that explains it a little better. The red quad is the result of me forcing the forward additive pass frag shader to always return red. As you can see both eyes are using the same scissor rect. (if you cut the image in half, the rects are in the same place in screen space)
    scissorTestLight.PNG
    scissorTestVisualStudio (2).png

    I was hoping for a workaround, but I don't believe setting/modifying that scissor rect is exposed in the engine currently. So if anyone else is having the same problem it looks like the only thing to do is wait on a Unity fix.

    EDIT: Issue Tracker page: https://issuetracker.unity3d.com/is...ight-eye-with-single-pass-instanced-turned-on
     
    Last edited: Oct 19, 2017