Search Unity

Visibility Lines dont show up for Occlusion Culling

Discussion in 'Editor & General Support' started by radiantboy, Mar 24, 2015.

  1. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Since I got Unity5 I havent been able to see the Visibility Lines in Occlusion Culling, are they working for anyone else?

    Also Occlusion in general seems to not work well at all, many many things I cant see simply still render, no matter how long I spend tinkering with the settings. Its all static etc and will vanish at some point if I move my guy around, but there is so much geometry being drawn that doesnt need to be. I even built my entire levels based around massive tall flat walls to avoid this, but it doesnt help unless I walk right up and look directly at one, move back even a few feet and some distant hidden building appears.
     
    jason-meisel likes this.
  2. robertas-unity

    robertas-unity

    QA Minion Unity Technologies

    Joined:
    Mar 24, 2015
    Posts:
    29
    Hi. The problem with visibility lines not working correctly in Unity 5 is a known issue and it is already being fixed by our developers. As for the buggy occlusion culling, just send us a bug report (a project you are having this issue with would be very appreciated). After you do that, post the case number here so we can investigate this further. Thanks.
     
  3. radiantboy

    radiantboy

    Joined:
    Nov 21, 2012
    Posts:
    1,633
    Awesome thanks! Well I will wait until visibility lines work first as there is every chance that I am wrong :) Great news about the fix coming. You guys rock.
     
    shkar-noori likes this.
  4. Mindella

    Mindella

    Joined:
    Apr 9, 2015
    Posts:
    12
    Hi Robertas,

    Is there any update on when the fix to visibility lines will be released?
     
    jason-meisel likes this.
  5. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I noticed the same problem as @radiantboy. I'm using Unity 5.0.1p2 and I can't see the visibility lines: this doesn't help to find why some objects are being drawn.

    Other than that like radiantboy said the Occlusion Culling sometimes seems inefficient: I have a scene which contain a small town, some buildings are hidden by mountains and they are culled fine if I'm just behind the mountain but if I move back a few steps the building soon reappears though it's not visible as it's hidden by mountains.

    But having the visibility lines to show would be great to try to see what's wrong...

    EDIT: same goes for portals, they don't show up in occlusion culling visualization.
     
    jason-meisel likes this.
  6. Poupi

    Poupi

    Joined:
    Jan 11, 2012
    Posts:
    111
    Still broken in Unity 5.0.2f1 , visibility lines and portals are not displayed....
     
  7. Mindella

    Mindella

    Joined:
    Apr 9, 2015
    Posts:
    12
    Still broken in Unity 5.1.0.f3. Has there been any info at all on when this will be fixed?
     
  8. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Hi @radiantboy ,

    Just wondering if made any progress with this? We're running into similar errors with OC and its pretty tricky to debug without any tools ;-)

    Oh and do you have a link to the bug on the issue tracker, I'd like to up vote it.

    Cheers
     
  9. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    Same here; my level should be ideal for occlusion culling but almost everything is rendered, basically only getting frustum culling, despite weeks of struggling with the setup and settings. Visibility lines don't work either. I've seen many posts reporting the same issues for a long time but surprising few responses or suggestions.
     
  10. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    @DarthDisembowel it is frustrating. At the moment OC is unfortunately broken as the results are intermittent.

    @RobertasQA may have some more answers or be able to point us in the right direction?
     
  11. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    If this is still broken in 5.1.2 can you please bug report it and post the bug number here.
     
  12. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    I installed 5.1.2 last night and still have the problem. I spent a few hours stripping down my game to just the geometry, cleaning out unused assets and using a single texture for everything, so that I would have a small enough package to submit with the bug report.

    Guess what? Now the culling works perfectly. Of course I didn't rebuild the occlusion after deleting every single asset, so now I don't know at what point the problem disappeared. Very frustrating.

    I had exported my map to a new project (and I did rebuild at that point just to make sure the problem still existed, and it did). Then I dumped all of my textures and assigned a single standard grey material to everything (I rebuilt occlusion at this point and I still had the problem). I then deleted all textures, materials, scripts, and unused geometry from the project.

    I accidently deleted the terrain at one point, and since it could affect occlusion I rebuilt the occlusion to make sure, and lo and behold occlusion was working perfectly! So then I assumed the terrain was causing the problem all along. But when I reimported the terrain and rebuilt the occlusion, it was still working properly, so I'm stumped.

    I guess I'll start over. :(

    ***update*** I started over, trimming down the level and rebuilding at each step. The problem persisted until the point I assigned a single standard material to all my geometry, then the culling dramatically improved. I wouldn't say perfect, but it is about 90% more accurate. So at this point it does seem to be material-related. I probably have some older materials not using the new Standard material, and there are some custom shaders in there, but I wouldn't have thought any of this would affect culling. Continuing to investigate.

    ***update*** I selected all materials and made them all standard and rebuilt; no change. I then set everything to opaque, so there were no transparent, cutout or fade materials, then rebuilt and the culling is working better. Makes sense if say, my walls were transparent, that it would affect culling, but that's not the case. Going to try to narrow it down to the exact materials.

    ***BINGO*** Found the culprit (at least in my case). Many of my rooms and corridor segments had materials with multiple elements. Some of these sub-materials were cutout materials. I guess the occlusion baking will ignore any objects that include any transparent sub-materials since it assumes that these objects won't hide objects behind them. In my case the walls, floors and ceilings are all opaque, but I have some catwalks and floor panels within the rooms that are metal grills (but the rooms and catwalks are exported as a single mesh). They don't allow the camera to see outside of the rooms, but maybe Umbra doesn't bother to test that. Maybe this is a known to everyone and you all make sure to create these types of assets as separate objects within the rooms, but it definitely seems to be what has been causing me all the headaches.

    Is this a bug or as designed?
     
    Last edited: Jul 23, 2015
    daisySa likes this.
  13. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    @DarthDisembowel You're not talking about visibility lines which is the subject of this post.
    That said, glad to hear you have fixed your problem!
     
  14. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    True, that's the subject line, but RadiantBoy also mentioned in the initial post that occlusion wasn't working in general, and I imagine he raised the problem of the visibility lines in the first place because he was trying to debug the occlusion issues. That said, the visibility lines are still not working in 5.1.2
     
  15. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    Since RobertasQA asked, here is the ID of the bug I entered for the occlusion issues (I managed to reproduce it even after making all materials opaque in the first test project I made, though that same workaround works in my original level and the second test. Baffling.):
    714284_tkugg8l2vvil2kjd
     
  16. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    @DarthDisembowel good to know you've tracked it down further.

    I don't know if you've read the Unity Blog on OC Best practices, but this is what they state:

    "As a rule of thumb and by default, you can and should set most if not all your renderers as occludees in order for Umbra to cull them. Also by default, most of your static renderers can be occluders as well. Just make sure that if your renderer is non-opaque, it shouldn’t be an occluder either. (Unity will actually issue a warning if this is the case.) This naturally includes transparent objects and such.

    But also, if your object contains very small holes (consider e.g. a cheese grater or a bushy plant) that you wish to see through, but reducing the value of smallest hole globally doesn’t make sense (see the
    previous post as to why), simply removing the occluder flag from the renderer is the correct thing to do."

    So simply, anything that is a solid object mark as as occludees and ocluders and anything non-opaque or transparent mark as occludees.

    Could it be this?

    I wonder if this could be affecting Visibility Lines?
     
    Last edited: Jul 23, 2015
  17. Aurore

    Aurore

    Director of Real-Time Learning

    Joined:
    Aug 1, 2012
    Posts:
    3,106
    QA is taking a look at this bug.
     
    Desktopdaydreams likes this.
  18. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
  19. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    All of my objects have all of the static flags set to true. And though I have some rooms that have non-opaque materials as sub-materials, and they seem to be at least partly responsible, I never had any errors or warnings related to non-opaque occluders.

    This might be a necessary limitation or optimization of Umbra, maybe it can't distinguish which transparent sub-materials are irrelevant to culling. I will probably just separate those parts of the mesh for the time being. It will probably help performance anyway, since those objects can now be culled individually.

    And thanks @Aurore :)
     
    Last edited: Jul 23, 2015
  20. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Yes, I had the same issues with no warning for non-opaque materials when I looked into the scene I'd forgotten to mark a a couple of renderers that where using a non-opaque mat to just occludee. You may be right with it being a limitation. it might be seeing the whole object as an occluder and culling it. Maybe marking the separate non-opaque meshes as occludee's will help.

    I think our issue maybe related to the smallest hole value but until the tools are fixed I can't tell :-( Still need to free up time and do some testing.
     
  21. Any news on this, I'm still unable to get occlusion culling on 5.1.2p3
     
  22. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Good Morning All,

    Just checking back to see if anyone has made any progress or if later versions (UNITY 5.1.2) has fixed the issues with occlusion culling?

    Cheers
     
  23. Tried the 5.2 beta and sometimes it just crashes when I go to the occlusion culling panel.
     
  24. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    This crash is most likely caused by speedtrees on the builtin terrain. You can disable trees (untick draw checkbox) in your terrain and then bake your occlusion. After that close the occlusion panel and reactiva te your trees.
     
  25. Hm, yeah it kinda looks like the speedtrees are causing the crash, although I do not have them on a terrain.
     
  26. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Are the tools showing up in 5.2?
     
  27. No, they aren't
     
  28. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Blast! I've just been running a few tests here with a fresh project and scene and its still the same. Hopefully, the good folks at unity will have an update soon ;-)

    Cheers,
     
  29. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Is there any update on when this will be fixed? I'm having a dog of a time getting culling to work. My door frame keep disappearing when it should be visible. Even turning occludee and occluder static off for it doesn't fix this issue. Without some debugging tools to find out why, I can't use occlusion culling at all.
     
  30. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    @HemiMG at the moment all we know is that Unity's QA team are working on it. Hopefully a fix isn't too far away. ;)
     
  31. dreasgrech

    dreasgrech

    Joined:
    Feb 9, 2013
    Posts:
    205
    I'm currently on Unity v5.2.0f3 and I'm facing major issues with Occlusion Culling.

    Visibility Lines and Portals are never displayed, and when working with the Occlusion Window open, the Unity Editor randomly crashes.


    These are two of the stacktraces of the crashes (when using a Deferred Rendering Camera):
    and (when using a Forward Rendering camera):

    At its current state, it seems like Occlusion Culling is pretty much broken and unusable.

    Any ETAs or more info on the fixes?
     
    Last edited: Sep 13, 2015
    LeonH likes this.
  32. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    Desktopdaydreams and LeonH like this.
  33. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    Thanks. I just gave it a vote. I've now found an area of my game where the entire ceiling is culled and I'm staring up at the sky. I have absolutely no clue what it thinks is in the way.
     
  34. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    @DarthDisembowel cheers for the link to the issuse tracker, i've voted.

    It looks like we've developed some new issues in our latest build with disappearing geometry which was fine a build ago. Tried rebaking the oc again with different configuration but its just painful with no solid result.

    I'm agreeing with @dreasgrech that OC is pretty much broken and unusable.

    @Aurore by any chance have you got any updates on a fix or any further information?
     
  35. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    I noticed the same "inefficiency" in occlusion culling. It's not really that inefficient as with the proper settings it culls some objects behind a mountain for example, but as you walk back the objects are no longer culled when they should definitely be.
    And with the visility lines not working it's kind of hard to figure out what happens.

    It's particurarly annoying in open world scenes where every kind of optimization you can take is important.
    I've voted the issue too, with the hope it can be fixed soon.
     
  36. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Just wondering if anyone saw anything with regard to OC at Boston Unite?
     
  37. jimmikaelkael

    jimmikaelkael

    Joined:
    Apr 27, 2015
    Posts:
    796
    Just have checked it, the bug still occur in Unity 5.2.1f1...
     
  38. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
  39. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    Morning Folks, just reporting that in 5.2.1p2, OC is still broken.
     
  40. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    It is being worked on at the moment, keep an eye on the issue tracker for when its fixed.
     
    HemiMG likes this.
  41. Desktopdaydreams

    Desktopdaydreams

    Joined:
    Nov 20, 2010
    Posts:
    154
    oh! Thanks for the update @karl.jones ! Very much appreciated!
     
    karl_jones likes this.
  42. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,837
    I wish I would have found this thread sooner. I also have been having very strange issues with OC since V 5.0.
    One a simple scene with a wall and realtime lights. When the OC is built, all of the realtime lights turn off.
    I submitted a bug report about a week ago, haven't heard anything back yet.

    http://forum.unity3d.com/threads/un...orking-occlusion-problem.358661/#post-2322418
    http://forum.unity3d.com/threads/occlusion-culling-block-inaccuracy-in-5-0-5-2.356011/#post-2302583
    http://forum.unity3d.com/threads/shadows-not-working.354951/#post-2322466

    Ok. I get nervous when I submit a bug report and don't get a response because that usually means it isn't a bug, but rather I made a user mistake, or worse my project Library is corrupt (which has never yet happened (knock on wood). LOL :-O
     
    Last edited: Oct 6, 2015
  43. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
  44. HemiMG

    HemiMG

    Joined:
    Jan 17, 2014
    Posts:
    911
    I'm glad to hear that this is finally getting worked on. I'm also a bit surprised there weren't more people complaining about it. Is it really that rare for people to use occlusion culling, or do most people just turn it on and not bother tweaking it? If so, they got way luckier than I did.
     
    jimmikaelkael and ArachnidAnimal like this.
  45. LeonH

    LeonH

    Joined:
    Oct 15, 2014
    Posts:
    92
    HemiMG, OC is a very important part of our projects. However, I wouldn't be surprised if most Unity users have no idea what it is and have never used it. It's one of those features that does take a fair amount of time to learn and experiment with to develop best practices for each project. Also, optimization tends to be a very late-in-development issue (usually too late, particularly with inexperienced devs). And ultimately, it's the kind of feature that mostly matters for largish, content-heavy projects that actually get completed and released. Each one of those things cuts down the potential number of people who care.

    So, for the projects that actually need it, it is extremely important. But it's understandable that more people aren't complaining about it, because most projects probably never get to the point of having a real need for it. This is one of many examples where the importance of something may not be accurately represented by the quantity of votes.

    But to answer what it seems like you are asking: at various times in the project, I will test 10-20 combinations of smallest occluder and smallest hole. I will run the game and check various parts of levels that are known to be problematic for performance. With each combo, I'll record various pieces of info at different locations and camera orientations: FPS counters, SetPass calls, and other info related to perf. That'll help with selecting smallest occluder and smallest hole-- I absolutely recommend everyone does this, because I have found that my assumptions about what values would be best have been completely wrong. Also, the "best" values are totally different for each of our projects/scenes-- it totally depends on what kind of geo is actually in the scene. The "best" values will also be different from location to location even within the same scene, so selecting the one set of values to use for the entire scene is a judgement call based on pros/cons and what parts of the scene you think you may be able to optimize. And if you are actively developing your project and thus changing the content in scenes, the "best" values will change over time. So it is not good enough to just do this testing once and then never test the values again. By the end of the project, you wouldn't have the best values anymore.

    When testing, I also enable occlusion visualization, which allows me to check the scene view for obvious things that are being rendered that shouldn't be. That last part is really useful and often it is easy to make improvements-- it can point me toward areas that may have objects with missing static occluder and/or occludee flags, lead me to realize there is a portal somewhere that is not intentional, suggest places where we may want to add occluders, etc.

    A lot of that is educated guessing that requires at least an intermediate level of understanding about how Umbra works. So that is kind of where I am right now-- scenes are pretty optimized, but there are many areas where a lot of stuff is being drawn and I can not figure out why it isn't culled. I am hoping the vis lines would help with that.

    So it's possible to tweak OC, it's just a lot more time consuming without the visual aids. I have a feeling the projects where it is an absolutely critical component just suck it up and put in the time, working on an iteration cycle of measurements / educated guesses / tweaks. For other projects, they probably just file OC in the 'too complicated, nobody got time for that' category and focus on other things.

    It's good to hear the visualizations are being worked on. Hopefully fixes will make it into 5.2 in time to take advantage of them before we need to enter cert. OC is working pretty well for us, but I need to squeeze out a little more! I have my heart set on 60 FPS... :)
     
    Last edited: Oct 7, 2015
  46. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,837
    OC is one of those things that is almost impossible to verify it is working in the build. You can somewhat check if its working in the editor, but if you run the game, how can you be 100% sure it is actually causing things to be occluded? To check it, you can purposely overload your scene to cause low FPS to occur if it isn't working. Then look at the FPS while playing the game. That could give you an idea that it is actually working in the build. Or is there a way to get the Triangle count from the HW?
     
  47. LeonH

    LeonH

    Joined:
    Oct 15, 2014
    Posts:
    92
    That is a good question. We've not yet encountered a situation where OC doesn't provide significant perf improvements, so I don't know how you'd handle that. For our projects, there is a very large difference in FPS in final builds when OC is baked/enabled and when it is not. But it's worth mentioning that our projects are basically textbook use cases for static OC being effective: all indoors, room/hallway/room setup, almost all content exists as pre-placed objects in a scene, no dynamic geo being created at run time, the majority of geo will never move or be modified at run time, etc.

    Mostly I just use editor and dev builds to find/fix trouble spots. Even though the trouble spots aren't always exactly the same across editor, dev, and final builds, it's been an effective method. I haven't really bothered much with trying to profile final builds other than measuring FPS. If I get a dev build running at 75% of our target FPS, it's pretty rock solid as a final build.

    By the way, maybe you could elaborate what you meant by, "You can somewhat check if its working in the editor..."? I'm wondering about the word, "somewhat", because in the editor, you should be able to check exactly: my process for first pass OC scene optimization involves running the game in the editor and watching a scene view window at the same time as the game view. With an Occlusion window also opened to the Visualization tab, the scene view will render only objects that pass OC. When I move/look around the game world and I see objects being rendered in the scene view that I think should be culled, I start investigating why...and that's where the topic of this thread comes into play-- when tools like vis lines aren't functioning, it makes it more difficult to investigate the trickier cases.
     
    ArachnidAnimal likes this.
  48. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,837
    All I mean is that you can have a general idea it is working by playing the scene in editor, but testing every single camera position / angle is a huge feat. I test a few general positions in the game after baking the OC, if it works for those positions, I'll be 95% sure that it works for other positions. Then I note what the expected FPS should be for that position, and then verify similar FPS when running the build. But I have to note what the expected FPS is if it ISNT working as expected, that's the only way to be sure it's working in the build as expected.
    Through a script, I think there is only one way to check if it is working: Renderer.isVisible. But this is not 100% reliable.
    http://docs.unity3d.com/ScriptReference/Renderer-isVisible.html
     
  49. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,837
    Is there a general idea of when OC related issues will be fixed? v5.3 is a long way away, and I don't know if I can go that long, I will need to go back to previous versions of Unity which I really don't want to do.

    Thanks.
     
  50. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,297
    Hi.
    It looks like a fix does exist for this bug so its possible we may be able to take it into a patch release. Ill speak to the developer and see if the fix is compatible with 5.2.