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
    Hello PixelNAUTS_Alex,
    I'm glad you like InstantOC, thanks!
    I haven't indeed updated the manual yet with useful occludee info! Sorry :p
    You basically have to follow this steps:
    • create a new layer (call it occludees for instance)
    • choose this layer in the IOCcam script as the "Occludee Layer"
    • add the IOClod script manually to the objects you want to behave like occludees
    • they also must have a collider like regular IOC obejcts and must be on an IOC managed layer (NOT the occludee layer!!!)
    • mark the "occludee" checkbox of the IOClod script
    That's it!
    A couple of notes, occludees in InstantOC are really meant only for transparent objects, as there is no computation difference by marking some objects as occludees.
    The occludee layer is needed, but automatically managed by InstantOC, do not place objects on this layer.
    Hope this helps, let me know how it goes!
     
  2. sgtkoolaid

    sgtkoolaid

    Joined:
    May 11, 2010
    Posts:
    899
    I have animated molecules on a cell terrain. Is Instant OC able to occlude these I am unsure if this is the case as curerntly despite following the steps, it hides everything I set tag to IOC, and the layer to its name then in the camera i set to the object layer I want to hide, occludee layer to occludee, tag to IOC, the objects(tagged as IOC) but it seems to hide it all the way despite looking at it. so its working perhaps I have the wrong set up. what am I doing wrong?
     
  3. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello sgtkoolaid,
    thank you for your purchase, could you please send me a couple of screen-shots, or even better share with me a sample scene that exposes the problem, so that I can figure out what's wrong?
     
  4. sgtkoolaid

    sgtkoolaid

    Joined:
    May 11, 2010
    Posts:
    899
    i figured it out. I applied IO CLOD to the objects manually rather than use a Tag. only issue is now I have a flickering problem with the molecule objects. namely with the molecules moving across in the "sky" a bit away from the camera. they do not have shadows enabled on them. however they do flicker quite a bit. Should I send you the project scene? see what the issue is?
     
  5. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Sorry for the delay,
    sure, send me your project folder via Dropbox or similar, I'll look into it and report back.
     
  6. DivergenceOnline

    DivergenceOnline

    Joined:
    Apr 19, 2015
    Posts:
    244
    Hey dude. I'm still hoping to get in touch with you over skype but i didn't get a response last time I saw you online. I've got two weeks before my game is set to launch and i have a very specific need to get IOC working. Please message me on here or there as soon as you're able.
     
  7. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello,
    sorry for that, I'm online (invisible but online) right now, what is your Skype nickname?
     
  8. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    hello all!
    it works with unity 5.3.1?
    doesn't give errors, but the demo scene seems to do nothing different using or not instantOC
     
  9. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello ghiboz,
    just tried it, it works flawlessly with 5.3.1, toggling InstantOC on and off in the demo scene (pressing "i" key) shows quite a nice performance improvement. Also take a look at the stats window to check the drawcalls difference.
    Could you perhaps share your PC specs? Maybe you have a very powerful CPU/GPU in which case there could be no much noticeable difference.

    PS: do gameobjects hide/unhide when you toggle InstantOC on/off? Maybe there is some problem with layers (if you import InstantOC in an existing project, that may be the case)
     
    Last edited: Dec 21, 2015
  10. ghiboz

    ghiboz

    Joined:
    Sep 7, 2012
    Posts:
    465
    ok, thanks @frenchfaso now seems to work...
    I've included the script into my project, and there's something strange...
    a question: the occludee layer what do?
     
  11. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    The occludee layer is for example for transparent objects (glass, crystals, etc..) if you want InstantOC to manage transparent objects, you need to create a occludee layer (name it as you wish) and choose it in the IOCcam inspector panel. The transparent objects themselves must be placed on an InstantOC managed layer(s) not the occludee layer, this one is automatically managed by InstantOC at runtime.
     
  12. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @frenchfaso
    Any word on updates ?
     
  13. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Currently working on these:
    - automatic LOD Margin (no more fiddling around to find the sweet spot)
    - 4 LOD levels
    - IOC Zones

    First 2 should be submitted in the next couple of weeks. Oh, and of course some more code refactoring/refining as well!
     
    Hybrid1969 and JBR-games like this.
  14. Rod-Galvao

    Rod-Galvao

    Joined:
    Dec 12, 2008
    Posts:
    210
    Hi,

    Does it work with SimpleLOD and/or AutomaticLOD?

    Rod
     
  15. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Rod,
    thank you for your interest in InstantOC!
    I haven't tested it with this 2 systems, so I'm unsure.
    Both seem to be able to generate LOD levels from high-res meshes, so in theory it should be possible to use this LOD levels with InstantOC's LOD system. As of using them directly also to manage the LOD level to render, this could be tricky.
    One LOD system that works pretty well with InstantOC is QuickLod, thanks to the efforts of @chillersanim

    PS: just realized you are the same Rod from the email I responded to :)
     
    Rod-Galvao likes this.
  16. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello there,
    I would like you to try this beta demo of InstantOC 3, which features a new powerful optimization based on the Unity Culling Group API, it will drastically reduce the rather annoying "popping effect" of distant/small/sparse non-moving objects, and enhance the overall perceived quality specially when using low Ray Samples values (for instance on CPU-constrained platforms like WebGL and Mobile).
    Enable the HUD by pressing "H" and play with the "Samples" and the "Culling Group API optimization" values.
    When the latter is enabled you can get pretty decent results even with as less as 10 Ray Samples!!!

    Other useful features of the upcoming (free) update are:
    - automatic "Lod Margin" (manually overrideable)
    - more freedom in setting up your Game Object hierarchy (more then 2 level childs)
     
    Last edited: Mar 15, 2016
    JBR-games and hopeful like this.
  17. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy there,
    just published InstantOC 3.0.0 on the Asset Store, if you installed Unity 5.3.4 you will be notified of the update as soon as it goes live.
    I'll make a blog-post with some more details about this release and the new "Culling Group API" optimization for static objects.
     
  18. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    btw, if you published some project powered by InstantOC, I would really love to hear about it!
     
  19. JBR-games

    JBR-games

    Joined:
    Sep 26, 2012
    Posts:
    708
    @frenchfaso
    Im assuming you are using bounding spheres with the culling groups api, how are you handling different object sizes ?
     
  20. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    I get a bounding-box of the IOC object (can have one or more game-objects) and then create a bounding-sphere with center = bounds.center and radius = bounds.extents.magnitude.
     
    JBR-games and hopeful like this.
  21. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Last edited: Mar 22, 2016
    hopeful likes this.
  22. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    This sounds really nice! I enjoyed using the webdemo, which was impressive. Looking forward to popping it in a build before long. :D
     
    JBR-games and frenchfaso like this.
  23. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    just bought it after having a look on it for a very long time

    the only problem i have with it
    that it does not work fully with opsives third person controller

    if I add the occam to the camera

    it bounces back and forth from the anchorpoint of the camera to the model


    any ideas?
     
  24. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Thank you for your interest in InstantOC and your purchase!
    Would you mind sending me a basic scene that exposes the issue, with just the 3d person camera and InstantOC, so that I can test it? (perhaps via dropbox, onedrive, etc..)
     
  25. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    No Problem, tomorrow ;)
     
  26. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    so finally came round to send you an email :)
    dropbox link is included
     
  27. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Arganth,
    thanks, I'll do some tests and report back.
     
  28. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Arganth,
    to let InstantOC play nicely with the Obsive Third Person Character Controller, please try the following:
    • create a new layer for the camera
    • put the camera on this layer
    • in the "Camera Controller" script, under "Look Options" --> "Obstruction Ignore", select the newly created layer
    This should fix the issue, let me know if all goes well :)
     
    hopeful and Arganth like this.
  29. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    will try it soon ;)
     
  30. Arganth

    Arganth

    Joined:
    Jul 31, 2015
    Posts:
    277
    woah you fixed all of my problems :D
    woah great ;)

    thx so much ;)

    this fixed the "bobbing" issue

    the one with the ray fov
    fixed the error messages popping up ;)
     
    frenchfaso likes this.
  31. mbcauley

    mbcauley

    Joined:
    Jun 1, 2013
    Posts:
    36
    Hi,

    I am trying to get this asset working in my test scene. I have followed the tutorial video but it seems to be missing a few of the parameters such as tags in the IOCcam script. Right now there are certain objects that are hiding but it is not performing properly because certain objects are hidden that are not occluded while others are popping in and out continuously.

    In addition to that, I was wondering if there is a way around the requirement to assign a specific layer to all IOC objects. I am using layers in my project for other purposes (lighting) so this would make implementation much more difficult.

    Any help would be appreciated.

    Thanks,
    Mac
     
  32. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Mac,
    thank you for your purchase, I replied to your email :)
    please check the following:
    • use colliders (mesh or compound) that resemble the shape of the object rather precisely to obtain predictable results
    • either add manually the IOClod script to objects you want to be managed by InstantOC or use the TAG system
    • in the IOCcam inspector, as "Layer mask" you can choose 1 or more layers, you no longer are constrained to 1 layer only
    Let me know if this helps.
     
  33. ThomasBrix

    ThomasBrix

    Joined:
    Apr 30, 2016
    Posts:
    15
    Is it possible to have SpeedTrees show billboards by default and let InstantOC handle the LOD switching?
     
  34. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello @ThomasBrix
    thank you for your interest in InstantOC, I'll have to do some tests and report back.
     
  35. locus84

    locus84

    Joined:
    Mar 30, 2011
    Posts:
    119
    Can I use this asset with CardBoard SDK?
    I mean, does it support two(or more) cameras at the same time?

    I'm having trouble with setting dynamic occluder setting with native unity oc,
    Hope this asset save my project!
     
  36. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello @Iocus84
    thank you for your interest in InstantOC!
    Yes, you can use it for VR (every VR sdk). You just need to attach it to only one camera (left or right eye is up to you).
    InstantOC does support dynamic (moving) occluders, and also procedural content (meshes generated and/or loaded at runtime).
     
  37. Jog

    Jog

    Joined:
    Feb 9, 2012
    Posts:
    138
    Hello,

    A quick question - any chance to use InstantOC combined with additive scene loading? ;)
     
  38. hopeful

    hopeful

    Joined:
    Nov 20, 2013
    Posts:
    5,687
    Instant OC was designed to work with dynamic environments, and that includes additive scenes. It gives you a lot of flexibility, it's easy to set up, and it's very fast.
     
    frenchfaso likes this.
  39. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello @Jog
    thank you for your interest, as @hopeful kindly explained, InstantOC is very suitable for dynamic and/or procedural content, like additively loaded scenes.
     
  40. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Hello, first of all thank you for this great piece of software.
    Now, the problem: I have added IO Ccam to the camera, I have put all the blocks that should be occluders on a layer called BLOCKS, and I have added this layer in the IO Ccam component.
    It doesn't work.
    To test it, I have simply changed the shader of the blocks into one transparent, and I see the whole scene gets rendered continuously.
    The only reason that comes to my mind is that the script takes into account the fact that the shader is transparent, thus letting it draw all, otherwise I can't understand why it's not working.
     
    frenchfaso likes this.
  41. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello @megmaltese
    thank you for your kind words! I'm glad you like it!
    Sorry for the delay, a couple of questions:
    - do the blocks have colldiers
    - do the blocks have the IOClod script attached OR are they tagged with an InstantOC managed tag?

    PS: InstantOC uses colliders to "sense" objects, transparent shaders do not affect this behavior
    PS2: you can though set transparent objects as "occludees", in order to let InstantOC "see" through them
     
  42. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    For what I understood, it was enough to put the objects in a layer managed by IOC, isn't it like that?
    And yes, of course the blocks have colliders, all of them, and they are not triggers.

    What is the best performance? Add a tag to the objects or put the script on them?
     
  43. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    InstantOC needs you also to either attach the IOClod script or assign TAGs to the objects you want to be managed by it.
    There are no performance differences between these two approaches.
    As for optimization, If you don't need full collision detection, you can set the colliders as triggers only, InstantOC works either way.
     
    Last edited: May 12, 2016
  44. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    OK thank you, so I'll also add tags on the objects :)
     
    frenchfaso likes this.
  45. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    OK got it working. However, I tried to use a button to activate and deactivate the component, but it seems there's some problem in deactivating it: it keeps culling off the objects that go out of the camera scope, and it doesn't reactivate them.
    The only way to test performance is to make two builds: one with IO active and one with IO inactive.
    Is there a way to do it with a button at runtime?
     
  46. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Excellent!
    Just drop the Prefab called "IOChud" in your scene, then toggle InstantOC on/off by pressing "i" on the keyboard or touching/clicking the InstantOC icon on the top-right corner of the screen.
     
  47. PolyMad

    PolyMad

    Joined:
    Mar 19, 2009
    Posts:
    2,350
    Thank you very much, dude! :)
     
    frenchfaso likes this.
  48. The_Mean_Fiddler

    The_Mean_Fiddler

    Joined:
    Nov 27, 2014
    Posts:
    17
    Hi - Not sure which version of IOC I'm using. I have a problem with probes because they block the raycasts to the IOClods. If I make the probes too large then the IOClods just stay invisible. Too small and the light goes on and off. Is this a problem you have looked at?
     
  49. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello @The_Mean_Fiddler
    normally it is just a matter of finding the "sweet spot" between probe's radius and probes count, but when this is tricky, you can add and place probes manually.
    Would you mind sharing with me some screenshots, so that I can perhaps give you some more specific advice?
     
  50. The_Mean_Fiddler

    The_Mean_Fiddler

    Joined:
    Nov 27, 2014
    Posts:
    17
    Thanks but I fixed it. I made my probes very very small and saved all their positions. Then every 5 frames I directed some raycaster rays straight at them to see if they were visible. It works perfectly. Placing them manually was a great help. If they are placed randomly they often end up bunched together. I can send you the code if you wish.
     
    frenchfaso likes this.