Search Unity

[SOLVED] Lightprobes work well in editor but are black in playmode (realtime GI)

Discussion in 'Global Illumination' started by MGC_Marc, Apr 24, 2020.

  1. MGC_Marc

    MGC_Marc

    Joined:
    Dec 24, 2013
    Posts:
    36
    Hi there,

    I'm using HDRP 7.1.6 with Unity 2019.3. My realtime global illumination (enlighten) setup was working great but since some time it has a strange behavior: it works perfectly in the editor, but each time I enter playmode, all the light probes turn black, and the indirect lighting disappears on the dynamic objects (it keeps working on static geometry). Then when I exit playmode, my GI is still gone. The only way to retrieve the indirect lighting on my dynamic objects is either to re-gernerate GI, or just to close and re-open the scene (without re-baking. I precise auto-bake is turned off). Is it normal?
    I can't find what I've done to break the GI like that, but I'm sure it was working great some time ago.
    I tried to reduce my scene to the minimum, with no scripts, just some basic 3D primitives, a directional light and the light probes: same result: it works in the editor, but not in playmode.

    I can see a fix in the changelog of HDRP 9.0 that could be related ("Fixed an issue with Realtime GI not working on upgraded projects."), but it's an "unreleased" changelog. What does it means? I believed that realtime GI was removed from HDRP 8.x and Unity 2020. Is this fix about raytraced realtime GI?
     
    jpw99 likes this.
  2. MGC_Marc

    MGC_Marc

    Joined:
    Dec 24, 2013
    Posts:
    36
    Problem solved...!
    I'm using the EditorSceneManager to open my manager scene (the persistent one), in additive mode, just before entering play mode. I also set the manager scene to be the active scene. Once in the playmode, I switch the active scene to my level scene. This is what seems to break the lightprobes. Strange. It's probably something related to the lighting data asset, which is changed when an other active scene is set.
     
    kristijonas_unity likes this.
  3. olejuer

    olejuer

    Joined:
    Dec 1, 2014
    Posts:
    211
    In Unity 2020.1 I have noticed this happening with 'Project Settings/Editor/Enter Play Mode Options/Reload Scene' deactivated. Fixed it by setting the checkmark.
     
    Captain_gundir likes this.
  4. icyuan

    icyuan

    Joined:
    Jul 21, 2019
    Posts:
    6
    I also encounted this problem. Here's my situation:
    I have 3 scenes, scene_Base, scene_A and scene_B.

    * I will load scene_Base firstly and then load scene_A in additive way, and set scene_A as active scene.
    (At this moment, light probes in scene_A works fine.)

    * Then I will unload scene_A and then load scene_B in additive way.(scene_Base will always exist).
    In this moment, light probes of scene_B become all black. However, it works fine when I open scene_B in Editor mode.

    Do you have any ideas?

    I'm using Unity 2021.3.2f1, HDRP 12.1.6
     
  5. olejuer

    olejuer

    Joined:
    Dec 1, 2014
    Posts:
    211
    Have you tried calling

    LightProbes.TetrahedralizeAsync();
    after setting scene_B as your active scene?
     
    icyuan and Pema-Malling like this.
  6. Pema-Malling

    Pema-Malling

    Unity Technologies

    Joined:
    Jul 3, 2020
    Posts:
    327
    In general, whenever you change the constellation of loaded scenes which contain light probes, and the result is that more than 1 scene is currently loaded, you must call LightProbes.Tetrahedralize or LightProbes.TetrahedralizeAsync to "apply the changes". If you still have issues after doing so, let us know.

    The OP talks about Enlighten realtime GI. Are you using this? If so, you might be hitting a different issue. Let us know.
     
    icyuan likes this.