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

Discussion Occlusion Culling performance in HybridURPSamples project StressOcclusionCulling scene

Discussion in 'Graphics for ECS' started by heu3becteh, Nov 7, 2022.

  1. heu3becteh

    heu3becteh

    Joined:
    Aug 6, 2020
    Posts:
    25
    I'm trying to figure out how Occlusion Culling works in Unity DOTS, especially in regards to dynamic occlusion culling (I am experimenting with MineCraft'ish project, with big amount of cubes, many of them are not visible behind the other ones), but for now it seems like the gain of culling some objects is neglectable in comparison to huge performance drop related to occlusion culling being enabled.

    Even in the test scene StressOcclusionCulling of HybridURPSamples project enabling Occlusion (Occlusion - Enable = ON) leads to significant FPS drop.

    Here are some profiler graphs:
    upload_2022-11-7_19-48-18.png
    Occlusion OFF

    upload_2022-11-7_19-48-9.png
    Occlusion ON

    Enabling the Occlusion increases the time spent on one frame from ~1 ms to ~300 ms, despite reducing the number of triangles rendered by ten times.
    The most significant time sinks in StressOcclusionCulling scene are Rasterize Job and Mesh Transform Job.

    Maybe there are some settings I need to change or principles I do not understand behind occlusion work for it to make positive impact on the performance?

    Best regards.
     
  2. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    Hey @heu3becteh!

    We released the stress test before the PR that the stress test was created to profile. :oops: There is a significant performance improvement in the upcoming entities 1.0 pre-release which has already landed internally which will improve the performance of that basic test case with many low resolution occlduers (low number of triangles per occluder). Though that PR will moderately regress scenes with very dense occluders (high number of triangles per occluder). For your use case, if you intend to only use relatively a low resolution for occluders (less than 100 triangles er occluder), then you should see an improvement in the first pre-release.

    Also, in the first pre-relase, we have exposed a per view control, which allows you to explicitly set the resolution of the occlusion buffer for each camera/light individually.

    There is a second significant performance improvement in flight which amortizes the sort with the transform/clipping job, and also increases the number of tiles in a bin, which will further improve the perf of the software rasterization.

    This is a tile/bin based software rasterizer. Currently, the tile and bin sizes are hardcoded, but this is something we definitely intend to expose so that you can explicitly configure it for each view depending on your scene configuration to further reduce overhead.

    How was everything functionally? It was very hard to achieve full conservatism. Masked occlusion culling wasn't designed to be fully parallelized properly, so we had to design our own tile based approach so that we could appropriately parallize the workload across jobs. This is a very custom solution. I would love any further feedback you have!

    We will be releasing a developer guide with the upcoming pre-release.
     
    Last edited: Nov 30, 2022
    apkdev and heu3becteh like this.
  3. heu3becteh

    heu3becteh

    Joined:
    Aug 6, 2020
    Posts:
    25
    Thank you for the reply~
    I look forward to new releases.