Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Let us know your feedback about the Global Illumination changes in the 2023.2 beta.
    Dismiss Notice
  3. Dismiss Notice

Occlusion culling disabling light rendering and shadows in deferred rendering path?

Discussion in 'Unity 5 Pre-order Beta' started by seattlebluesky, Nov 10, 2014.

  1. seattlebluesky

    seattlebluesky

    Joined:
    Sep 2, 2014
    Posts:
    170
    Has anyone else seen this? Also entered the issue via the Unity Bug Reporter as case 646862.

    Baking occlusion data and enabling it for occlusion culling appears to disable lighting (including shadows) for lights with shadow type 'Hard Shadows' or 'Soft Shadows' for at least this example scene.

    To reproduce the issue,

    - New Project.
    - Import asset 'Church & Graveyard' (Vertigo Games) from Asset Store.
    - Open scene in 'Assets>Church and Graveyard>Example Scene'.
    - Align the only camera in the scene with the default scene view.
    - Change rendering path from Forward to Deferred.

    Note that shadows are scene being cast by the iron gates and the pillars have a blue light cast on them.

    - Bake Occlusion data with default parameters.

    Note that the lighting effects, both shadows and blue cast, disappears from Game view when that camera has Occlusion Culling enabled. The Scene view lighting will also disappear for lights with Shadow Type other than 'None' if the occlusion is visualized and Occlusion culling is enabled for the scene camera.

    This sequence of steps in 4.6 maintains the lighting as part of the Deferred rendering and looks as expected.
    This sequence of steps in 5.0.0b12 causes the lighting to not be rendered.

    Left Scene view, right Game view, with occlusion culling data.
    5.0-OccDisablingLights.jpg

    Left Scene view, right Game view, with deleted/no occlusion culling data.
    5.0-OccExpected.jpg
     
    Last edited: Nov 11, 2014
  2. seattlebluesky

    seattlebluesky

    Joined:
    Sep 2, 2014
    Posts:
    170
    As an FYI in neither case were lightmaps baked first just to remove that from the equation.
     
  3. JonDadley

    JonDadley

    Joined:
    Sep 2, 2013
    Posts:
    139
    I had exactly this issue when upgrading one of my projects. The only solution I found, as you say, was to delete the Occlusion data.
     
    seattlebluesky likes this.
  4. seattlebluesky

    seattlebluesky

    Joined:
    Sep 2, 2014
    Posts:
    170
    FWIW this occurs in b13 also.
     
  5. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    10,960
    Same behaviour for me, also beta 13.
     
  6. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    I can confirm that I'm experiencing the same behavior, also on Beta 13.
     
  7. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    218
    Yupp, same here beta13. I've tried all light modes. Lights without shadows are culled correctly.
    Also I've noticed that the bounce light of point lights is shown correcty, just the direct light is culled wrong.
    Directional Light works fine, as well as it's shadows

    Anybody filed in a bug report?
     
    Last edited: Nov 21, 2014
  8. seattlebluesky

    seattlebluesky

    Joined:
    Sep 2, 2014
    Posts:
    170
    Yes. Case 646862.
     
  9. electroflame

    electroflame

    Joined:
    May 7, 2014
    Posts:
    177
    I should add that it's also really easy to reproduce this.

    1. Have a scene with a light in it.
    2. Bake occlusion data.
    3. At runtime, simply toggle the occlusion on and off on the camera's inspector to see the light get disabled/re-enabled with the occlusion culling.
     
  10. or1on

    or1on

    Joined:
    Nov 22, 2013
    Posts:
    4
    Hi all,
    we are experiencing the same issue in Unity 4.5 (not sure about versions before 4.5, but it was definitely there since 4.5 and persists up to 4.5.5p5).
     
  11. seattlebluesky

    seattlebluesky

    Joined:
    Sep 2, 2014
    Posts:
    170
    Didn't occur in 4.6 when I last tried it in one of the 4.6 beta builds. 4.6 is now at RC. Perhaps a fix from that branch made it's way to 5.0.0b14 as I know the new UI changes have been merged over. I'll check.
     
  12. seattlebluesky

    seattlebluesky

    Joined:
    Sep 2, 2014
    Posts:
    170
    Still occurs in 5.0.0b14.
     
  13. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    218
    Got this for my bugreport:
    "We have been able to reproduce this bug and have sent it for resolution with our
    developers. We cannot say when the resolution will be publicly available.
    We highly appreciate your contribution. If you have further questions, feel free to
    contact us."
     
  14. pojoih

    pojoih

    Joined:
    Mar 30, 2013
    Posts:
    218
    from Unity5b15 release notes:
    "Fixed bug in occlusion culling of shadow casting lights"
    I'm currently downloading to test this. Should be available as public beta soon and hopefully in the 4.x circle as well.

    Edit: works like a charm :)
     
    Last edited: Nov 29, 2014
    SubBassman likes this.
  15. SubBassman

    SubBassman

    Joined:
    Mar 28, 2011
    Posts:
    16
    I hope the water reflections will be fixed too. Occlusion and reflections don't work properly in 4.x :)
     
  16. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    I believe water occlusion culling has been fixed already. Can you check if it works on your project?
     
  17. SubBassman

    SubBassman

    Joined:
    Mar 28, 2011
    Posts:
    16
    From which version on? I have 4.6 b17 waiting for final v5
     
  18. or1on

    or1on

    Joined:
    Nov 22, 2013
    Posts:
    4
    I still have this (lights going off for no reason when moving the camera into certain positions, ONLY with occlusion culling enabled) in Unity 4.6.1

    EDIT:
    I just noticed that this happens because I move the camera in a region of the scene where there is no occlusion data (because there are no static occluders/occludees there). If I manually place an occlusion area or a static occluder there, occlusion data is generated for that spot too, and the lights don't go off anymore!
    But shouldn't the whole scene have occlusion data if no occlusion areas are specified? Or, if that is not the case, is it intended that lights behave weirdly when the camera moves into an area without occlusion data (while objects are rendered correctly)?
     
    Last edited: Dec 10, 2014