Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Anyway to avoid distant mountains changing shape as you rotate the camera?

Discussion in 'General Graphics' started by JoeStrout, Feb 17, 2021.

  1. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,401
    I'm working on a (Quest) VR game with a highly varied landscape. We prefer not to use fog. But this means that tall mountains in the distance appear in the corner of your eye, and then disappear when you look at them.

    I understand why this happens — the camera frustum is flat, not curved, so it reaches further away from you at the edges of the view than in the center. But it's quite distracting. I'd be happier if the clipping plane were curved, so that a peak too far away to see directly doesn't show up in your peripheral vision, either.

    I just thought about activating fog at nearly the clipping distance, but I don't think that works either, because the fogged-out mountains wouldn't disappear, they'd just be drawn in the fog color (which isn't the same as the sky; we have a dynamic skybox). So they'd still be appearing and disappearing as you turn your head.

    Is there any way to make geometry more than X units away actually not draw at all?
     
  2. bgolus

    bgolus

    Joined:
    Dec 7, 2012
    Posts:
    10,090
    Unity's fog is also "flat" by default, so even if you did use it, it wouldn't help hide anything. This is one of the many reasons I replace the built in shaders with custom ones for every VR project I've worked on.

    If you want your distant mountains to be "clipped" by a sphere or cylinder, the easiest solution is to render the skybox yourself as a sphere or cylinder mesh you keep centered on the camera and scaled to just less than the far clip plane. You can do this with a script, or a shader.
     
  3. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,401
    Brilliant! Should have thought of this myself. An inward-facing sphere, with the sky material applied, does the job just fine. Thanks for the suggestion!
     
unityunity