Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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
    Nope, loading/unloading LODs from disk/memory is not yet implemented, InstantOC currently enables/disables LODs renderers based on visibility/occlusion and distance.
     
  2. ValrikRobot

    ValrikRobot

    Joined:
    Jun 26, 2013
    Posts:
    206
    OK. Once again my fault. I wasn't quite correct in what I said. I did mean loading and unloading prefabs not just using them........

    Excuse my stupidity.......again
     
  3. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    No problem :)
    Feel free to ask here in the thread or contact me directly if you need further help!
    The loading/unloading LODs from/to disk/memory will definitely be added in the 2.x release cycle.
     
  4. Mesothere

    Mesothere

    Joined:
    Sep 16, 2013
    Posts:
    9
    Bought Instant OC today with the hopes of improving performance and I was hoping you could help me out. My original tree model did not seem to work after I set it up with iOC - none of them appeared to occlude properly and the material changed to a textureless pink in some cases.

    I instead switched to another model that had 3 LODs to see if this was the issue, but the same problem occurs.

    Pictures in action:


    Random pink textures

    Scene view with camera frustrum:

    Objects not in view are not culled?

    And my settings:


    I read the documentation but it hasn't shone any light on the issue.

    Would appreciate any and all help on this
     

    Attached Files:

  5. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    @Mesothere
    Thank you for your purchase!
    To see the effect of InstantOC in editor play mode (multiple views) you have to disable "PreCull Check" (turn it back on for fullscreen preview and/or final builds).
    Could you please send me the 2 tree models you have used, so that I can inspect them, make some tests and point you in the right direction?
     
  6. Mesothere

    Mesothere

    Joined:
    Sep 16, 2013
    Posts:
    9
    Ok, so I appear to have gotten rid of the strange pink effect by also importing the IOCHud which I had previously left out.

    My current error lies in the LOD system - I have 3 LOD objects under 1 parent object and it seems the renderers for each are all always enabled if in view. This is surely not correct, but I'm not sure where I've messed up. Any tips?

    Apologies for the frankly awful screenshot, but here's the structure in the scene:
     
  7. Mesothere

    Mesothere

    Joined:
    Sep 16, 2013
    Posts:
    9
    I've just realised they're named wrong. My mistake!
     
  8. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    No problem :)
    The pink-texture problem should not be related to the IOChud presence/absence, IOChud component is just for testing/tweaking, normally you don't put it in final builds.
     
  9. Mesothere

    Mesothere

    Joined:
    Sep 16, 2013
    Posts:
    9
    It seems that the pink-texture issue occurs only when dynamic shadows are turned on. Any solutions?
     
  10. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    That's strange...
    do you have changed/moved files and/or folders inside the "InstantOC" folder?
     
  11. Mesothere

    Mesothere

    Joined:
    Sep 16, 2013
    Posts:
    9
    I don't think so. Here's a look at the folder hierarchy and root folder contents:

     
  12. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Everything seems ok,
    could you please send me the tree model that exposes the problem, so that I can test it and see what's wrong?
     
  13. Mesothere

    Mesothere

    Joined:
    Sep 16, 2013
    Posts:
    9
  14. Mesothere

    Mesothere

    Joined:
    Sep 16, 2013
    Posts:
    9
    Another consideration I had is it potentially interfering with another shader? The trees are using AFS
     
  15. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Mesothere,
    the models alone don't expose the problem, I think you are right, there could be a problem with AFS, but to confirm this and solve possible issues, I need a scene with AFS already assigned to your trees, could you perhaps send me a simple scene with some trees and AFS (to my private email)?
     
  16. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Gecko,
    I just sent you a PM with the custom script for your case, let me know if this works!
     
  17. coffeefery

    coffeefery

    Joined:
    Apr 10, 2014
    Posts:
    21
    Hi frenchfaso, I bought the InstantOC because I needed a way to improve my FPS. Your video demo and constant feedback to the community nailed it for me :) However, upon importing it into my current project, I immediately encountered 4 errors:

    1. Assets/InstantOC/Scripts/IOChud.cs(85,83): error CS0246: The type or namespace name `MouseLook' could not be found. Are you missing a using directive or an assembly reference?
    2. Assets/InstantOC/Scripts/IOChud.cs(85,42): error CS0246: The type or namespace name `MouseLook' could not be found. Are you missing a using directive or an assembly reference?
    3. Assets/InstantOC/Scripts/IOChud.cs(86,117): error CS0246: The type or namespace name `MouseLook' could not be found. Are you missing a using directive or an assembly reference?
    4. Assets/InstantOC/Scripts/IOChud.cs(86,59): error CS0246: The type or namespace name `MouseLook' could not be found. Are you missing a using directive or an assembly reference?

    Since I'm not a programmer type person, I did not know what they meant. Could you help me with this issue? Thanks.

    Edit: It happened when I did not import the demo folder. When I imported everything, the error messages went away. Upon deleting the demo scene folder (or if I did not import the demo scene), the error messages appeared again.
     
    Last edited: Apr 12, 2014
  18. coffeefery

    coffeefery

    Joined:
    Apr 10, 2014
    Posts:
    21
    After trying out your demo, I did a simple test to see how InstantOC works and encountered a problem: when running the game, the objects disappeared, leaving only their shadows. Upon disabling IOC, the object returned back on screen. I can't seem to find what the problem is, so I've attached images to show the problem.

    IOC enabled
    $IOC_Enabled.jpg

    IOC disabled
    $IOC_Disabled.jpg
     
    Last edited: Apr 13, 2014
  19. coffeefery

    coffeefery

    Joined:
    Apr 10, 2014
    Posts:
    21
    I feel stupid now, since the disappearing cubes are a result of me forgetting to place them in the IOC layer. It's all working fine now (although I still need help with the error messages).
     
  20. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello coffeefery,
    thank you for your purchase!
    Did you eventually get InstantOC working in your scene?

    PS: there is a script in the demo folder ("InstantOC/Demo Scene/Standard Assets/Character Controllers/Sources/Scripts/") called "MouseLook", move it outside the demo folder, wherever you want, and then you can safely delete the demo folder; it is referenced by the IOChud Prefab.

    PS 2: In the next update it will be placed in "InstantOC/Scripts", so that it will be possible to delete safely the demo folder.
     
  21. coffeefery

    coffeefery

    Joined:
    Apr 10, 2014
    Posts:
    21
    Hi frenchfaso, thanks for replying. I moved the "MouseLook' script to the scripts folder and deleted the demo scene, and there were no more error messages. Thanks.
     
  22. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Glad to hear this :)
     
  23. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    Hello,
    I just bought your product.
    I use Unity 4.3.4

    I confirm that your product doesn't work with more than 3 childrens
    I have somes issues :

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

    More than 600 exceptions after some seconds :
    NullReferenceException: Object reference not set to an instance of an object
    IOClod.Update () (at Assets/InstantOC/IOClod.cs:130)
     
  24. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello menfou,
    thank you for your purchase!
    it's probably a setup problem, could you please send me a little sample scene or the object that exposes the problem, so that I can inspect it and point you in the right direction?
     
  25. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    I deleted my scene and I make a new scene and no exception.

    Please, can you check something for me with your DemoScene "IOC Demo"
    1/ Create a empty GameObjet "OcculingObjets" with tag="IOCam IOC Tag" and Layer="IOCcam Layer Mask"
    2/ Put "Frenchfaso Lod_0" in your scene with tag=Untagger and Layer=Default.
    3/ Move "Frenchfaso Lod_0" under "OcculingObjets"

    I never see this GameObject "Frenchfaso Lod_0" , why ?
     
    Last edited: May 1, 2014
  26. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello menfou,
    InstantOC needs colliders to "sense" objects. Please try adding a collider to "Frenchfaso Lod_0" and place it on Layer="IOCcam Layer Mask".
     
  27. zugsoft

    zugsoft

    Joined:
    Apr 23, 2014
    Posts:
    453
    I have the same issue.
    Can you give me your email adress ? I would lke to send you a small project.

    lowcostapp at gmail.com
     
  28. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Sure, email sent!
     
  29. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    Hi frenchfaso,
    I've purchased your product to get rid of LoadLevelAdditiveAsync.
    Unfortunately it gives me a bug: horizontal planes with mesh colliders sometimes doesn't show up.
    Same with some other models.
     
  30. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Websfera.pl,
    thank you for your purchase!
    Could you please send me your project so that I can inspect it and see what's wrong with the setup?
     
  31. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    I would like so but it has 14GB :D
    Maybe will post some screens with data you need?

    Ive got 55FPS so I don't think that it is performace issue
     
  32. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Well, yes, let's try it these way :)
    Please send me some screen-shots with the error (if any) and the hierarchy of the planes that do not show up correctly;
    do you also use LODs for your models?
     
  33. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
  34. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Yep!, it's because of the fence collider, it's "opaque" so the rays can't go through. Until full support for occludee, please use a collider with "wholes" (or many box/sphere colliders that partially cover transparent objects) so that rays can pass through and hit the plane behind the fence.
    Let me know if this helps!
     
  35. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    Well in some way yes. I think I've got also too many objetcts in view at once
     
  36. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Many objects are not a problem, indeed InstantOC does it's best when there are 1000s of objects in the scene occluding each others.
     
  37. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    I was wondering if is possible to replace raycast with trigger collider
     
  38. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Unfortunately this isn't a viable solution for a general enough Occlusion Culling system, this wouldn't be effective in too many cases.
     
  39. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    OK. Another thing I've wondering of: is ioclod will help without LOD models?
     
  40. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello Websfera.pl,
    yes, InstantOC needs always IOClod.cs, it will automatically do the right thing in either case (your models have LODs or not).
    Please take a look at the video tutorial to see how to correctly setup your models with LODs and take full advantage of InstantOC's integrated LOD system:

    http://frenchfaso.blogspot.it/p/tutorials_27.html
     
  41. lazygunn

    lazygunn

    Joined:
    Jul 24, 2011
    Posts:
    2,749
    Did you ever get this working for terrains? Cant seem to find mention of it
     
  42. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    Ahhhh yes. OK. I'll try something else, cause still some models are loading on sight

    Or maybe some quality setting affecting in some matter
    I'm working on fantastic settings
     
  43. Marek_Bakalarczuk

    Marek_Bakalarczuk

    Joined:
    Dec 28, 2012
    Posts:
    114
    Well I've discovered, that IOC doesn't work on scenes loaded by LoadLevelAddictiveAsync.
    is it any method to achieve IOC with dynamic scenes?

    EDIT:
    Well, I didn't seen, that there is IOCLod search. I've manage it to work :D
     
    Last edited: May 20, 2014
  44. boddole

    boddole

    Joined:
    Sep 18, 2013
    Posts:
    35
    Sorry I have to post this here (I wanted to email the creator, but I don't think the website has contact info...), anyway I wanted to clarify something about every object that is managed by this system needing a collider.

    Lets say I wanted some bushes or shrubs objects to be managed by the system (and I want the player to be able to run through them), they would need colliders which would then make it impossible to do that. Or can they be trigger colliders which would sidestep the problem?

    Same question for particles- If they need colliders then they also need rigidbodies since they are not static. Is it better to just not cull particles at all?

    Thank you for your time.
     
  45. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Glad to hear this :)
     
    Last edited: May 23, 2014
  46. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello boddole,
    thank you for your interest in InstantOC,
    InstantOC is perfectly compatible with trigger colliders, so no problem :)
    You can safely cull particles with InstantOC, simply put them as childs of a game-object (empty if you prefer) with a trigger collider, no need of rigidbodies.
    In the lights/particle InstantOC demo, you can see it effectively culling many particles (and lights) in addition to scene objects.
     
  47. boddole

    boddole

    Joined:
    Sep 18, 2013
    Posts:
    35
    Excellent, thank you for the reply.
     
  48. liam1203

    liam1203

    Joined:
    May 19, 2014
    Posts:
    1
    Just bought this because it seemed the perfect solution to my performance problems, the problem is it doesn't seem to work :/ I've followed your Tut on YT even started a new scene and used test objects and it works fine but inside my actual game it doesn't, everything is there, when I run the game though everything with the tag IOC has the script attached to it but still nothing, ive even tried placing giant cubes at the start just to see if it would cull the area behind it but nothing D: I mean only thing I could see wrong is I use Java for about 90% of my game but people have said it's not really an issue?
    any ideas?
     
  49. frenchfaso

    frenchfaso

    Joined:
    Aug 12, 2008
    Posts:
    479
    Hello liam1203,
    thank you for your purchase,
    did you see some error messages in the console?

    PS: please note that to see the culling in action while in "editor mode" you have to disable "Precull Check" option in IOCcam.
     
  50. snowcult

    snowcult

    Joined:
    Feb 6, 2014
    Posts:
    295
    Hey, just bought the asset. I've got a few immediate issues. First is things are popping in like crazy. Second is, some buildings aren't even loading, but that might be because I accidentally added IOClod to the empty objects with box colliders in.

    Here's a video: https://www.youtube.com/watch?v=I_SrNKXgNZA

    My settings:http://i.imgur.com/V5Vmmpq.png

    (I can't afford to give IOC it's own layers and tags, elements in my game a very much vital to them. Though I guess I should probably go make meshes child objects to empty objects with colliders).

    Thanks :)
     
    Last edited: May 31, 2014