Search Unity

InstantOC - dynamic occlusion culling + LOD

Discussion in 'Assets and Asset Store' started by frenchfaso, Jan 18, 2013.

?

Should I strip out the integrated LOD stuf from InstantOC to make the code more maintainable?

Poll closed Mar 4, 2017.
  1. Yes, I never used it anyway

    50.0%
  2. Yes, I've used it in the past but will only use InstantOC for oc in the future

    50.0%
  3. No, I like it better than the Unity LOD

    0 vote(s)
    0.0%
  1. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy Lars,
    InstantOC already supports multiple layers.
    Multiple tags support is a great idea, I'll schedule it for the next update!
     
    Last edited: Mar 15, 2013
  2. Lars-Steenhoff

    Lars-Steenhoff

    Joined:
    Aug 7, 2007
    Posts:
    2,472
    Good to hear, thanks
     
  3. Krileon

    Krileon

    Joined:
    Oct 30, 2012
    Posts:
    642
    How does this compare to OC of Unity Pro if you don't mind me asking. Is this primarily for Unity Free as OC is Pro only? Would like a fair comparison before purchase if possible.
     
  4. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Krileon,
    Thank You for Your interest in InstantOC,
    please take a look at the FAQ to see how it compares to Umbra (OC of Unity Pro)
    and also check the Manual or the Video Tutorials to gain a detailed insight on how InstantOC works.
    If You have further questions, don't hesitate to contact me.
     
  5. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy Eric,
    I've tried to reply to Your mail, without success! (mail server error)
    I also tried contacting You via the mail address of Your company, with same results!
    The answer to Your question is:
    InstantOC Always needs the IOClod script, also if You don't use Lod meshes.
    So to use only IOC simply use gameobjects without Lod childs (Lod_0, Lod_1, etc..), this will set InstantOC in "IOC-only" mode.
    Hope that helps You!
    Feel free to contact me if You have further questions, perhaps with the Unity forum Messaging system, or with another mail address.

    Regards,
    Frenchfaso
     
  6. FatalNickle

    FatalNickle

    Joined:
    Jul 27, 2009
    Posts:
    37
    Wow, The demo where you can turn on and off IOC is insane difference. This tool seems amazing. Not to sound like a complete idiot.. But how does it generate the lower poly LOD models? Or do you have to model those as well, and have it Switch the model of the game object at your set distance?
     
  7. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello FatalNickle,
    thank You for Your interest in InstantOC!
    For the LOD system of InstantOC You need to provide the different models. You can use either 2 or 3 LOD levels or use dynamic occlusion culling only (no LOD).
     
  8. FatalNickle

    FatalNickle

    Joined:
    Jul 27, 2009
    Posts:
    37
    Okay lol thats what I figured. Either way this thing looks awesome. Love the performance difference. You think you would be able to put a Poly count on screen? That would be tight too. To see the difference in polys when its on/off.
     
  9. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy FatalNickle,
    here are 2 screenshots of the stats window in the InstantOC Demo scene (with and without InstantOC enabled, same camera position)

    $InstantOC_enabled.jpg

    $InstantOC_disabled.jpg
     
    Last edited: Mar 25, 2013
  10. FatalNickle

    FatalNickle

    Joined:
    Jul 27, 2009
    Posts:
    37
    Man thats wild lol. Love it. Good work! Ill be picking this up for sure soon.
     
  11. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    I'm glad to hear that! :cool:
     
  12. augasur

    augasur

    Joined:
    Mar 4, 2012
    Posts:
    133
    Hi,
    I am going to buy your product, but I have one question.

    My problem is that I have lots of low poly objects ( 40-60 verts) on screen with same material and they all are bathed by dynamic bathing and I get most of my draw calls batched :) So I would like to ask , will I get any kind of performance if I use InstantOC instead of dynamic bathing?


    P.S Could you even do a small test ? :)



    Thanks,

    Augustas
     
  13. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy augasur,
    thank You for Your interest in InstantOC!
    I will be glad to prepare a Webplayer demo for You. Could You provide me a test scene with this characteristics?
     
  14. augasur

    augasur

    Joined:
    Mar 4, 2012
    Posts:
    133
    Hi, thanks for replying.

    I am adding unity scene with lots of cubes :D , you should enable dynamic batching in unity editor, to test the scene.

    BTW, my scene in game will not be lightmapped, so dynamic bathing will work.



    P.S I have seen, that that you have android version, so could you even testit on it ? :) I am targeting for android :)


    Thanks,

    Augustas.
     

    Attached Files:

  15. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Good day.
    I'm not sure if I want to buy it, because I've already bought an other LOD script, but wich is outdated.
    So I have somme questions, before I'm going to buy it:
    1) Does it support objects with multiple meshes (I think they are?
    2) Is there a possibility to define how often the LOD script is triggered? (To improve CPU-performance)

    For me, only the first question is relevant for buying it, but I would like to know booth. ;)

    (I'm sorry for my englisch, it's not my strength...)

    I wish a good day
    Chillersanim
     
  16. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy Chillersanim,
    thank You for Your interest in InstantOC!
    to answer Your questions:
    1) Yes, InstantOC supports GameObjects with multiple meshes
    2) The ray-based LOD system in InstantOC is already highly optimized, but You can tweak the options further if You need.
     
  17. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Good day frenchfaso
    I thank you very much for you fast answer.

    Because of this information, I'm going to buy it right now. :)

    May I ask you another thing?
    I want to use it for a game wich I'm making in a group. Do the others also need to buy it or is it alright if we buy it only once for the team?
    It's clear for me, that the others only use it for this project, I'm not going to share it with them for they'r other projects.

    A good day
    Chillersanim
     
  18. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy Chillersanim,
    thank you for your purchase!
    It's ok for me if you share it with your team for your current project, of course I would highly appreciate if your team members would decide to buy InstantOC for their own projects :)
    Don't hesitate to contact me if you need help with InstantOC!
    Happy coding :)
     
  19. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    I already have a game and with lots of objects and many are with parents for example there are particle effects inside another object... How can I really do this to apply to all my game objects? Your script requires a Collider for all objects that needs, so maybe it will affect performance? And I tried adding a mesh collider and the layer mask to the parent but does not work. It should be to the child. Please guide me please. Thank you so much,
     
  20. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy nemoryoliver,
    InstantOC needs 1 collider (simple/mesh/compound) for every "entity" you want to hide/show as a whole.
    It supports "entities" with multiple meshes, so for instance, if you have a parent GameObjects with multiple child meshes/GameObjects, you can either have the collider attached to one of the child or to the parent, remember to set the correct layer for the GameObject that actually has the collider and to add the IOClod component to the parent.
    Let me know if this helps, if you want you can send me a sample GameObject hierarchy and I'll show you how to set it up with InstantOC.
     
    Last edited: Apr 5, 2013
  21. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    $Untitled-1.png

    That's the heirarchy. I have a lot of that in my scene. Sorry I am also a 2 week old Unity Dev. If I add a Mesh Collider to the barier object it is not applied to the game objects in the project so I really need to add it one by one. But I know there is an easy way. Also how to work with InstantOC and Particles without colliders? If I put colliders to particles I guess it would be expensive for performance? I will also try what you said. Thank you a lot.
     
  22. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    also is it a good idea to add a box collider instead of a mesh collider to these simple objects?? Actually no game objects interact with these objects in the scene so it doesn't really need a collider. I am making a side scroller game and these are just backgrounds.
     
  23. nemoryoliver

    nemoryoliver

    Joined:
    Nov 19, 2012
    Posts:
    38
    I already how to do it. Thanks a lot. Only thing I can't do now is how to apply it to lights. I tried it and doesn't work. I guess your script needs a Mesh Renderer? But a light doesn't have. So please I hope you can tell me how to make it work. Thank you once again.
     
    Last edited: Apr 6, 2013
  24. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Looks great!
    I've tried it a bit and it just looks great!

    There is only one thing I miss... (or have I just overseen it?)
    A possibility to turn the whole object rendering off after a distance (perhaps Lod_3 object but always without mesh).
    This would be great for big scenes where you have big objects, where you need to use all three lod levels, but want to turn it off after a distance (e.g. a big tower or a monument).
    If I have overseen the option, then I'm really sorry about this, but I didn't find it yet.

    I think, the only way to improve this mechanism further (ignoring the point above), would be, to allow the lod settings for each object already in the library, so the developer has only to set up the lod once for each object. That would be a great advantage for development teams, wich works with people wich only makes models and placement but don't want to know anything about lod.
    I know, there is always a way to improve something more, so I'm sorry if it sounds like your work wouldn't be great! ;)

    I'm using it with big pleasure, even without this option, it's just great!

    Greetings
    chillersanim
     
  25. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    @nemoryoliver
    Looks awesome! And that only after only 2 weeks with Unity!!!
    - make a Prefab with barrier + collider + IOClod, then use the prefab in your scene. Every time you change the Prefab, all barriers in the scene update automatically
    - if your objects don't interact with others, enable "Is Trigger" on the collider. InstantOC will still work, but the collider is lighter on the CPU
    - you can try a box collider, but for more precise occlusion, I suggest a mesh collider or a compound colllider (resamble the barrier with more box colliders)
    - currently InstantOC does not hide/show lights and particles

    @chillersanim
    Thank you!
    You are right, currently you can do it by setting up the Lod_3 without meshes, I'll either add a Lod_4 or the ability to hide the Lod after a certain distance in a future release.

    I'm not sure I've understood what you meant, currently if you set up lod settings in IOCcam component they will be applied globally, or if you use prefabs, you can set up lod settings for your prefabs in the library (IOClod component) and when you change something there, all prefabs in the scene will update automatically
     
    Last edited: Apr 6, 2013
  26. jessica1986

    jessica1986

    Joined:
    Feb 7, 2012
    Posts:
    622
    How will i manage my objects in the scene if i buy your asset ?

    I dont have any LOD's made for my scene. I am confused, does it automatically creates LOD.. Please guide me on this before i make a purchase
     
  27. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy Jessica,
    thank you for your interest in InstantOC!
    InstantOC does not generate automatically lod levels for your models, you have to provide them.
    If you don't have lods, InstantOC will do dynamic occlusion culling but not lod management.
    Please take a look at the faq to gain an insight on InstantOC and to find out wether it will be useful in your case or not.
    Don't hesitate to contact me if you have further questions.
     
  28. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Hmm, sounds good.
    As far as I understood you, I have to add the IOClod to my library object. Am I right?
    But how can I add a component to a library object? Unity won't allow me that.
    I made in Blender three objects called Lod_0, Lod1 and Lod_2. When I import this .blend, Unity generates automatically a hierarchy with all this objects, but in the project-explorer, I cannot select an object and add a script to it.
    Could you please explain me, how you thought to do it?

    Thank you very much.
    Chillersanim
     
  29. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Ah ok, I see,
    please take a look at the LOD video tutorial and let me know if it helps. There you can see how to set up LODs in InstantOC.
    Basically:
    - create an empty game object as the parent
    - drag the 3 lod models inside the parent
    - add IOClod component to parent and drag the parent from the "hierarchy panel" to the "project panel" (this will make it into a Prefab)
    from now on, when you change the Prefab in the "project panel" every instance of it in the "hierarchy panel" will update automatically
     
  30. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
    Hi!
    Does it works with slicing terrains?
    ¡EDIT: It doesn't work :(
    Thanks
     
    Last edited: Apr 8, 2013
  31. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Thank you verry much. That was exactly what I was looking for!
    I've tested the LOD system a bit.
    Later I will write a review for you'r LOD, that's because I want to test it first on a larger scene with many different objects.

    Thanks again for you'r wonderfull LOD, im verry happy, that I don't have to write it on my own.

    Greetings
    Chillersanim
     
  32. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Thanks!
    I'm glad to hear that :)
    It would be awesome if you could find the time to write a review!
     
  33. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello KirbyRawr,
    InstantOC does not automatically "slice" unity terrains, but you could use it in conjunction with terrain slicing utilities like this one.
    Every terrain slice would be treated like an object and occluded slices would be hidden.
     
  34. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
    Yeah i have this plugin but the instantoc doesn't work with the terrains...
    I think it's because of the terrain collider, but i don't know.
     
    Last edited: Apr 8, 2013
  35. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Aha I see, thanks for pointing this out!
    I will look into that and let you know.
     
  36. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
  37. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Hello Frenchfaso
    It's me again..

    I've tested you'r Lod system now with a larger scene an saw something you could possibly improove.
    The objects with Lod-Only, doesn't get hidden if they are behind the camera.
    The Lod-only setting is for smal objects for avoiding flickering is it?
    I think it easy to check if the object is just hidden or behind the camera.
    All objects behind the camera (or even outside the camera angle) could be hidden anyway what would increase the performance a little bit more.

    I hope, that I helped a litte bit. :)

    Greetings
    Chillersanim
     
  38. ronan-thibaudau

    ronan-thibaudau

    Joined:
    Jun 29, 2012
    Posts:
    1,722
    I assume the reason is if you hide something as soon as it's behind the camera, you hide it's shadow too?
     
  39. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Chillersanim,
    Unity does this optimization already, it's called "view frustum culling", every object that is not inside the view frustum of the camera, is not rendered.
    It's present in all version of Unity (also Unity free) and plays nice with InstantOC.
    In editor mode, you see the objects behind the "play time camera" because they are in the view frustum of the editor view camera, but at play time it's not the case.
    In a future update InstantOC will give you the possibility to hide LOD game objects that are farther than a certain value.
     
  40. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Hmmm, that make sense.
    But why does the triangle counter counts this hidden objects even when I move the model view and the camera out of sight?
    Is it because of what ronan.thibaudau said?

    Greetings
    Chillersanim
     
  41. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello chillersanim,
    that sounds strange.. I'll do some tests.
     
  42. freakprince

    freakprince

    Joined:
    Apr 25, 2012
    Posts:
    63
    hey im getting this error...anyone knows how to fix it?

    NullReferenceException: Object reference not set to an instance of an object
    IOClod.ShowLod (Single d) (at Assets/InstantOC/IOClod.cs:238)
    IOClod.Update () (at Assets/InstantOC/IOClod.cs:115)
     
  43. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello freakprince,
    Would you mind sending me the scene with the error (via pm or mail) so that I can figure out what the problem is?
     
  44. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    @ Frenchfaso
    I know now what was the failure... I had a terrain, witch doesn't get occluded when out of sight.
    So it was my fault. :oops:
    I have another question, is it possible to turn of physics off for an object witch is occluded or at least al the last LOD?

    Hope, that all my questions doesn't bother you to much, I'm just interested in all the features of your great project. ;)

    Greetings
    Chillersanim
     
  45. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello chillersanim,
    I'm glad to hear that!
    No problem with questions :) feel free to ask!
    Regarding physics, it is possible, the way to do that depends on the hierarchy of your object.
    For instance, you could add a script which checks the "hidden" variable of IOClod (you have to make the "hidden" variable public)

    Code (csharp):
    1.  
    2. void Update() {
    3.    int frameInterval = Time.frameCount % 50;
    4.    if(frameInterval == 0)
    5.    {
    6.       if(var ioclod = GetComponent<IOClod>())
    7.       {
    8.          if(ioclod.hidden)
    9.          {
    10.             rigidbody.detectCollisions = false;
    11.          }
    12.          else
    13.          {
    14.             rigidbody.detectCollisions = true;
    15.          }
    16.       }
    17.    }
    18. }
    19.  
    This c# example checks every 50 frames if the current object is hidden (by InstantOC), if it's hidden it disables rigidbody collisiondetection (which is the heavy part on the CPU), else it re-enables it. Completely disabling Physics is not possible.

    But Unity physics are already heavy optimized, basically, when a rigidbody stops moving, it enters a "sleep" state (no more calculations on the CPU), when it gets hit by another rigidbody, it becomes "activated" again (CPU calculates again).
    So I would say, apart from very rare situations, don't bother optimizing physics, Unity does it already for you.
     
    Last edited: Apr 15, 2013
  46. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Well that sounds very cool.
    I will try it out, when I get to much cpu overhead, but when you say, that unity already optimised it a lot, I will believe you. ;)

    I just have another question, is it possible to have the LOD already in the scene view, so that making very big scenes is possible. I'm working on a open world game with the size of ~8x8km.
    Do you think that it is possible with your script?

    Greetings
    Chillersanim
     
  47. Kirbyrawr

    Kirbyrawr

    Joined:
    Jul 23, 2012
    Posts:
    935
    Me too, thanks since this plugin cannot lod terrains or disable them
     
  48. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Well the unity terrain is already heavy optimized, look at it in the wire mode. My opinion was, that a big scene also has many objects. Therefore it would be great if they can be hidden at a certain distance.

    Greetings
    Chillersanim
     
  49. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    I have an oftopic question, but I hope, that you can forgive me for that. ;)

    I have an object, with three lod levels, each lod level contains an amount of sub objects because i want a precise collision.
    I'm talking about a book shelf. The single objects of this book shelf share the same material but don't get dynamicaly batched.
    Is this because I have child objects in each object?

    Greetings
    Chillersanim
     
  50. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Exactly, Unity terrains are indeed already highly optimized.
    I will give a look at enabling the IOClod in editor, sounds like a good feature for an update :)
     
unityunity