Search Unity

(Case 957559) Occlusion Culling Visibility Lines do not start at Camera Near Plane

Discussion in '2017.2 Beta' started by Peter77, Oct 9, 2017.

  1. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,090
    With Occlusion Culling enabled, some objects disappear even if they should be visible. I found many cases in the actual game where such problems occur and was be able to create a small project to reproduce this issue easily.


    (the teal colored plane should never disappear, because the Camera (near plane) is located in-front of it.)

    Here is a bit of context to get an idea what situation the provided test covers in the actual project.

    It's a first person game. The red cube represents a wall. At the wall is a picture placed, represented by the "Picture" gameobject which is just a plane with a teal color. If the camera is near the wall, the picture unexpectedly disappears.

    I guess the occlusion culling system assumes the camera is located inside the wall, because if I reduce the camera near plane, this issue is harder to reproduce.

    The Occlusion Culling "Backface Threshold" is set to 100, which according to the documentation "never removes any backfaces". I thought setting this to 100 would workaround this issue.

    Looking at the Camera Near Plane visualization in the editor, shows that the Camera Near Plane is very much outside the wall.

    Turning on the Occlusion Culling "Visibility Lines" debug visualization in the Scene View, reveals these lines do not start at the camera near plane, but like half a meter out, so these are actually located inside the wall.

    screenshot.png

    Turning off Occlusion Culling make the "objects incorrectly disappear" issue go away.

    It seems to be impossible in the game to workaround this issue, no matter what Occlusion Culling settings I tried. The issue always occurred in one place or another. The only workaround I found is to reduce the camera near plane to almost 0, to move the Occlusion Culling Visibility Lines closer to the camera. Setting the camera near plane to 0 doesn't seem like the right solution to me though.

    Another workaround is to use bigger colliders, so the player cannot get as close for example. However, this causes gameplay issues, because suddenly the player cannot get close enough to interact with objects anymore.


    Reproduce
    • Open attached user project
    • Open Assets/Scenes/Test.unity
    • Open Window/Occlusion Culling
    • Switch to "Bake" tab in Occlusion window
    • Press "Set default parameters"
    • Press "Bake"
    • Press "Play"
    Observe the "Picture" (the teal colored plane) is visible sometimes only.


    Expected
    I'm no Occlusion Culling expert, but it seems to me the Occlusion Culling Visibility Lines should start at the camera near plane instead. In my understanding, this would provide more consistent Occlusion Culling, where objects do not disappear if the camera is placed just infront of them.

    The expected behavior of the provided test project is that the teal-colored plane stays visible always.
     
    Last edited: Oct 9, 2017
  2. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,090
    I just received the following reply:
    I don't understand why this bug has been identified as a minor or cosmetic issue though, since at least in our project, it makes using Occlusion Culling not applicable.
     
  3. LeonhardP

    LeonhardP

    Unity Technologies

    Joined:
    Jul 4, 2016
    Posts:
    2,837
    This issue was fixed last week and will be backported to as many versions as possible.
     
    x4000 and Peter77 like this.
unityunity