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. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Occlusion Culling: Limited range?

Discussion in 'General Graphics' started by unity_SRZXyHN7P3fFcA, Nov 26, 2019.

  1. unity_SRZXyHN7P3fFcA

    unity_SRZXyHN7P3fFcA

    Joined:
    Oct 27, 2019
    Posts:
    10
    Hi guys,

    I'm starting to learn occlusion culling, and I put together a small test scene with a camera and 2 cubes as shown in the image below. The yellow cube is larger than the blue, and all 3 objects are centered on the x-axis.

    Yellow cube:
    (X,Y,Z) = (0, 0, 0)
    All rotation angles = 0
    Scale = (1, 1, 1)

    Blue cube:
    (X,Y,Z) = (1,0, 0)
    All rotation angles = 0
    Scale = (0.2, 0.2, 0.2)

    Camera:
    (X,Y,Z) = (-3, 0, 0)
    Rotations (X,Y,Z) = (0, 90, 0)

    The 2 blocks are meant to be static in gameplay, and so I marked them both as static Everything. As you can see in the camera preview, the blue cube is fully occluded from the camera by the yellow cube.

    upload_2019-11-26_20-9-7.png

    To test that culling would work, I
    1. Enabled occlusion culling on the camera.
    2. Opened the Occlusion Culling Window and set the baking params to smallest occluder size = 0.99 (smaller than the yellow cube), smallest hole = 0.25, and backface threshold = 100.
    3. Clicked Bake
    4. Opened the visualization tab

    What am I expecting / hoping for?
    That Unity would cull the blue cube, since it is well occluded by the yellow.

    What is actually happening?
    Culling doesn't happen. Here is the scene viewer with the rectangles that show up after baking (I don't really understand what they mean. An explanation would be appreciated)
    upload_2019-11-26_20-31-32.png

    If I move the camera closer to the yellow cube, the blue cube starts to get culled when the camera is at around X = -0.794).
    upload_2019-11-26_20-33-52.png

    My questions are:
    1) Can Unity, in principle, cull the blue cube for any camera position and rotation in the scene space, provided the blue cube is fully occluded from the camera?
    2) Are the occlusion window parameters, static settings of game objects, and enabling OC on the camera the only parameters I need to achieve this, or are there other parameters at play?
    3) Why is the blue cube being culled too late in the example scene above?

    Thanks in advance for your support!
     

    Attached Files:

    Last edited: Nov 26, 2019
  2. Hamu_Art

    Hamu_Art

    Joined:
    Apr 24, 2020
    Posts:
    11
    It's nice to see that you still haven't received an answer from the Unity developers. The funny thing is that Umbra is still buggy to this day and it really looks like no one at Unity really knows what to do with its code. And the company that developed Umbra has been merged into Amazon...
     
    sherif_unity910 likes this.
  3. sherif_unity910

    sherif_unity910

    Joined:
    Aug 3, 2022
    Posts:
    3
    Indeed, my whole game has gone from 3D to 2D and through countless iterations, and even won an award, and a I still haven't received an answer! What I learned over the past 3 years is you work 40% on innovating in your game, and 60% addressing platform limitations, misclarities, and compliance integrations. We're still far from a happy world when it comes to developer experience.
     
  4. warthos3399

    warthos3399

    Joined:
    May 11, 2019
    Posts:
    1,650
    Ill be honest here, i did my own OC tests, and i never use it, hell my terrain streaming system does far better. Alot of us devs dont use OC in Unity, we use other methods.