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

How to get two cameras to render near and far into one view?

Discussion in 'Daydream' started by Tuism, Apr 14, 2017.

  1. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    Hi there

    I'm building a game with a far view (about 3000 units), and am experiencing z-fighting with elements that aren't even touching. They weave over and under each other in a weird way.

    How do I deal with this z-fighting with GvrController? I want to render the view from two cameras, one that renders near, one rendering far.

    Since GvrController takes the main camera and splits it into two for stereoscopic vision, how do I get two cameras to split up and composite to the same view?

    Thanks in advance!
     
  2. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    I tried using two cameras that render to different depths, and it works when I run it in editor, but when I build to my Pixel and run, the left eye works as expected, but the right eye bugs out...

    Any idea why this might be?

     
  3. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    I created a simple scene to try to reproduce this:

    Two cameras:
    - Camera Far: Near: 250 Far: 1000 Clear: skybox Depth: -2 (renders first)
    - Camera Near: Near: 0.3 Far: 250 Clear: depth only Depth: -1 (renders second)

    Two Cubes:
    - Green: ~ 0 z
    - Red: ~ 260 z

    Result is both cubes on the screen. This is an admittedly simple test case but please try to simplify your scene and submit a bug report and respond back here.

    I've attached the simple scene here as a starting point.

    Screenshot_20170417-104303.png
     

    Attached Files:

  4. Tuism

    Tuism

    Joined:
    Oct 23, 2013
    Posts:
    28
    I tried removing most things from the scene and it still didn't work. Even tried to minimise the max depth to like 600. Still the same.

    http://i.imgur.com/RXZt6v4.png

    Attaching the package to see if you can make heads or tail from it.

    Thanks in advance!
     

    Attached Files:

  5. thep3000

    thep3000

    Unity Technologies

    Joined:
    Aug 9, 2013
    Posts:
    400
    An update here: we have reproduced this issue here on the pixel phones, but not on other devices. We're attempting to prove that it is a driver bug and will forward on to google / qualcomm. I think for now you will just have to try to work around it.

    More details:

    After disecting the project a bit we got it into a state where we could see that the vertex indices became off by one. Disabling skybox 'fixed' the issue. Doesn't happen on other SOCs. See attached screenshot.
     

    Attached Files:

    Last edited: May 9, 2017