Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Recommended minimum near clipping plane of cameras?

Discussion in 'Editor & General Support' started by ArachnidAnimal, Aug 18, 2015.

  1. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    Does anyone know what the recommended near clipping plane is of a camera? Numerous times I have had to increase the clipping value to prevent flickering in deferred mode.
    This is interfering with how I move items close to the camera in my script.
    It seemed anything less than 1 causes issues, now values of 1.1 are causing issues.

    thanks.
     
    AntonioModer likes this.
  2. Todd-Wasson

    Todd-Wasson

    Joined:
    Aug 7, 2014
    Posts:
    1,077
    I go much lower than that, 1 meter is useless if you're doing something like a car racing game and want an onboard view.

    The actual value doesn't matter that much, what counts is the ratio of far to near. If you need the near plane closer then bring the far plane in closer too.
     
  3. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,727
    But the issue is using deferred. If the near clipping range is too close, there are shadow flickerings which occur with shadows far away.
    If the near is too far, then objects close wont appear.
    Here is the shadow flickering with near = 0.3m:

    tooClose.png
    with a near=2m, the flickering is gone.

    After reading more about it, apparently this has more to do with the specific CPU/GPU hardware, rather than unity.
    (But I dont understand why the near clipping range affects things far away).

    How does the ratio affect this? I dont know much about this.
    Thanks.
     
  4. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    There's a fixed amount of depth buffer precision, so the larger the ratio, the more that precision is spread out. i.e., if the near plane is small, there's less precision available for far away stuff. You can therefore get away with a small near plane if the far plane is also relatively close.

    --Eric
     
    ArachnidAnimal likes this.
  5. Maxii

    Maxii

    Joined:
    May 28, 2012
    Posts:
    45
    Eric, any guidance on the magic far/near ratio to not exceed? I've read 30,000 from Dreamora but that was a thread from 2010.
     
  6. Eric5h5

    Eric5h5

    Volunteer Moderator Moderator

    Joined:
    Jul 19, 2006
    Posts:
    32,398
    I don't know what 30,000 refers to. The default that Unity uses of .3 near and 1000 far works well. (They originally had a default of .1 near, but that was causing problems in some cases.)

    --Eric
     
    AntonioModer likes this.
  7. Maxii

    Maxii

    Joined:
    May 28, 2012
    Posts:
    45
    I was referring to the far/near ratio. 1000/.3 = 3K+, 1000/.1 = 10K. I currently use a max of 10K.

    Thanks,