2021.2 HDRP Enlighten Realtime GI not updating with emission

Hello, I am using Unity 2021.2.0a14.1979 and trying to get Enlighten realtime GI to work in HDRP. I’m using the template scene for testing and have an emissive mesh that I am animating the emissive color with a script. When in the editor before playing there appears to be global illumination.


On the emissive mesh I have this script to lerp the emissive color

    Material emissiveMaterial;

    MeshRenderer emissiveRenderer;

    Texture emissiveTexture;
    Color c;

    void Start () {
        emissiveMaterial = GetComponent<MeshRenderer>().material;
        emissiveMaterial.EnableKeyword("_EMISSION");
        emissiveMaterial.globalIlluminationFlags = MaterialGlobalIlluminationFlags.RealtimeEmissive;
        emissiveRenderer = GetComponent<MeshRenderer>();
    }
 
    void Update () {
        c = Color.Lerp(
            Color.blue, Color.black,
            Mathf.Sin(Time.time * Mathf.PI) * 0.5f + 0.5f
        );
        c *= 4.0f;

        emissiveMaterial.SetColor("_EmissiveColor", c);
        RendererExtensions.UpdateGIMaterials(emissiveRenderer);
        DynamicGI.SetEmissive(emissiveRenderer, c);
        DynamicGI.UpdateEnvironment();

    }

However this doesn’t seem to affect the global illumination. The emissive mesh is static, realtime global illumination is enabled in the lighting settings, and my material settings are as such


Is there something else I need to do to get this GI to update each frame? Thank you for the help

7079050--842203--emission.gif

Is realtime GI enabled in the Lighting window?

Can you please confirm that you are getting any realtime GI by looking at the GI scene view modes Unity - Manual: Scene View Draw Modes for lighting (unity3d.com)?

Frame Debugger is also useful to check that the realtime lightmap is correctly bound to the material (could be that the shader variant is not using GI or you hit a bug in the batcher).

2 Likes

Realtime GI is enabled in the lighting window

When changing the scene view mode I don’t see anything when using the Realtime global illumination views. When looking at the regular global illumination views I can’t see anything except for the contributor/receiver view.

When in the editor and in play mode there are Realtime lightmaps


Please let me know if there is more information I can share, thanks!

Here’s an update. I rebuilt the lighting and now I have the GI working. I had built earlier but maybe I didn’t have all the settings correct when I did so. If others have this problem I recommend rebuilding the scene.

Now that I have this working, is there a suggestion anyone has for increasing the speed of the lighting update. I know it is hugely computational, but is there anything I can do with baking or lighting optimization to improve the Enlighten update time? I’m currently getting over 150fps, is there a way to leverage some of this headroom for better quality? I’m essentially using this system in place of the DDGI which will hopefully replace all of this. Thanks again!

Use lightmap parameters in high settings makes the GI quality much better
Use very-low to improve lighting bake speed
Also you can create your own lightmap parameters to customize it

this is a good tutorial / example:
https://assetstore.unity.com/packages/essentials/tutorial-projects/lighting-optimisation-tutorial-73563

https://learn.unity.com/tutorial/precomputed-realtime-gi-global-illumination

2 Likes

@HUSHstudios , do you have “Reload Scene” bool enabled in the Project Settings > Editor? We’ve had an issue where lighting does not get applied upon entering play mode, when that bool is disabled.

3 Likes

@kristijonas_unity I did not have this bool on however enabling it does not seem to make a difference. It turns out if I do not have “Auto Generate” lighting enabled the GI does not update, in the editor or play mode. When I rebuilt earlier this is how I did it rather than clicking the “Generate Lighting” button.

1 Like

Having the same or similar issue. Turned on the bool, auto-generate is selected and emission works in Editor (sort of) but as soon as you hit play emissive GI is disabled. Once you exit play it deletes the GI cache for some reason, I did set the GI cache folder location to be inside the project.

What I meant by “sort of” is the emission will flicker when you modify the exposure weight. You have to get it just so for it to enable.

Does this issue reproduce in the editor, or in standalone builds as well? In the case of the latter, you might be experiencing this issue, reported by one of our forum users.

1 Like

Appreciate the quick response, yes although I’ve come to believe this is a different issue altogether. The emissive was having quite an impact on my scene, I replaced them with area lights for now to simulate the emissive reflection, then I noticed even point light GI was being disabled as soon as you enter game mode. Then the GI cache reloads every time you exit game mode.

In short I think it’s only working in the editor scene mode, I am using HDRP as that’s probably a useful tid bit to know :)… I can of course submit a bug request and / or start a new thread on this if you’d prefer?

Please submit a bug report, then. It would be useful if you could attach a small repro project as well. Paste the bug ID here afterwards and we will take a look ASAP.

2 Likes

Unfortunately and ironically the bug reporter got stuck at 52% and then crashed. Is there a file share or other upload destination I can send the repro to? I tried to send it via the launcher as well, it just said thank you but failed to upload the project.

Feel free to PM me…

The project might have been too large, but I am just guessing. Try and upload it to any reputable cloud storage service of your choice, and share a link via DM to me.