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. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    The unity trees are pretty fast handled, but you only have the full-resolution tree and some billboards.
    When you want gradual quality decrease with multiple lods and occlusion culling, then you could use InstantOC, but you wouldn't be able to use the terrain tree painter.

    InstantOC emits it's rays from the camera to every visible point on the screen. So each part of your scene that is visible in the game view or camera view, will receive a ray at some time. So the system is usable in all terrains.

    Greetings
    Chillersanim
     
  2. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello bhads44,
    thank you for your purchase, chillersanim answer to your question is precise and detailed as always
    (thanks chillersanim!)
    If you need more help with InstantOC setup, please let me know!
     
  3. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    results are coming, please stay tuned! ;-)
     
    IllogicalGames likes this.
  4. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello adde210,
    thank you for your purchase!
    Yep, a new video-tutorial series is definitely on the to-do list, I'm currently working on a complete refactoring of InstantOC, which may or may not imply a UI modification. So the new tutorials will come after this update.
    In the meantime, I will be happy to help you here on the thread and/or through email.
     
  5. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hy Chillersanim,
    I'm still working on it, but we are getting closer.
    We definitely will have full compatibility at the end, for maximum users joy :)

    PS: I'll never say "Thanks!" enough for your relentless support here on the thread!
     
  6. IllogicalGames

    IllogicalGames

    Joined:
    Apr 16, 2013
    Posts:
    153
    ahh cant wait for the result. glad that you figured it out.
     
  7. adde210

    adde210

    Joined:
    Aug 28, 2014
    Posts:
    27
    okey can u PM me your Email ThX
     
  8. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Sure, done :)
     
  9. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    110
    Hello, is this system compatible with the Oculus Rift?

    Looks great, I'd buy it in a heartbeat if I knew it worked with the rift :)
     
  10. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello cmart,
    thank you for your interest in InstantOC!
    Yes, it works great with the Oculus Rift, and in a variety of "multiple-cam" situations (split screen, stereo, minimap, etc..).
    Many users here are already using it with the Oculus, just assign InstantOC only to one of the 2 cameras of the Oculus, and you are ready to go!
     
  11. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    When you can have the situation, that you look around a corner and one eye can see much more than the other, then I would recommend you to assign the IOCcam to both cameras and give them an equal ray amount.
    If you assign an IOCcam to only one eye, then the other eye cannot see objects that are not visible to the first eye.

    Greetings
    Chillersanim
     
  12. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Yep, or if for some reason you don't want the second IOCcam, then you can assign it to only one camera, and offset the raycaster to the middle point between the two cameras. This would offer the best balance between high precision and simplicity/lightness.
     
    Last edited: Sep 15, 2014
  13. cmart

    cmart

    Joined:
    Jul 10, 2012
    Posts:
    110
    That is what I was thinking, put it in the center. Thanks for the info frenchfaso and chillersanim, looks like I'll be picking this up pretty soon.
     
  14. laurent-clave

    laurent-clave

    Joined:
    Jul 18, 2011
    Posts:
    278
    I FrenchAso,

    I use InstantOC in my project who contain multiple Terrains (with Terrain Composer).
    I have a clipping at far distance.
    The view distance don't change the clipping
    What the problem ?

    Thank

     
    Last edited: Sep 17, 2014
  15. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    389
    Hi,

    I just came across this asset today and thinking of buying it - seems very impressive, particularly for procedural content.

    Could you please let me know the roadmap for new features etc and when the next version might be out with Terrain support, as this seemed tone mentioned a few months ago?

    cheers

    Nalin
     
  16. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello laurent.clave,
    Sorry for the delay! I'm not sure I get it right, should there be terrains visible inside the red circle?
    Are they visible if you disable InstantOC? Or does the problem persist?
     
  17. Thiago-Crawford

    Thiago-Crawford

    Joined:
    Jan 7, 2013
    Posts:
    92
    Hi,

    I got your product, works great, really glad I bought it, but I keep getting this error:

    IndexOutOfRangeException: Array index is out of range.
    IOClod.Update () (at Assets/InstantOC/IOClod.cs:197)

    I am not using any LODs in my scene, and generally don't think its effecting the performance, but what is this exactly?
    Thanks
     
  18. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Nalin,
    thank you for your interest in InstantOC!
    the next update will bring the following features:
    - terrain culling (more Unity terrains or one terrain split with other Asset Store Utilities)
    - occludee support
    I cant assure a fixed date, (I am in the middle of a big transition! (which will, by the way, make me a full-time IndieApp Developer)) but it should be out before Christmas.
    As a consequence of becoming a full-time IndieDev, I'll be able to spend much more time on InstantOC development.

    There is also an ongoing effort to make InstantOC and QuickLod work super-smooth together (they are already compatible to some degree)
     
  19. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Thiago Crawford,
    thank you for your purchase, I'm glad you like InstantOC!
    Please double check TAGs and collider layers, it's usually a mismatch between this 2 things.
     
  20. Thiago-Crawford

    Thiago-Crawford

    Joined:
    Jan 7, 2013
    Posts:
    92
    Thanks, I tried that just now, but have actually found out the error seems to come from some objects (in the appropriate tag and layer) that do not have a renderer component.
    I untagged these objects, and the errors have stopped. They are pretty much empty objects that got imported along with other things.
     
  21. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    389
    Thanks for this.

    I just wondered how IOC works best with MeshCombine type scripts like the CombineChildren one that comes with Unity? or is it best not to combine objects this way that are candidates for occlusion?

    Cheers

    Nalin
     
  22. eridani

    eridani

    Joined:
    Aug 30, 2012
    Posts:
    655
    When occluded objects come back into camera, there is a slight delay before they reappear, so they seem to pop into existence out of thin air. What is the least expensive way to get rid of this slight delay... I'm running on mobile so I don't want to do something too expensive like tons of IOC raycasts every frame. Thank!
     
  23. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    You can increase the fov (field of view) in the IOCcam, so that objects outside the camera frustum can be preloaded when turning the camera.

    Greetings
    Chillersanim
     
    hopeful likes this.
  24. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    As chillersanim wisely suggested, increasing the fov is the first thing to try.
    one other thing you could do, is to group small, adiacent game-objects together, so that InstantOC can handle them as a whole. Slightly increasing the Ray Samples may also help a little bit, without weighing too much on the cpu.
     
  25. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Nalin,
    sorry for the delay!
    I would either use one technique, or the other. If you have many objects that occlude each other, you'd better bet on occlusion culling. If you have many sparse objects (poor occlusion), then some mesh-combine/batching could give you better results (or LOD if applicable).
    Please note that InstantOC supports Unity's dynamic batching, effectively combining the 2 techniques at some degree.
    Note also that in a large level, you could have somewhere a situation more suitable for occlusion culling, and somewhere else (but in same level) a situation that's better suited for mesh-combinig/batching.
    In this cases you could use both techniques, one on the objects in an area, and the other for the objects in the other area.
     
  26. Gua

    Gua

    Joined:
    Oct 29, 2012
    Posts:
    361
    2 frenchfaso, I can't find your e-mail anywhere. Can you share it?
     
  27. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Gua,
    sure, you can reach me at frenchfaso[at]live[dot]com
     
  28. puzzlekings

    puzzlekings

    Joined:
    Sep 6, 2012
    Posts:
    389
    Thanks

    I experimented with both and found the Mesh combine approach significantly faster - as I don't have Unity Pro at present.

    cheers

    Nalin
     
  29. jmsalandanan

    jmsalandanan

    Joined:
    Oct 24, 2014
    Posts:
    4
    Hi! I'm getting an error when I implemented instantOC to our project.
    Screen position out of view frustum

    Any idea on what's causing this or how to fix it?

    Thanks! :)
     
  30. kinnik

    kinnik

    Joined:
    Sep 6, 2014
    Posts:
    17
    Hi frenchfaso and friends! Just pick this up and after some ironing got it all working. Lovely and nice price point as well!
    Thank you!


    So, one issue I have is this: Draw Batching seems to work just fine if I disable 'realtime shadows' but is not batching otherwise. I've noticed the 'pro only' next to the feature list about realtime shadows but shadows do work in the indie version if it's only one directional light casting them. The feature list also doesn't mention batching issues with shadows... I donno, I'm still really new to unity. Any idea what is wrong or is this just not going to work with the free version?


    Edit: pardon me! The issue seems to be with using forward lit rendering not your script. For whatever reason Batching doesn't work with forward rendering, only 'vertex lit' and 'defered'. Defered is also only avaible in the pro version of unity... So it seems I have to chose between Batching and Shadows :(

    Edit2:
    Ok.. after more testing it does seem that turning on 'realtime shadows' breaks Batching (at least in the free version of unity). It's kind of a moot point so far, because using forward lit rendering path breaks it as well.

    FYI:
    As I'm guessing you've seen, having the objects that are to be ocluded inside more then one parent seems to break the system and throw null pointer errors.

    Thanks for any help! I consider this a great project regardless of this one issue! Cheers, Kin.
     
    Last edited: Oct 25, 2014
  31. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello jmsalandanan,
    thank you for your purchase!
    Please check the "Rays FOV" value, it should be equal or greater than the Camera FOV.
    Let me know if this solves the error.
     
    jmsalandanan likes this.
  32. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello kinnik,
    thank you for your purchase and your kind words about InstantOC!

    Unity free offers only dynamic batching, and getting it to work is painful. There are many limitations like the number of vertices, the shaders, etc..
    If you don't use dynamic shadows, InstantOC will not break this fragile balance at all, if you enable dynamic shadows in IOCcam, InstantOC has to dynamically change the shader of some game objects (to let hidden objects produce correct shadows). So this objects will not be batched (but all the others will!). At the end, if dynamic shadows is enabled, dynamic batching should continue working, but with less game objects participating to the dynamic batching.

    One last thing, you can surely have a multilevel hierarchy (more parents), the important bit here, is the relative "distance" between the node with the collider and the node with the ioc TAG: you can either have the collider and the ioc TAG on the same node, or have the collider on one node and the ioc TAG on the direct parent.
     
    Last edited: Oct 26, 2014
  33. jmsalandanan

    jmsalandanan

    Joined:
    Oct 24, 2014
    Posts:
    4
    That fixes it. Thanks! Great product and support btw. ;)
     
  34. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Glad to hear this! Thank you :)
     
  35. Gekigengar

    Gekigengar

    Joined:
    Jan 20, 2013
    Posts:
    444
    Watching for future purchase list.
     
  36. RUNIARTS

    RUNIARTS

    Joined:
    Jun 22, 2013
    Posts:
    54
    Dear @frenchfaso !

    Any idea When The New Features / new Version of Instant OC is comming ?

    Its like you announced some cool new Features that you were working for objects in levels streaming & Large open worlds optimization like 2 years ago / but was never done reaaly ...

    Now With Unity 5 64 Bits Around I think many will try to do their own Versions of Far Cry 4 In Unity ... And a better and new updated InstantOC will be reaaly needed for that ^^

    We been having Some Heavy & Strong Chats with QUICKLOD Developer About a Better More Integrated Juntion of INSTANTOC + QUICKLOD For "Open world level streaming" ...

    http://forum.unity3d.com/threads/quicklod-fast-asynchronous-lod-system.237196/#post-1832986

    And you got even some people complaining InstantOc and QuickLod Still not working too well toguether as it should ...

    Check it out !


    Thanks so much.

    Kyo Chun
    KYON Games
     
    kinnik likes this.
  37. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    @3DLABS I'm currently in the process of becoming a full-time IndieAppDev, so I'll be able to spend much more time on InstantOC, I'm almost there, but not quite yet!
    I should be able to publish an update around Christmas, with Terrain support, some performance improvements and bug-fixes, after that, I'll focus on code refactoring and compatibility with the excellent QuickLOD by @chillersanim.
    So have faith and stay tuned ;-)
     
    hopeful likes this.
  38. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Gekigengar,
    glad to read this :)
     
  39. unit102

    unit102

    Joined:
    Nov 13, 2014
    Posts:
    26
    Hi,

    I am using Oculus DK2 and I can't make InstantOC work. This is the error I get once I switch to using OVR camera

    NullReferenceException: Object reference not set to an instance of an object
    IOClod.Awake () (at Assets/InstantOC/IOClod.cs:45)

    this warning shows up after I have switched the player camera to OVR. I tired one eye (left) but did not work, then I tried both (left&right) still did not work.
    I deleted the OVR camera and used the Unity default camera, I added the script and the warning has gone!
    OVR camera doesn't like the script :(
     
  40. unit102

    unit102

    Joined:
    Nov 13, 2014
    Posts:
    26
    nevermind.. Problem solved !
    I went back reading through all the pages of this forum and I read "MainCamera" to be tagged in order to make it work and it worked!
    thanks a lot.. this is a great forum - full of FQA :)
     
  41. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello unit102,
    thank you, glad to hear this!
    I'll update the Readme.pdf to include this note :)
     
  42. unit102

    unit102

    Joined:
    Nov 13, 2014
    Posts:
    26
    thanks.

    does InstantOC work well with Unity 5 right now?
    my project is full of objects and very huge scene (construction project)
    I had to switch to Unity 5 because its 64 bit and can handle large memory (the 32-bit is extremely sensitive to crashes :( )
    I tried InstantOC but it seems little buggy... I tried to tweak the rays, clipping plane but still .. there is a delay for objects to show up and hide.. it just seems not 100% accurate at the moment.
    I tried a small demo (duplicating sphere and cylinder) and its seems to be working well but not for my large complicated scene..)

    I just wanted to know if InstantOC is work 100% right now under Unity 5
    thanks.
     
  43. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    Have you already tried to increase the fow in the iocam component? If that doesn't work, try to increase the ray amount.

    Greetings
    Chillersanim
     
  44. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello unit102,
    it is surely only a setup problem, like Chillersanim already said, try to adjust the "Rays FOV"value, it should be slightly higher then your camera FOV, so, if you have a camera fov of 60, you should set Rays FOV to 70-80.

    InstantOC works pretty well with big and complicated scenes, as a matter of fact, it shows its muscles especially in these cases!

    For best results, it is very important to setup your game objects/prefabs the right way, colliders are very important.
    For precise and rapid results, you should use mesh colliders (with lowpoly versions of your models if available) or compound colliders that resemble the shape of your gameobjects rather precisely. You can set them as triggers only for maximum performance, and use other simpler colliders (on a different layer) for collision detection.

    I haven't tried it yet with Unity 5, but I don't foresee any issues, rather a performance boost, due to the new (and faster) underlying physics system, and the multi-threaded architecture in Unity 5.
    I'll do some tests soon, and report back the results.

    Let me know if this helps!
     
  45. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    126
    Hi There,

    I am pretty new about this amazing Tool, but after testing it a bit I noticed that with the Trees generated by a very popular software as Speedtree it get the following error :

    NullReferenceException: Object reference not set to an instance of an object
    IOClod.Start () (at Assets/InstantOC/IOClod.cs:100)

    Any Idea?

    Tried with "classic" prefabs and it worked. I did not test with Unity trees (but I would never use Unity trees)

    Thanks in advance
     
  46. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello micuccio,
    thank you for your purchase!
    Are you using Unity 5 beta? Is the SpeedTree tree imported as a "normal" model, or is it a special game object?
     
  47. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    126
    Yes I am using the Unity 5 beta.

    The format of the files from Speedtree is .spm

    Please have a look to this pics showing the "architecture" of the file:

    Each of the file is a .spm (I think is an acronim for SpeedTree Modeler, just my guess), even the single meshes.
    I tried to apply your IOclod script to the Parent but i got the previous error...

    I hope you can have a suggestion to deal with, these trees are amazing but very heavy :(
     

    Attached Files:

  48. chillersanim

    chillersanim

    Joined:
    Mar 31, 2013
    Posts:
    218
    IOC uses an object hierarchy like this:
    • IOClod
      • Lod_0 (Not sure about the exact naming tough)
      • Lod_1
      • Lod_2
    In this hierarchy it searches for renderers.
    I think, speed tree uses custom components or you don't have the correct hierarchy structure.

    You can try to create your own hierarchy and use the common meshrenderer.
    Reference the lod levels from the tree file in those meshrenderers, then it will probably work.

    By the way, I thought that speedtree offers it's own lod system.
    If I'm not mistaken, why not use that one instead?

    Greetings
    Chillersanim
     
  49. micuccio

    micuccio

    Joined:
    Jan 26, 2014
    Posts:
    126
    @chillersanim
    Yes you are right, Speedtree has its own LOD system.
    But where to apply the IOclod Script? I tried on the Parent one (see picture above) but It does not work...
     
  50. unit102

    unit102

    Joined:
    Nov 13, 2014
    Posts:
    26
    Thanks chillersanim and frenchfaso,

    Sadly I tried everything (I increased the FOV to 120 ~ 150) and samples to 300, 500, 1500 !! to the point it slowed down the scene a bit. (I check the frames per second from the oculus camera script, judder still exist except when I look at the sky :p )
    I believe the problem is my models, I did not make them (these are done by other people, its construction models very complex and in different sizes and shapes, even little screws exist!)
    I am working in a project to make these in Unity with interactivity using Oculus DK2 but I guess it won't be easy :(
    I am thinking to chop these models down using Mesh baker or a unity script because I noticed the 3d pipe models do not get occluded well, they either appear or disappear as 1 object ..that's why I feel its not efficient..
    I checked the profiler as well, some models cost a lot of rendering power...

    I use EVGA GTX TITAN OC 6GB (overclocked) my system is also overclocked (4.5ghz - 32GB) - Intel 730 480GB SSD, Win 64-bit (optimized for performance - no Aero or any fancy visual effects, I completely turned down visual effects in Win 7 for best performance)


    I will continue experimenting, I find InstantOC to be my best choice at the moment, I tried Occlusion culling under Unity 5 (Unity 5 doesn't crash easily like Unity 32-bit !!) but the results were not great :(
    InstantOC gave me a better performance results in the end.. maybe because Unity 5 is still not highly optimized? ... I don't know..
    but anyway thanks guys, I might post my progress if something helped me along the way :)
     
unityunity