Search Unity

Unity 5.2.1p2: Realtime lights not working - Occlusion Problem

Discussion in 'Editor & General Support' started by ArachnidAnimal, Oct 2, 2015.

  1. LeonH

    LeonH

    Joined:
    Oct 15, 2014
    Posts:
    92
    Haha, actually, I would not agree, because I currently have no need for culling prevention. :) If our dynamic objects suddenly stopped being included in the culling system, our rendering perf would take a hit! However, I definitely think it would be a good thing to have some way to disable it on a per-object basis. Maybe there is, and we just don't know about it. OC does seem to be one of the more obscure, less understood systems in Unity.
    Yeah, I know what you mean. It's difficult enough sometimes getting multiple cameras to render properly even if you are just stacking all your image effects onto one of the cameras. But when you need to support, "yes we want that effect on that camera, but not on the stuff from that camera!" it gets even more difficult! I ended up writing a camera compositing system that handles that stuff pretty well, but it can be tricky to set up because there are a lot of quirks to work around. And depending on your platform and the frame rate you want to hit, you need to be careful with multiple cameras because there is a certain amount of cpu overhead to each one that is active, even if it renders nothing at all.
     
    ArachnidAnimal likes this.
  2. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Hi Karl,
    I was wondering if you have a chance if you could look at the below question screenshot.

    The major issue I am having is things which are not marked as Occludee Static are being culled by the OC system. It was my understanding that if a game object is not marked as occludee static, then it should not be culled. But it seems it is. Maybe my understanding of this flag is not correct. Could you please elaborate on this if you have a chance? Is it expected that gameobjects not marked as Occludee static could still be culled? (I have no occlusion areas setup, just the default scene OC)

    Thank you for your time.
     
    Last edited: Nov 19, 2015
  3. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Hey,

    So moving none static objects can be occluded if you have an occlusion area and the is view volume option is checked.
    However since you don't have any occlusion areas then it should not be occluded although I am not really sure what I am supposed to be looking at in your examples. Whats being occluded? Are you able to create a simple scene that demonstrates the problem and share it here?
     
    ArachnidAnimal likes this.
  4. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Ok, thanks. (Please disregard the second part of the previous post, and the screenshots, I have deleted them from the post).

    My issue is shown here:

    1. The door is completely un-marked static. In this view it is visible
    oc1.png
    .
    2. The camera moves over a little, now the door is being culled.

    oc2.png
    j

    staticflags.png

    What is happening is the door is not marked static, but yet it is being culled.
    I found that setting the Backface tolerance too low was causing non-occludee-static objects to be culled.
    I'm not sure if this was expected behaviour, the problem does not occur when the backface tolerance is set to 100%.

    I created a repro and will be submiting a bug report soon, because it sounds like this is not supposed to happen.
    Thank you.

    j
     
    karl_jones likes this.
  5. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Please post the bug id when you submit so i can take a look :)
     
  6. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Submitted bug report: 746160

    The file is also at drop box:
    https://www.dropbox.com/s/5dbq1xdu9i5dmwy/BugReporting-OCissue.zip?dl=0

    To reproduce:
    1. open the attached scene
    2. Build the occlusion culling data
    3. Run the game
    4. Move close to the sides of the door
    5. Notice the door becomes culled. The door is not occludee static.
    6. Changing the backface threshold to 100 seems to cause the problem to not occur

    bugPNG.png

    Walking to the door near this locations results in the door being culled
    j
     
    karl_jones likes this.
  7. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    @karl.jones
    I'm not sure the occlusion issue is entirely fixed. It is certainly greatly improved, but when shining a real time light while travelling through my geometry, some of the objects flicker in and out of shadow.

    And the patch didn't seem to fix any of my current occlusion issues unfortunately. I still have objects rendering outside my room, and the visualization after a bake is different as soon as I reload the scene (ie those objects outside the room appear properly occluded immediately after a bake, but when I reload the scene, they are no longer occluded. AND I still crash when switching in and out of the Visualize tab.

    Bit disappointed really. :(
     
  8. LeonH

    LeonH

    Joined:
    Oct 15, 2014
    Posts:
    92
    Are you saving the scene after you bake occlusion data? The baked occlusion data is stored in the .unity scene file, so if you don't save it after baking, the reloaded scene won't have it.
     
  9. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Can you submit a bug with a sample project? Did these issues occur before the realtime lights regression we had? Also make sure your saving the scene as Leon suggested.
     
  10. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    Yes I always save the scene immediately after a bake, when the visualization appears perfect. I entered a bug and example for the false visualization months ago (well before the realtime lights regression), issue 725002. I'll see if I can create a test gym showing the flickering lighting.
     
  11. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    Another quick note: the flickering only happens in game view. The scene view shows the light always on, just as the realtime light issue was doing. It seems dependent on the angle of the spotlight; when the light disappears, if I change the angle it will reappear (in my case the spotlight is attached to the head, and since it is a VR game it follows your head movement).

    Unity Personal (64bit) - BOT.unity - BOT - PC, Mac & Linux Standalone DX11.jpg
     
  12. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
  13. DarthDisembowel

    DarthDisembowel

    Joined:
    Jun 11, 2014
    Posts:
    54
    Thanks, I have been watching it. Good to know someone is on it. Is there any indication whether it is the visualization that is inaccurate, or that the occlusion data somehow changes or is not updated/saved correctly after a bake? It would be nice to know that the first visualization result is what I can expect once this bug is fixed, since it appears to be perfect. The result I currently get after reloading the scene has issues that I don't know how to fix
     
  14. ArachnidAnimal

    ArachnidAnimal

    Joined:
    Mar 3, 2015
    Posts:
    1,815
    Hi Karl,
    I have a question regarding wording about Occlusion Culling in the editor. In the Occlusion Culling window it says "it is imperative that the unit scale parameter be set correctly. What is this referring to? What is the "unit scale parameter". I have searched the manuals and forums cannot find an answer to this.

    Thank you.

    unitscale.png

    j
     
  15. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Hi,
    It looks like the parameter unit scale was removed a few versions ago. I will get the occlusion team to update the help text.
     
    ArachnidAnimal likes this.
  16. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I'm on 5.4B23 and I think i get this problem



    If i clear the occlusion bake data it works
     
    Haydar-AYDIN, bec_bunsen and plmx like this.
  17. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    308
    I have the same problem in Unity 5.4 final. In my case, it is a realtime spot light and I am standing (HTC Vive) directly below it. Depending on the camera angle, the light just shuts off. It's juist a few degrees, really.

    @karl_jones : Is this still being tracked as a bug?
     
    olix4242 likes this.
  18. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    No this bug was fixed a long time ago. Sounds like your issue is something new. Can you file a bug report?
     
  19. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    @plmx Did you file it? Its very easy to repdouce with a dynamic light and baked occlusion
     
  20. bec_bunsen

    bec_bunsen

    Joined:
    Mar 2, 2012
    Posts:
    40
    I got this problem too since about October 2015.
    I put it aside while focusing on other part of my project.
    I send a bug report once but got answer that this couldn't be reproduced.
    Glad to see it happens to other people.

    Light shadows disappear according to specific camera rotations...
    Any clue on this bug? Some things related to occlusion baking process?
     
    Haydar-AYDIN likes this.
  21. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    What is the bug report number?
     
  22. bec_bunsen

    bec_bunsen

    Joined:
    Mar 2, 2012
    Posts:
    40
    Case 767911
    ;)
     
  23. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    And you still have this problem in 5.4?
     
  24. bec_bunsen

    bec_bunsen

    Joined:
    Mar 2, 2012
    Posts:
    40
    I just updated to unity 5.4.0.f3 to check. Yes, the problem is still here :/
     
  25. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    8,281
    Ok can you file a bug again with the project and if possible a video showing how to recreate the issue?
     
  26. bec_bunsen

    bec_bunsen

    Joined:
    Mar 2, 2012
    Posts:
    40
    Ok great news! Looks like I need to recreate my maps in a new scene in 5.4 before building occlusion data and then the problem is fixed!
    Nevertheless now the 5.4 version cause some of my vertex color shader to look way too bright, but that's another story...
     
    karl_jones likes this.
  27. plmx

    plmx

    Joined:
    Sep 10, 2015
    Posts:
    308
    No, I ended up implementing my own occlusion system. Sorry. If you have a sample project ready, please go ahead and file it, I currently don't have the resources to reproduce (have to do it without the Vive etc. etc.)
     
  28. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    So you bake light and then build oculussion and it works? Will try tonight, thanks
     
  29. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Ok, tried this on 5.4f3, first bake light and then bake oclussion, bug is still there, the light is occluded even if seen by camera like in the video above
     
  30. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    I need to escalate this, this is not a edge case bug, it happens to any light so its actually threatening our upcoming map release



    I filed a bug report Case 834084
     
    Last edited: Sep 21, 2016
    plmx likes this.
  31. bec_bunsen

    bec_bunsen

    Joined:
    Mar 2, 2012
    Posts:
    40
    This is not exactly what solves the problem. I use a map generator. So I had to regenerate the new map into a new scene before processing to the occlusion building and this way I got rid of the light&occlusion bug.
    Btw I don't use baked light...
     
  32. DarkJoney

    DarkJoney

    Joined:
    Jan 31, 2013
    Posts:
    24
    Well, same problem here in Android mode. Unity version is 5.4.1f1.
    I have shadows in realtime or mixed mode, but in baked I dont have them.
    I though that it's shader issue, but the modern one and Mobile Legacy situation is the same.
    This bug pisses me off, because I can't throw any additional batches to mobile chipsts.
    Anyway, Unity makes me sad in general - android performance with 100 batches and 50 drawcalls makes me cry.
     
  33. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Uhhhhh....
    Just essentially made a level, with some lights, level 0, I saved as a new level, 1 sothis level is idetical to the last minus some functionality. I am posting because when I switch to level 1, the lights tho active, do not appear to be active, they appear in scene off.


    ??????
    I am running 5.50f3

    Edit:
    Tho on my stand alone build for Linux, the lighting is not an issue, only in the editor.
     
    Last edited: Dec 15, 2016
  34. fairtree

    fairtree

    Joined:
    Jun 11, 2012
    Posts:
    84
    Got exactly the same behavior as AndersMalmgren in his video.

    Still an issue in a Windows build.
     
  35. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Sadly haven't heard back from Unity about my bug report. I can reproduce in two clicks (add real-time light and bake occlusion). Happens every time (at least on SteamVR)
     
  36. fairtree

    fairtree

    Joined:
    Jun 11, 2012
    Posts:
    84
  37. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    I have noticed two things...

    When a new scene has been opened (not in game but strictly while editing, in editor), the lights take a moment to set correctly. Until then, they are dim.

    Also, the issue is the lights, tho handing the right settings, are dim. If I increase the intensity of the light, they set.
     
  38. fairtree

    fairtree

    Joined:
    Jun 11, 2012
    Posts:
    84
    Maybe the focus has to be done on the SteamVR, as I said on an other post the 1.2 version does not solve the problem.

    Any news about that?
     
  39. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    It was a bug in Umbra, its been fixed, they will try to get it out in Unity 5.6
     
  40. fairtree

    fairtree

    Joined:
    Jun 11, 2012
    Posts:
    84
    Thank you AndersMalmgreen for your answer, I hope you found a solution for your game and were able to release it.
     
  41. AndersMalmgren

    AndersMalmgren

    Joined:
    Aug 31, 2014
    Posts:
    5,358
    Thanks, we only have real time in the lobby and some other places until 5.6 and the new mixed modes so its not a huge problem. We have removed occlusion from those places that have real time lights for now, so its just a few lights that show this problem.

     
  42. TheWhiteCode

    TheWhiteCode

    Joined:
    Jan 25, 2017
    Posts:
    1
    i have still issues with my light first it say the hole time 5/11 clustering and then i dont heve shadows
     
  43. Acreates

    Acreates

    Joined:
    Dec 12, 2016
    Posts:
    41
    I'm looking at the dates on this bug and today's date and I'm seeing occlusion vs gi cache lighting issues too.
     
  44. Acreates

    Acreates

    Joined:
    Dec 12, 2016
    Posts:
    41
    LeonH is correct. Also Unity does not properly clear Occlusion from the folder with the same namesake.
     
  45. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,697
    Hi,
    I just added a bunch of point lights to my game. It works fine in the editor, however when I built to iOS, those sane lights do not exist.


    Any ideas? (5.6.03)
     
  46. WildStyle69

    WildStyle69

    Joined:
    Jul 20, 2016
    Posts:
    318

    Unity 2019.2.21f1 (64-bit) -- exactly the same, occlusion related. Turn off occlusion on camera it's OK, back on it flickers. Rebaking occlusion etc. does not work either. Crazy stuff!

    // Wildstyle