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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Instant Occlusion Culling - for all versions of Unity

Discussion in 'Works In Progress - Archive' started by frenchfaso, Jan 2, 2013.

  1. dirtybassett

    dirtybassett

    Joined:
    Oct 3, 2012
    Posts:
    59
    Really need this.
     
  2. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    You seem to have convinced me. Excellent job. Any ideas on release date?
     
  3. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    Will that work with games with dynamic terrain, such as Minecraft clones?
     
  4. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Good evening Sir,
    Thank You for your interest! I really appreciate it :)
    I'm currently working on the finishing touches, and the custom user interface; trying to make it really easy and intuitive to use!
    It will be priced really aggressively, a must have for Every Unity user :D
     
  5. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    You can choose which GameObjects will use InstantOC and which not, so I suppose the answer is yes.
    But if the terrain consists of one big Mesh, it will be treated as one (visible/hidden)
     
  6. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    So, would this not work on Unity Terrain?
     
  7. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    No, sorry.. but Unity terrain is already optimized (I think some kind of distance based dynamic tessellation)

    PS: You could make many smaller terrains, and stitch them together with some script like this one.
    With this trick you can use InstantOC also with Unity Terrains

    PS2: You can design the entire terrain as usually in Unity and then split it in smaller pieces with this extension

    So finally I should perhaps reconsider my answer.. YES, You can use InstantOC with Unity Terrain, just with some little more tweaking!
     
    Last edited: Jan 5, 2013
  8. darkhog

    darkhog

    Joined:
    Dec 4, 2012
    Posts:
    2,218
    From what I have gathered, in most minecraft clones every chunk is separate mesh, so I think it would work.
     
  9. SevenBits

    SevenBits

    Joined:
    Dec 26, 2011
    Posts:
    1,953
    Ah, okay. I suppose native occlusion culling would be better with Unity, as it is integrated into the engine, but with the methods you just mentioned yes I do suppose one could get a decent result.
     
  10. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
  11. ersaurabh101

    ersaurabh101

    Joined:
    Oct 8, 2010
    Posts:
    412
    1 query -

    can it also work on dynamic lights ?
     
  12. jc_lvngstn

    jc_lvngstn

    Joined:
    Jul 19, 2006
    Posts:
    1,508
    So...I did some testing, to see...if maybe, just maybe InstantOC could compete with Unity's built-in tree system.

    This are just quick and dirty test results, just my initial tests. Please don't hold my feet to the fire on these, ok? :)

    That being said:

    I used Forester Pro to create a nice maple tree. Nothing -too- complex, but a nice one regardless. 3981 verts, 5192 tris, 2 submeshes blah blah.

    First, I placed 4000 of them with Unity's mass place. I cranked up Tree Distance, Billboard Start, and Max Mesh trees all the way to max. So there were 4000 trees effectively, full meshes, no billboards.

    The framerate I got was about 25 fps. Eeeeh.

    Ok, I then ran a script that created 4000 instances of these instead, at the exact same position as the terrain trees. For a bit of added fun..I added a random rotation. Terrain trees with rotation so they don't look so bad...wouldn't that be nice?

    Ok. Anyway...
    Results:
    Instant OC runs at about 50 fps, sometimes 48 or 49. That's....
    S***. That's almost double Unity's. AND I was using the full mesh. InstantOC lets you have 3 lod levels. I could have the full mess for 1, a slimmed down mesh for 2, and a billboard (much higher resolution by the way) for 3.

    I'm so excited. The big reason I did this was, my project needs to modify the terrain on the fly, and trees cause a big spike when that happens. Its multiplayer. So if this happens for one person...well, it's odd but no biggie. But imagine if you are playing with 10 (or more) people, all of them digging. Your whole game experience would be a series of hitches in framerate. Unacceptable.

    This (hopefully) totally changes that. I can stream in trees totally independant of the terrain. AND I GET ROTATION. It looks...so nice. Instead of needing several rotated prefabs of the same tree in order to get sorta decent variety...I don't need that at all.

    Forester Pro lets you export models at various levels of detail (including a billboard bitmap).

    So...the downsides that I can think of right now:
    Creating 4000 instances of -anything- does eat up some memory, and also takes a while. I'll look at improving this.
    The billboards don't rotate depending on your view, like Unity's. Honestly...um, I don't know that I care, if I can use meshes or LOD meshes that give even better performance. Hopefully...the billboards will be so far away, it won't -matter-.
    What else...hmmm, nothing right now. It only works with tree meshes, not trees made with the Unity tree creator. I'm fine with that, the trees from Forester are pretty nice.



    Also...
    Just for fun...I put the bumped diffuse shader on the trunks, and the Transparent/Cutout/Diffuse shader on the leaves. This gave me full shadows and such.

    I then turned on soft shadows with a directional light. Only then did the fps drop to about 27. Still above what the terrain engine was giving me.
    Anyway...this is very exciting, for me at least.

    $testoc.jpg
     
  13. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello ersaurabh101,
    do you mean realtime shadows?
    Yes, InstantOC is fully compatible with realtime shadows :)

    PS: this thread was the "work in progress" thread, please go to this thread for anything about InstantOC.
     
  14. kurylo3d

    kurylo3d

    Joined:
    Nov 7, 2009
    Posts:
    1,123
    This may have been answered already, but what is the difference (performance wise) between unitys occlusion culling baking system and this one? Im lookign to squeeze most possible performance out of a mobile game.
     
  15. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello kurylo3d,
    thank you for your interest in InstantOC!
    In big scenes with many occluders (cities, large interiors with many rooms, both mixed together (open world with cities/villages and craves/dungeons)) there should be little difference.
    That being said, InstantOC is ray-based, so there is always some overhead, but it becomes insignificant in scenes like mentioned before (big scenes with many occluders) and the benefit is far greater than the little overhead.
    If you have LODs for your models, you also gain a performance boost from the InstantOC ray-based LOD system and because you already fire rays for the Occluison Culling, there is no additional overhead!

    Please take a look at the InstantOC faq, the video tutorials and the manual, to find out if InstantOC is right fr your case.
    Feel free to contact me if you have further questions.

    This thread is outdated, it's the old "Work in progress" thread; please follow the official InstantOC thread for latest and updated info, news and help from the InstantOC community.
     
    Last edited: Jul 30, 2013
  16. Jalechah

    Jalechah

    Joined:
    Mar 12, 2014
    Posts:
    10
    Sorry if this issue has already been brought up but I'm experiencing a lot of flickering in my scene. What's the best solution to fix this?
     
  17. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Jalechah,
    thank you for your purchase, it depends on the scene that you have, there are a coupe of options;
    would you please forward your question on the official InstantOC thread, so that we can hold all Q/A in one place?
    I'll be glad to answer it in detail!