Search Unity

Discussion Burst Occlussion Culling

Discussion in 'SRP Dev Blitz Day 2022 - Q&A' started by YuriyPopov, Sep 29, 2022.

  1. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    What is the status of this feature? I know it's a implementation of intel's masked software culling, but is it part of the gpu driven pipeline or is it going to be a stand alone feature? When can we expect to see it in action ?
     
    LaireonGames likes this.
  2. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Same question here. Unfortunately umbra occlusion culling doesn't cut it anymore, culling is not as efficient as it should be, and large CPU overhead, even though it's static.
    Surprised unity still doesn't offer an alternative, a proper static occlusion culling feature.
     
    florianBrn likes this.
  3. Anne_Daney

    Anne_Daney

    Unity Technologies

    Joined:
    Aug 30, 2022
    Posts:
    21
    Hi,

    Burst Occlusion Culling is now included with the experimental release of ECS for 2022.
    You will find more information about the experimental release of ECS for 2022 here:
    https://forum.unity.com/threads/experimental-entities-1-0-is-available.1341065/
    We will post in the forum in the upcoming week to give more information specific to Burst Occlusion Culling.

    Our new occlusion system is planned to be a standalone feature, but is currently tightly integrated into the Entities Graphics package.
    GameObject support is planned for the future, which requires it to be decoupled from the Entities Graphics package.
    The only dependency for the updated Burst Occlusion Culling system is Burst. It is completely separate from the GPU Driven rendering initiative.

    We are very eager to get feedback from developers.
    Experimental Burst Occlusion Culling in experimental ECS for 2022 still requires manual occluder creation.
    Both the fully conservative software rasterization and occluder generation pipelines are incredibly complex.
    So our plan is to provide first a very robust heavily optimized software rasterization system with manual occluder generation.
    We then plan on integrating developers' feedback in more refined workflows in the future.

    Auto Generated occluders, which are in fact in progress, are also part of our next priorities, and they will be out in one of the following releases.
     
  4. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    Is that possible to use at mobile platform like android to significantly improve performance coz current umbra occulusion solution at built-in editor performance is really bad at android mobile platform?
     
  5. PutridEx

    PutridEx

    Joined:
    Feb 3, 2021
    Posts:
    1,136
    Great, hoping burst OC game object support won't take too long. I'll test it out the moment that happens.
     
  6. YuriyPopov

    YuriyPopov

    Joined:
    Sep 5, 2017
    Posts:
    237
    The fact that its not for game objects makes me sad. Kinda of a dumb question that probably needs to be in its own thread, but how ready do you think DOTS is for a serious production? Like a graphics heavy fps game. Especially in the animations department?
     
    PutridEx likes this.
  7. IsaacsUnity

    IsaacsUnity

    Unity Technologies

    Joined:
    Mar 1, 2022
    Posts:
    94
    Hey there! We've just released Experimental Entities 1.0 for 2022.2 Beta, which allows users to test ECS for Unity and provide us with feedback. We've also shared some customer stories of ECS for Unity being used in production in this post. That being said, experimental packages are not recommended for use in production, so do look forward to the release of ECS for Unity!
     
    AntonioModer likes this.
  8. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    Currently, only PC and Console are supported, as it uses low level Burst intrinsics (SSE/AVX) for heavy deterministic optimizations. Neon support is in progress, where we are specifically optimizing our method for mobile platforms. Mobile support is very high priority.

    The benefit of occlusion culling is very scene specific (sofware rasterization overhead versus draw overhead reduction plus GPU performance improvements), and it is even more specific on some mobile hardware, as some vendors provide an implicit visiblity pass for hidden surface removal. These platforms will still benefit from the draw overhead reduction, but GPU performance imporvements will be reduced, specifically only when the hardware binning is active. Some tiled based deferred renderers actually have an immediate/direct rendering mode that is implicitly enabled for specific scene configurations (and their resulting draw heuristics), so when that mode is active, they will also potentially significantly benefit from our occlusion culling.
     
    Last edited: Sep 29, 2022
    AntonioModer and optimise like this.
  9. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    Game Object support is a very high priority for us, and it is being investigated. The only dependency for our new occlusion culling system is Burst. Though we are prioritizing mobile platform support first, as well as creating a very robust conservative software rasterizer, and having a well defined developer workflow with extensive debug tooling. The Entities ecosystem provides a gateway for us to release our new culling system that is not bound to the performance limitations of game objects, so we can properly optimize and profile our new system, while also getting early developer feedback, which is critical for us so that we can be sure the interface for our new system is well defined based on your feedback.

    With regards to Entities versus Game Objects, there are inevitably going to be games that are better suited towards one or the other, but ideally, both can potentially live in concert eventually. Should Entities be hampered by the same performance limitations that are introduced by the dependent feature support of every single rendering feature of game objects?
     
    AntonioModer likes this.
  10. sqallpl

    sqallpl

    Joined:
    Oct 22, 2013
    Posts:
    384
    Will this system work with meshes that use alpha cutout materials like tree branches for example? Is it even possible to generate occluders for alpha cutout objects?
     
  11. Kamyker

    Kamyker

    Joined:
    May 14, 2013
    Posts:
    1,091
    Does it mean there will be both CPU and GPU based OC in the future like in Unreal?

    Nice to see Unity finally prioritizing it. I've bean asking over and over trying to explain how important it is for any medium to big 3d games.
     
  12. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    Our in progress auto occluder generation does not support planar surfaces. However, there is no reason we can't just raster the original plane into our encoded depth. This is a feature we are currently trying to investigate the best workflow to support. Though a simple approach is to just give the plane a thickness value for the implict representation so that it can be combined with non-planar geometry. The definition of the simplest representation possible for any mesh that is fully view consistent (inscribed) is incredibly challenging, especially in generalizing this to all geometry in the wild. One thing which is often forgetten with Umbra is that meshes need to be watertight for it to work properly.

    There are other challenging geometry, such as terrian that needs to cutout holes for caves. A slight crack can completely kill occlusion coverage. Our inscribed geometry generation can close open (non-watertight) geometry as well as handle degenerative meshes, but how we provide hierachial selection and developer control of occluder generation requires significant feedback, discussion, and further design. We need to make sure it works well in unicence with DCC import workflows so that it doesn't impact tech artist iteration speed.
     
    Last edited: Sep 30, 2022
  13. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    The GPU driven rendering initiative is seperate from Burst Occlusion Culling as Anne mentioned, but ideally, these will work in concert together for broad platform and scene support for optimal and generic occlusion culling, ideally with explicit developer control. The workflow for this and other scriptable culling improvements are being discussed.
     
  14. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Will this allow developers to write their own game object occlusion systems?

    For example the Perfect Culling plugin is fantastic! It works great and depending on your game it can result in huge savings.

    However to cull renderers the developer had no choice but the set the forceRenderingOff bool in order to cull renderers. When you transition from one cell to another, Perfect Culling has to iterate all renderers and set their forceRenderingOff bools appropriately.
     
    timmehhhhhhh and koirat like this.
  15. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    Yes plugin your own stuff into occlusion culling would be awesome.
    And definitely we need some callback when something became visible/invisible.
     
  16. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    Not at this time, though full customization leveraging components of the optimized rasterizer and intersection engine modularly is something we would like to drive towards. Can you provide any more feedback in terms of the interface and workflow you would like to have?

    With regards to forceRenderngOff, there was a regression in 2019 with regards to using GetForceRenderingOff that has been fixed which landed in 2021.2 and backported all the way to 2019.4, which is a pretty significant performance improvement.
     
  17. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    We consider this to be critical, but the CullingGroupAPI in it's current form, is not something that we want to support, as there are many issues with the design and implementation of it. There are several issues with the visibility determination with the onBecameVisible event broadcasting, and also the distance checking is not even dependent on occlusion but it is currently locked in the culling results synchronization in the current design. o_O While we are working on fixing the CullingGroupAPI as well at the moment, we would ideally not support this with the new system with regards to the visiblity determination. There will obviously need to be an alternative, which is something we are considering, and we would love any further feedback you might have on this!
     
    Last edited: Oct 10, 2022
  18. Prodigga

    Prodigga

    Joined:
    Apr 13, 2011
    Posts:
    1,123
    Even as simple as letting us provide a list of renders (or renderer instance IDs or something) to ignore for that frame could work. Though I'm not the developer behind the culling plugin so maybe im not the best person to ask.
     
  19. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    @nigeljw_unity What types of renderers are planned to be supported for this type of culling?

    Particle systems benefit from custom culling atm, and users cannot use forceRenderingOff on specific terrain tiles for example. Will those two also be culled by burst culling?
     
  20. koirat

    koirat

    Joined:
    Jul 7, 2012
    Posts:
    2,074
    The best thing would be something like this.

    On baking process unity searches for special components (best would be abstract component or interface).
    This components returns custom data for the baking process.

    It would be also grate to have options to set culled objects to "solid" for this custom cases.
    This could help with situations like culling for particles.
    Since right now umbra is considering only triangles, there are situations when we are inside a cube that is going to be culled.

    So for example in current state of things if camera is inside a room and there is big particle object that encapsulate this room we cannot simply use particle max bounding box as a mesh for culling purposes, we also have to check if the camera is inside this bounding box.
     
  21. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    Currently, in Entitites 1.0, VFX is not yet supported with the experimental occlusion culling. Particles are something that would definitely benenfit very significantly from occlsusion culling. Would you be able to add a comment on the Burst Occlusion Culling product board card in regards to this? It helps a lot with the prioritization of the task.

    Terrain is also something we are continuing to discuss the best workflow to handle. It is easy enough to give terrain an implicit thickness to generate an occluder, and while our prototype auto occluder generation can close holes from caves (as well as other non water tight or degenerative geometry), this isn't an ideal approach. There needs to be a proper workflow for merging cave scenes with the terrain height map, which we have been discussing with our environment team as well as tech artitsts, etc. Any further feedback or discussion on this is very appreciated!

    Can you provide any more detail about the specialized terrian tiles that are not supported with forceRenderingOff? While this doesn't impact our new Burst Occlusion Culling, it is something I am discussing internally, as I would like to better understand the legacy reasons why that cannot be handled with the exisiting terrian system so that we can further investigate to see if this is something we can support going forward.

    With regards to the supported list of renderers, this is something we have added to the in progress development guide, which will be shared with an upcoming pre-release.
     
  22. TJHeuvel-net

    TJHeuvel-net

    Joined:
    Jul 31, 2012
    Posts:
    838
    Added, thanks!

    There exist custom solutions for culling that improve upon Umbra (PerfectCulling for example), but anything we do is hampered by not being able to cull terrain tiles. We can turn off the entire terrain, but there doesnt exist a `forceRenderingOff` for tile xyz. This means no control over culling in Terrain. This is why we use both Umbra and custom solutions.

    Which i suppose i dont want. I just want good culling out of the box.
     
  23. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    @nigeljw_unity we haven't heard or seen anything about this in a while, and I guess that's part of my question. But it raised with me a different concern:

    As I lay in bed pondering "how may I write code that easily adapts to both ECS and classic Unity", I notice that there's many features in production trying to do the same thing (new Occlusion Culling System, new Animation System, hyped Terrain Tools). And I gotta ask, what the hell's y'all taking so long?!

    But sincerely, I do have questions regarding this strategy, and I figured here was a good place to start. My biggest questions being:
    - Building on an API that is still in preview (and not that long ago was still experimental) seems risky, what have been some of the core decisions behind supporting ECS out of the box?
    - With your current knowledge, would you reconsider this decision and wait for the technology to mature more first?
    - Apart from "Use Jobs and Burst", what is the biggest takeaway when writing code that will work for both native Unity and ECS?
    - Would you say developing for both architectures has considerably slowed down development or just led to different architectural decisions, not influencing development time that much?

    As we slowly enter this brave new world, and as someone who has always valued writing reusable code, I worry about my ability to work cross-project if architectures become so divided in the future. I would love to get insight as to if pursuing "cross-coding" like this is worth the effort, or if I'm better off sticking with the winner, whichever that may be.
     
  24. nigeljw_unity

    nigeljw_unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    50
    Sorry for the delay. I was on extended parental leave for a few months.

    The Burst Occlusion Culling system is a hand crafted heavily optimized custom design and implementation of masked occlusion culling using the low level Burst intrinsics, jobs, and collections:
    https://docs.unity3d.com/Packages/com.unity.burst@1.8/manual/csharp-burst-intrinsics.html

    The implementation is explicitly vectorized to maximize performance and minimize added latency, and requires both SSE/AVX and Neon backends for full platform support. The system supports dynamic objects and it is fully conservative (zero popping), which are both very challenging requirements.

    Also, automatic generation of occluders is being investigated, which ideally would support degenerative (and even potentially non water tight) meshes. The automatic occluder generation system is as complex as the culling system itself. Umbra requires water tight and non-degenerative geometry, so if you want Umbra to actually work, you need to properly process your meshes before using them with Umbra, which can require a lot of manual mesh processing, and causes a lot of problems if not done properly.

    We are also building up test frameworks, samples for validation, continuously profiling, conducting user interviews, and writing the manual documentation, while also supporting the entire legacy culing system.

    For updating very large sets of dynamic state, ECS is a requirement. This question is better asked in the Dots forum, as this post is specific to Burst Occlusion Culling, which isn't actually specific to DOTS, but there is a lot more work required to support game objects, as the feature support is much broader.

    The new Burst Occlusion Culling system is still in experimental. It should not yet be used for developing production systems. There is a lot more discussion on workflow that needs to be done to improve the usability and iteration time. We have been conducting user interviews to get more feedback in terms of expectations for supported workflows.

    The collections package is specifically the most general and powerful.

    I really recommend posting some of those questions in a new thread in the Dots forum, as Burst Occlusion Culing, while the system supports Entities Graphics, it doesn't have any dependency specific to ECS.

    Though there are inherently games that are much more well suited to ECS (games with a huge amount of dynamic state) or games that are better suited for traditional game objects. There is not just one path for all games. You need to think about the initial design and the evolution of the game to know if you should leverage ECS in some way.

    Entities Graphics is built on top of the new BRG API, which is independent of ECS:
    https://forum.unity.com/threads/new-batchrenderergroup-api-for-2022-1.1230669
     
  25. Avol

    Avol

    Joined:
    May 27, 2016
    Posts:
    95
    Will you be supporting the umbra occlusion culling? I have plenty of crashes with it, without any editor error apart from native crash. should I report those? Will they ever be fixed?
     
  26. Anne_Daney

    Anne_Daney

    Unity Technologies

    Joined:
    Aug 30, 2022
    Posts:
    21
    Hi Avol,
    We are still supporting Umbra for now.
    You should definitely make a report with a test project or steps to reproduce it so we can try to find the origin of the bug.
     
  27. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    It's been a while.

    Any updates on Burst Occlusion Culling? It seems like such a "free performance" once it's out, easily pluggable into any Unity game!
     
  28. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
  29. Anne_Daney

    Anne_Daney

    Unity Technologies

    Joined:
    Aug 30, 2022
    Posts:
    21
    Hi @CaseyHofland
    We have provided an update in the latest DOTS development status and next milestones on Burst Occlusion Culling.
    After doing a lot of testing, even though we are satisfied by the approach taken, we have not yet reached our performance expectations. While we are still working on improvements, we have decided to remove it from general availability.

    But I recommend that you take a look at the GPU occlusion culling that will be available in Unity 6.
    It is displayed in Unite 2023 keynote in the demo from Mathieu and Elaine.
    You have a thread available here also that provides more information on GPU Resident Drawer in general.
     
    DevDunk likes this.
  30. optimise

    optimise

    Joined:
    Jan 22, 2014
    Posts:
    2,129
    I think u will need to check case IN-52491 and fix the bug first that currently Burst Occlusion Culling is completely broken and not working. Actually I think official should still keep it and continue to ship update incrementally so developer can battle test the feature and make sure the feature is not broken.
     
  31. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    Thank you, the GPU Resident Drawer looks good! Folks are reporting +20fps after some minor tugging so it's clearly proving results! It has a lot of requirements though... in classic Unity-fashion, rendering remains a tricky beast trying to bite off more than your dev-teams can reasonably chew. I hope the move to more automatic processes (as this GPU Resident Drawer as well as out-of-the-box Occlusion Culling) will standardize these processes so that Unity can update one when another changes, instead of playing hot-potato with rendering features.

    Excited to learn more about GPU Occlusion Culling, hopefully there will be a Unite talk about it published on YouTube.
     
  32. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    There wasn't a talk specifically about it. The roadmap and keynote are the ones that covered it. In a top down view it reduced verts from 47 mil to 40 mil (if I recall correctly). I expect that the improvement will be better if the camera is close to the ground, since more can be culled.
    And it's dynamic, which is the biggest improvement in my opinion
     
    CaseyHofland likes this.
  33. Hurbivore

    Hurbivore

    Joined:
    Nov 25, 2016
    Posts:
    13
    Oh does that mean objects within the scene will not have to be marked as static for it to work? The biggest downside for me at the moment with the current occlusion culling in my game is that it's open world and I can't set objects as static as I have the world recentered every so often for a floating point fix.
     
  34. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,063
    Yesss it's dynamic!
    Check the Unity Unite roadmap :p
     
  35. CaseyHofland

    CaseyHofland

    Joined:
    Mar 18, 2016
    Posts:
    613
    That’s the idea. No baking. No marking static.

    Just make sure that you measure your performance, because I believe some folks reported issues with that. In their cases it always came down to flipping some switch in their player- or rendering settings though, so it’s very solvable.