(Unity 6) Skybox lighting doesn't work after clearing baked data


After clearing baked data Skybox Environment Lighting stops working, the scene gets dark.
This issue is only in Unity 6 (6000.0.34f1), in Unity 2022 it works fine.

This is expected behavior. Previous versions of Unity would constantly re-bake environment lighting automatically, if no manual bake has been performed. That behavior was changed after Unity 2022. Now you have to bake manually. Just press Generate Lighting and the environment lighting will reappear.

How anyone sane could design this as expected behaviour? So… lets say i want to clear all lighting to its default state. How should i proceed? Because clearing baked data (which was intuitive enough in previous versions) is clearly not working

In case anyone else comes across this: this is almost certainly a bug. It appears that after clearing baked data, the Lighting>Environment>Environment Lighting>Intensity Multiplier is set to ‘0’, even if its slider is showing a non-zero value. Dragging the slider to a different value, and then back to the intended value corrects the issue.

Before baking, Unity uses real-time lighting, where the intensity multiplier directly affects the light source’s color, usually defaulting to white for standard, direct illumination

I don’t think people understand the issue. Its got nothing to do with what ‘shader mode’ your in.

This is a real-time baking issue regarding the lighting URP and Lighting rendering real-time pipeline.

If you bake a light the entire scene goes from real-time to baked. you cannot access and or modify in real-time the intensity modifiers for both reflection and lighting. This then negates the real-time lighting illumination and you are then forced to rely on baked texture maps from the skybox and other lights in the scene.

There seems to be no way to revert the back and go back to real time lighting. Even if you ‘mimic’ and re-bake to identical settings, it still doesn’t work.

You are then stuck from then on to bake every new light you add to the scene.
This is not ideal, and many are asking why is this an issue ?

Is there a way to revert back to real time lighting in the scene - using the intensity modifiers in ‘real-time’ ?

Unity 6.3 LTS - 6000.3.1f1. This is so broken its not even funny.

Same issue as everyone else - clearing baked data makes everything black, even when I’m only using a single realtime directional light. If I press “Generate Lighting” as Pema-Malling suggests, it tries to bake lights as if they’re not realtime lights (but they are in fact realtime lights) - extremely long process - “Baking global illumination 20 minutes left…”.

None of the “fixes” have worked for me.

I’m using URP.

Edit:
I just let “Generate Lighting” fully run with the realtime directional light. I now have a gigabyte of baked lightmaps and the textures in my scene are fully shaded.
This is nuts. Please fix this.

It sounds to me like your scene is misconfigured. From what you wrote, I assume your intention is to not use lightmaps (or any other kind of baked GI).

The “Generate Lighting” button will only produce lightmaps if you have objects in the scene that are requesting lightmaps. Such scene objects meet 2 criteria:

  • They have the “Contribute Global Illumination” flag enabled
  • They have their “Receive Global Illumination” mode set to “Lightmaps”

If you didn’t intend for these objects to receive GI from lightmaps, you can change the “Receive Global Illumination” mode to “Light Probes”, then they will no longer request lightmaps.

If you didn’t intend for these objects to affect baked GI at all (or didn’t intend to use baked GI in your scene), you should disable the “Contribute Global Illumination” toggle. Scenes that contain no MeshRenderers with this toggle enabled will generate 0 lightmaps.

I’ll try to demonstrate the expected behavior if you just want lighting from the sky. I used the exact Unity version you mentioned. Let’s start with the default URP scene. It contains nothing but a realtime directional light and a camera:

I will change the light’s color to red, and add a plane to the scene so we can see the light’s contribution:

If I now open the Lighting Window and press the “Clear Baked Data” button (under the dropdown on the “Generate Lighting” button), the appearance changes:

Why does it change? Because the default URP scene ships with some pre-baked environment lighting data that matches the default skybox. Clearing the baked lighting will remove this.

At this point, I can still modify the light color, and the appearance updates in realtime:
Unity_eFdUGzAepd

If I now click the “Generate Lighting” button, the appearance changes again:

This is because the environment lighting data has been now been re-baked. At this point, I can still change the light color in real time, which makes sense since it is a realtime light - it will never be baked:

Unity_nDFjtn3OEM

Now lets say I want to change the skybox. If I do this, the appearance now looks off, because the baked environment lighting data doesn’t match the new skybox:

However, if I press the “Generate Lighting” button again, it will be re-calculated to match the new skybox:

At this point, I can still change the color of the directional light in realtime. The intensity multiplier works as well:

Unity_e5mAMyrIjV

Because the plane doesn’t have “Contribute Global Illumination” enabled, I can also modify the Intensity multiplier for the lighting from the sky in realtime:

Unity_G02cHReNg6

However, if I enable “Contribute Global Illumination”, and then “Generate Lighting”, the plane will receive a lightmap. The contribution from the sky will be baked into that lightmap, which means that modifications to the environment intensity won’t do anything anymore. Any object that doesn’t have “Contribute Global Illumination” enable can still have its sky contribution modified in realtime, though. I added a cube with “Contribute Global Illumination” OFF so you can see this:

Unity_7ZKL8EHL5F

If I modify the directional light color, both the cube and the plane will change appearance, even though one of them has a lightmap. This is because the directional light is set to “Realtime”:

Unity_Vyo7v2kLHb

If I set the light to “Baked”, then “Generate Lighting”, I can no longer modify the color in realtime, and the light stops affecting the cube. Baked lights will only contribute to objects that receive baked GI either through lightmaps or light probes:

Unity_fvVS7LD6R5

Finally, if I “Clear Baked Data” at this point, I can modify the light color in realtime and see it affect both scene objects again:

Unity_QfeY1wAZLp

This is because, until a scene has been baked, all lights are treated as realtime lights. When you “Generate Lighting”, lights that are set to “Baked” stop acting as realtime lights. This is mainly to help when authoring, like f.x. placing a spot light, to prevent having to constantly re-bake to get an idea of what the light will affect.

So, in summary, if you don’t intend to use baked GI, my advice is to disable “Contribute Global Illumination” on every object, set every Light to “Realtime” mode, then press “Generate Lighting” to bake just the contribution from the skybox.

There may of course be bugs lingering in this area. If you are seeing behavior locally that doesn’t match what I’ve shown, please let me know. I hope some of this helps :slight_smile:

Please let me know if my post just above clears up the issues you are seeing or not.

To help clear up confusion, I want to make it a bit more precise what we mean by “Baked GI” and “Baked Environment Lighting”.

In Unity there are, roughly speaking, 4 kinds of light sources:

  • Lights with mode set to “Realtime”
  • Lights with mode set to “Baked”
  • Lights with mode set to “Mixed”
  • Light from the skybox, also known as environment lighting

When I say “Baked GI”, I am talking about contribution from “Mixed” or “Baked” lights, after pressing “Generate Lighting”. This contribution is stored in either lightmap textures, or in light probes. Until the “Generate Lighting” is pressed, all lights act as if they were “Realtime”, so there is no baked GI.

Light from the skybox is special - even if your scene doesn’t use Baked GI at all, you still need to bake the contribution from the skybox, or it will have no effect on lighting. Pressing the “Generate Lighting” button bakes this skybox contribution into a fallback reflection probe and a fallback light probe, often called the “ambient probe”. This data is what I call “Baked Environment Lighting”.

Scene objects that receive no baked GI from lightmaps or light probes will still sample this baked environment lighting. A scene with no baked baked environment lighting available, and no Realtime lights present, will appear fully black.

Pressing the “Clear Baked Data” button in the Lighting Window deletes both Baked GI data and Baked Environment Lighting, resetting the scene to a state where only realtime lighting is present.

Workflows for environment lighting aren’t great at the moment, it’s something we are looking to improve for URP. That said, I’m unsure if I have seen anything in this thread which would be considered a bug. If you think I am wrong about that, please let me know, so we can get it fixed. Pictures help a lot! :slight_smile:

Yep.

The first image in the picture is original lighting, before being destroyed by “Generate Lighting”. The other three images are my attempts to get back to normal, realtime lighting.

I’m having the same issue as you, and I found this thread in my 18+ hours of attempting to fix this. pressing one button (generate lighting) destroyed the lighting for my entire scene and it has been impossible to go back, essentially bricking hundreds of hours of work. From pressing a button. On the UI. Of the program I’m using. Frankly, I’m amazed that a program is so easily able to undo this much progress at the simple click of a button. It’s almost impressive.

Anyway, no fix has worked, including the one proposed by staff here. So I figured I’d vindicate you a little, and show the staff here a picture of EXACTLY what is going on, because I was lucky enough to have a video to compare from the before.

As you can see from the picture - first image is realtime lighting working as intended. If you press Generate lighting, you will never ever ever go back to that. Its gone forever. Instead, if you use realtime lighting, you will have broken lighting and it is not possible to revert. The only way is to return to a previous version before you click the button.

HEED MY WARNING:
Never EVER click Generate Lighting.

Unity, this HAS to be fixed. Seriously.

Hey. I’m sorry to hear you’ve had such a poor experience with our tools :sad_but_relieved_face:

Based on your screenshots, here’s my guess as to what happened:

  1. On the first screenshot, it looks like you have some baked environment lighting bleeding into the interior through the walls. Even if you never Generated Lighting for the scene before, this would be the case, since the default scene template comes with some environment lighting data pre-generated.
  2. On the second screenshot, you Generated Lighting for the scene. Contribution from the skybox is now stored in lightmaps or light probes, and is occluded by the walls, so the color appears to change. ‘Baked’ and ‘Mixed’ mode lights also stop acting as realtime lights, which might explain the shadows disappearing.
  3. On the third screenshot, you cleared the lighting, which also clears baked environment lighting. Thus there is no longer any contribution from the skybox whatsoever.

My guess may be wrong, but if I am correct, and you want to go back to the appearance of screenshot 1, the fix should looking something like this:

  1. Find every Light in your scene, ensure that each Light is set to “Realtime” Mode in the inspector.
  2. Open the Lighting Window, in the Scene tab, disable the ‘Baked Global Illumination’ toggle.
  3. Press the Generate Lighting button.

Those steps should effectively re-generate only the environment lighting, and leave every light as realtime. Let me know if this helps.

It is what it is, I already went through my 5 stages of grief, I’m rebuilding now. I can do it more efficiently from what I learned building it this time, and my scripts and objects are all fine of course.

I did test by starting a new project, setting up my sun, shaders, putting in the same objects and checking and it did have the desired results and the same lighting from the first screenshot.

Doing what you suggested, though it was mostly going through the motions because I had already done all that (lights are all set to realtime, baked global illumination was disabled, i had triple checked everything) yielded no results unfortunately. That just gets the results of the second screenshot.

So, I’m not sure what goes on under the hood with lighting, but whatever it is BEFORE the Generate Lighting button is ever pressed is my desired lighting (which I got with a fresh project).

So, unless I’m an extreme outlier (as well as the two other people in thread): if you use only realtime lighting, pressing Generate Lighting once will change your lighting permanently and its impossible to go back without reverting to an old backup. Whether this is intended or not I don’t know, but I assure you it’s the case, at least for me. And like I said, I spent 18+ hours trying to fix it doing every possible fix under the sun and searching forums far and wide, so it’s not for lack of trying.

And it’s not really a problem with your tools - it’s my problem haphazardly clicking buttons that can have dire consequences without a recent backup. Lessons learned, now I go agane

I baked lighting as a test and wanted to revert to realtime lighting.
Switched my only scene light back to realtime, and in the baking window I turned off baked lighting and turned on realtime lighting.

It gets about halfway done and then just hangs. This is beyond infuriating. No errors or anything.
When I create a unity scene, realtime lighting just works. Why do I have to sit here baking realtime lights for 3 hours just to get it working again?

The worst part is that it pegs all 16 of my cores at 100% during this whole process. I’m pretty sure its not even doing anything most of the time.

Edit: Another wonderful thing I just noticed. I cleared my GI cache before realtime baking, and now it hasn’t even completed and its filled the cache with 7gb of data. Wtf is going on? Does this stuff even get tested before it enters production?

Looking at your screenshot, it looks like you have Enlighten Realtime GI enabled. That’s what the “Realtime Global Illumination” toggle in the Lighting Window does. Enlighten has a precompute step that can get very expensive for larger scenes. Your screenshot is showing that precompute step running.

Did you actually intend to use Enlighten Realtime GI? To be clear, this is not what we typically mean when we say “realtime lighting”. Enlighten produces indirect (bounced) light. If you only want traditional (direct) realtime lighting, you can disable the toggle.

If you did intend to use Enlighten, the next step to troubleshoot would be to check the editor log for anything suspicious. If you are using URP, you may also want to take a look at Surface Cache GI instead.