Search Unity

Graphics GPU Occlusion Culling without baking and raycasting

Discussion in 'Tools In Progress' started by drcrck, Jan 25, 2019.

?

Price?

Poll closed Feb 22, 2019.
  1. 10

    17 vote(s)
    29.8%
  2. 20

    12 vote(s)
    21.1%
  3. 30

    17 vote(s)
    29.8%
  4. 40

    3 vote(s)
    5.3%
  5. 50

    8 vote(s)
    14.0%
  1. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    No, the current version is Windows Standalone PC only
     
    jbb1979 likes this.
  2. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    203
    Do you know this work ?
    https://diglib.eg.org/handle/10.2312/pgs.20141246.019-024

    Integrating Occlusion Culling into LOD on GPU


    Real-time rendering of complex 3D models is still a very challenging task. Recently, GPU-based level-of-detail (LOD) approaches have been proposed to fast decrease the complexity of a 3D model, but applying only LOD approaches is usually not sufficient to achieve highly interactive rendering rate for the complex model that contains hundreds of millions of triangles. Visibility culling, especially occlusion culling, needs to be introduced to further reduce the amount of triangles being rendered at each frame. In this paper, we present a novel rendering approach that seamlessly integrates occlusion culling with the LOD approach in a unified scheme towards the GPU architecture. The result shows that the integration significantly reduces the complexity of the 3D model and satisfies the demands of both memory efficiency and performance.
     
    jbb1979 and Flurgle like this.
  3. Renea

    Renea

    Joined:
    Nov 12, 2017
    Posts:
    9
    Couple of Questions:
    1. Does this work with Weather maker?
    2. Does this work with multiple directional lights? i.e. one light set up for day(Sun) and one light set for night(Moon)
    3. Will there be support for additive scenes? I have a project where scenes are separated into sub scenes (main, Sound, VFX). I downloaded the demo project, I couldn't assign the directional light. I am assuming this is because the script was on the camera in the main sub scene, but the directional light is in the vfx sub scene.
     
    jbb1979 likes this.
  4. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    I'll check it out, thanks

    1. Never used it, does it do something unusual that can prevent GDOC from working? It works with EnviroSky and should support any similar system.
    2. It supports only with 1 directional light at a time, but you can switch them with GDOC.SetDirectionalLight
    3. It will be auto assigned automatically when you load the second scene. If not, do it manually with GDOC.SetDirectionalLight
     
    jbb1979 likes this.
  5. Justin_Wingfall

    Justin_Wingfall

    Joined:
    May 15, 2014
    Posts:
    125
    buying once it hits hdrp.

    oh yea and multi cameras, I doing a fix camera game. Once either one is added, I'm buying asap, if I don't find anything else that fits my needs by that time, of coarse. :)
     
    jbb1979 likes this.
  6. SquallLiu

    SquallLiu

    Joined:
    Jun 19, 2017
    Posts:
    32
    It's really a good asset to use for reducing batches!
    Thanks for sharing GDOC.

    However it seems GDOC causes memory leaks.
    Our game keeps loading different scenes and we call GDOC.Disable()/GDOC.Enable() to scan scene objects every round.
    And we measure the memory utility, GDOC causes memory leaks.

    Is there any suggestions about lifetime control of GDOC?
    Should we only enable/disable GDOC only once instead of every round?

    Thanks.
     
    jbb1979 likes this.
  7. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    Both will be supported in 1-2 weeks! :)
    You don't need to call Disable/Enable if "scan new scenes" is checked. Or it doesn't work for you?
    Also, do you mean managed or unmanaged memory?
    Anyway, new version will be released soon and these issues might already be fixed
     
    jbb1979 likes this.
  8. SquallLiu

    SquallLiu

    Joined:
    Jun 19, 2017
    Posts:
    32
    Since we use LoadSceneMode.Additive and move scenes(race track combination) after it finishes scanning.
    The moved scene seems to have wrong position and would be culled incorrectly.
    Manually call Disable()/Enable() fits our need :) (we can do scanning after track combination).

    I think the memory leak comes from unmanaged memory (when calling Enable()).
    Managed memory should be fine since garbage collection.

    Thanks!
     
    jbb1979 likes this.
  9. Black_Raptor

    Black_Raptor

    Joined:
    Nov 3, 2014
    Posts:
    181
    Hi !
    I noticed you mention he work on Vulkan and VR, do you think he could work on mobile hardware like the Snapdragon 835 of the Oculus Quest ?
     
    jbb1979 likes this.
  10. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    Hi, Vulkan is not supported yet
     
    jbb1979 likes this.
  11. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Hi, just purchased GDOC.

    The asset itself is promising, dropped batch count by at least same amount as OC for me, no need to waste hours on baking.

    Warning, major critique ahead:
    But the initial scan is painfully slow. Just by looking through the source I can tell where the problem lies - in the component creation / attachment, null checks, allocations via GetComponents that do not have list buffer send to them.

    Perhaps using GetComponentsInChildren<T>(true, List<T> buffer) would be much faster when dealing with large hierarchies, rather than manually fetching components via GetComponent<T>.

    (https://docs.unity3d.com/ScriptReference/GameObject.GetComponentsInChildren.html
    -> public void GetComponentsInChildren(bool includeInactive, List<T> results))

    (I guess I can disable auto-detection and hook up GDOC_Occludee to each prefab / renderer?)

    If you're interesting in improving initial scan time, move the whole attachment process to the editor.
    I've done similar component attachment on static objects in editor time, so it shouldn't be that hard to implement (albeit it can be tricky when handling prefabs).

    This will reduce scan time to about zero, you'd just need to hook the GDOC_Occludee components to the GDOC in OnEnable / OnDisable.

    Also, please don't do:
    Code (CSharp):
    1. component.transform.position = ...
    2. component.transform.rotation = ...
    Do it like so
    Code (CSharp):
    1. Transform cTrm = component.transform;
    2. cTrm.SetPositionAndRotation(...);
    3. cTrm. ... = ...
    4. cTrm. ... = ...
    Transform is native call, which by its own is not a lot, but when it comes to thousands of calls, its not nice.

    Also,
    Code (CSharp):
    1. Vector3.one * e.range * 2
    is slower than:
    Code (CSharp):
    1. e.range * 2 * Vector3.one
    Result is the same. Order maters.

    TL;DR: C# source would love to have a couple of refactoring passes done to it.

    I don't want to sound like an asshole, and at the same time I don't want to sit a couple of nights refactoring purchased assets' code.

    Hope to see some improvements in this area in the future.
     
    Last edited: Jun 29, 2019
  12. churi24

    churi24

    Joined:
    Sep 17, 2013
    Posts:
    98
    Hi, I have a game on Steam, and I think this asset could help us with our performance problem, but before buying I need some information.
    Our case:
    1) Our game has a part of the scenario that is generated randomly.
    2) Except for some very specific materials, we use only standard materials.
    3) We are using volumetric lights.
    4) We are not using Directional Lights, only Spot and Point light.
    5) Our shadows are Realtime.
    6) We have only one camera active (we are using Cinemachine)

    Question: 1- How this asset works?, just to understand what you do in the GPU. I read the posts, and it makes a scan at the beginning. 2- Do you trigger some event when this process ends?
    3- Do you have plans to support PS4 & xbox? I know this asset took a lot of research and work, the questions are simply to orientate me :)
     
    jbb1979 likes this.
  13. Muravu

    Muravu

    Joined:
    Nov 30, 2014
    Posts:
    53
    Hey, I sent you a message on Discord about trying out the asset before we buy it for our project. We really want to try it out to make sure it fits our game. You mentioned on the asset store that we can contact you on Discord for some kind of demo version that we could try out.
     
    jbb1979 likes this.
  14. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    @xVergilx thanks for the comments, the upcoming version has many improvements in both C++ and C# parts

    1. It disables components/gameobjects (depends on settings) that are not seen by any camera (note in the current version it supports only 1 camera, but it will be unlimited in the next one)
    2. Scanning will be improved in the next version and yes, I can add an even if you need it
    3. I do, but there's still a lot to do so no eta

    Hi, just answered
    The demo is posted on the #news channel on discord
     
  15. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Hello drcrck,

    will there be a GDoc update soon with improvements? Is this working with Unity 2019.2 already?

    I am planning to update my project to Unity 2019.2 soon :)

    Thanks
     
    jbb1979 likes this.
  16. Deleted User

    Deleted User

    Guest

    Can it cull Terrains?
    If not is there an API where we can make a custom rule for culling the terrain?
    We have Terrain Chunks generated with Map Magic at runtime, what we could do is to make the chunks smaller like maybe 10x10 or 100x100 and cull it because these terrains slow down our game too much.
     
    jbb1979 likes this.
  17. frankadimcosta

    frankadimcosta

    Joined:
    Jan 14, 2015
    Posts:
    203
    A better approach is using world streaming.
     
    Deleted User, jbb1979 and xVergilx like this.
  18. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    If its rendered via default Mesh Renderer it will.

    Otherwise - probably not.
     
    Deleted User and jbb1979 like this.
  19. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Latest release seems to work well with Unity 2019.2.
     
    jbb1979 likes this.
  20. Teila

    Teila

    Joined:
    Jan 13, 2013
    Posts:
    6,932
    Has this been integrated with Vegetation Studios Pro yet? Thanks.
     
    Superjayjay and jbb1979 like this.
  21. jbb1979

    jbb1979

    Joined:
    Aug 6, 2019
    Posts:
    320
    This is an amazing Tech and, increasing frame-rates ten times is crazy-wonderful ! !

    You have revolutionized video-games, if every-one did this we'd have much finer games ! !
     
  22. Deleted User

    Deleted User

    Guest

    Okay, thank you for the info
     
  23. R0man

    R0man

    Joined:
    Jul 10, 2011
    Posts:
    90
    How easy would this be to use for someone interested in drawing a lot of instanced models using
    Graphics.DrawMeshInstancedIndirect
    . Would it be possible to create a custom made instanced shader, that would use the GPU culling data?

    Yeah, very broad question. I was mostly interested in the authors thoughts on this.
     
  24. RodneyGD

    RodneyGD

    Joined:
    Jun 3, 2019
    Posts:
    5
    Hello there!
    Is there a way to build GDOC with IL2CPP scripting backend? It only seems to work with Mono in our project.
     
  25. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Just noticed something weird. Like a race condition between GDOC and the camera.

    If the camera is rotated too fast (e.g. via user input) objects stay invisible for about 1~2 frames. Have anyone else encountered that? Any ideas how to fix that?
     
  26. Manufacture43

    Manufacture43

    Joined:
    Apr 21, 2017
    Posts:
    140
    Is the Switch supported? How is performance?
     
  27. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    Okay, so I've somehow managed to hang Unity Editor with this plugin. I've added another layer and different culling mask setup for the lights, and its now hanging constantly after scan completes.

    If I disable scanning everything works just fine.

    Not sure what's causing this though. Need to investigate.
     
  28. toads

    toads

    Joined:
    Sep 6, 2019
    Posts:
    1
    When using LWRP with GDOC, there is no UnityEngine.Experimental.Rendering in the 5.16.1 version of LWRP.
    How should I handle it?
     
  29. Dturk34

    Dturk34

    Joined:
    Nov 13, 2014
    Posts:
    24
    It's a very good asset but It's still not working in HDRP, the developer does not answer for almost 5 months.
     
  30. keeponshading

    keeponshading

    Joined:
    Sep 6, 2018
    Posts:
    937
    Hello. We plan to integrate GDOC deeper in our BuildIn RP scenario.
    Do you plan to further support the Asset.

    Latest version was released
    Version1.2.2(current)
    Released: Apr 3, 2019

    Do you plan to further support it.
    An Roadmap would be great.
     
  31. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    Hey everyone, I'm back. New version is coming soon!
    I'll answer to your questions and post more details later this/next week.
     
  32. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    The upcoming version will support the latest LWRP (currently testing with 6.9.2) and even HDRP (because unity finally fixed its extension API).

    Not yet, and the upcoming version will still be Windows-only
    But I'm also working on GDOC 2.0 that will work without the currently used native dll
    It will require Unity 2019.1+ (older versions don't support all the required functions) and will support most modern platforms except mobile.
     
  33. manpower13

    manpower13

    Joined:
    Dec 22, 2013
    Posts:
    140
    Also curious about this! Looks very cool =)
     
    Superjayjay, WildStyle69 and Teila like this.
  34. DigitalBiteGames

    DigitalBiteGames

    Joined:
    Mar 30, 2016
    Posts:
    17
    I hope it will be released soon ;) I really need HDRP support
     
  35. xVergilx

    xVergilx

    Joined:
    Dec 22, 2014
    Posts:
    3,296
    @drcrck Any news on the HDRP support or 2.0?
     
    dirkjacobasch and WildStyle69 like this.
  36. Virtareal

    Virtareal

    Joined:
    Aug 19, 2017
    Posts:
    2
    This asset support LWRP for VR?
     
  37. DigitalBiteGames

    DigitalBiteGames

    Joined:
    Mar 30, 2016
    Posts:
    17
    Still waiting for any feedback or update, is asset dead already?
     
    WildStyle69 likes this.
  38. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    There were some unexpected delays but I'm back and the planned update will be finished soon
     
  39. peaj_metric

    peaj_metric

    Joined:
    Sep 15, 2014
    Posts:
    146
    Are there any news on supporting multiple cameras?
    If not could you tell me what is preventing GDOC from simply running once per active camera?
     
  40. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    I'm currently working on a new version that doesn't need a native DLL and can work on any modern platform (not sure about mobiles yet). It already supports multiple cameras and has many other improvements and new features.

    It will be soon available for testing on Discord for everyone who has it purchased on the asset store (PM me your invoice number): https://discord.gg/hMUTyfZ
     
    Last edited: Apr 24, 2020
  41. Firlefanz73

    Firlefanz73

    Joined:
    Apr 2, 2015
    Posts:
    1,316
    Will this be a same asset or a new one we Need to buy again?

    Will it be compatible and as good maybe better for PC standalone Project like the current one?

    Thanks a lot, sounds great!
     
  42. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    Most likely it will be a new asset with a cheap upgrade option, but it's not settled yet.

    It's not directly compatible. But API is more or less the same and old components (GDOC_Group, GDOC_Occludee) can be auto converted to new ones.

    It's already better both quality and performance wise and will be improved further with its new modular and flexible design.
     
    tspk91 and Firlefanz73 like this.
  43. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    New multi-platform version of GDOC is almost here!

    This time everything is implemented in Unity without a native DLL, with all the source code available. More info and a Unity package will be posted on Discord soon. Join https://discord.gg/hMUTyfZ and PM me your invoice ID to get access to the private channel.

    Meanwhile you can check out the latest demo build:
    https://drive.google.com/open?id=1ENMOjtJnXvdgMtT4svr5-ObztvBBBdUa
    Windows x64, DX11 built with Unity 2018.4, IL2CPP
     
    Last edited: Jul 25, 2020
  44. alex_1302

    alex_1302

    Joined:
    Aug 20, 2019
    Posts:
    54
    HI. drcrck first of all. congrats for your asset, it's very amazing. i only have a little question:
    - i have an scene with animated characters (they use animator to animate a gameobject hierarchy) so we are speaking of dynamic objects. your asset is making occlusion of these characters very fine, but i note a drop in fps when my game begins to spawn (add at runtime) these characters, i suspect that GDOC is not including on its list of objects to occlude. note that when this characters are generated at level's start they are occluded without problem. but after play during a while (30 mins aprox.) the characters are spwaned and the fps drops. maybe i need to call some method in gdoc to update the list of gameobjects to occlude ?. thanks in advance.
     
  45. Unityaware

    Unityaware

    Joined:
    Feb 14, 2014
    Posts:
    101
    Hi, I am setting up a scene for the Oculus Quest, unfortunately as it stand the frame rate is a little on the low side. So I just installed GDOC. I am a little confused about the setup for the Oculus Player Controller. In your Quick Start instruction you said the following (my queries / comments in red):

    1) Add GDOC component to your main camera (I added GDOC_FPSCController to OVR Player Controller)

    2) Assign your main Directional Lightif it’s not set automatically (there are only point lights in my scene, about 60)

    3) Disable Background Scan if you don’t create new objects at runtime (I don't know where to look for Background Scan and how to disable it)

    4) Disable Show Info and Enable Hotkeys for release builds. (I don't know where to find these)

    It may come across as dumb of me but I really don't know the answers. Thank you for helping me out.
     
  46. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    Unfortunately GDOC 1.2 (and 1.3) doesn't support Android and can't be run on Oculus Quest
     
  47. j_ho_74

    j_ho_74

    Joined:
    Aug 13, 2014
    Posts:
    24
    Hi
    any ETA of the 1.3 Version?

    Kind regards
    J
     
    dirkjacobasch and Firlefanz73 like this.
  48. drcrck

    drcrck

    Joined:
    May 23, 2017
    Posts:
    328
    If you mean 2.0, it's coming out soon
     
  49. j_ho_74

    j_ho_74

    Joined:
    Aug 13, 2014
    Posts:
    24
    Cool looking forward to it
    J
     
  50. draverik

    draverik

    Joined:
    Feb 17, 2019
    Posts:
    19
    Hello,

    I bought your package but it dosn't work on empty URP project. I opened demo scene and after scanning there is nothing change.