Hello everyone,
I tried baking some lighting for my game using the lighting settings and Unity’s URP shader. After baking the lighting, the entire scene (all the static objects) looked great with the baked lighting, just this one area had some issues:
I don’t know why exactly it’s on this area and not on any of the others. Even the area exactly opposite to the one in the image above looks totally fine:
I did get an error that 3 objects in my scene have overlapping UVs, but I thought that were my 3D assets and not the standard cube 3D assets that I used, still it’s worth noting imo.
Another weird thing that happened is that on the same cube from the first image the lighting on the top is also weird; it looks like the range or radius of the spotlight above is very small, even though you can clearly see on the walls left and right to it that the spotlight should cover the entire top face of the cube.
Hello again,
I took a look at the troubleshooting guide you attached, and it seems that my problem isn’t listed on there.
I also tried using the debug modes, but according to the different view modes, everything is fine?
This is the shaded view:
Ah. On versions prior to Unity 2023, the debug visualizations are only available in the same session as you did the bake. Those visualizations are showing none/empty data. You need to rebake the scene for them to start working (I know this is tedious, sorry :P).
You should be able to bake with much lower sample counts without affecting the result of the visualization much, though.
So, I tried baking it again, and well, when looking at it while it was baking, it worked! Well until you look away from the fact that I have to kill unity because it gets stuck in a loop because of this:
Assertion failed on expression: ‘openCLRenderBuffers.HasBakingBuffers()’ (this error was there before too but I didn’t think much of it)
Second one:
There are 3 object in the scene with overlapping UV’s. etc etc (it’s not the error I want to fix)
Third:
Failed to delete existing texture ‘Assets/…(the location)’
… and the two below are just a consequence of the third error.
So, I know the mistake is that unity is able to overwrite the .png files for the lighting, however Unity can not delete the Reflection Probe (the .exr file). Well, neither can I, because if I try, I get this message:
Some assets could not be deleted. Make sure nothing is keeping a hook on them, like a loaded DLL for example.
I checked for references to this file in the project but there are none, unless they’re hidden to Unity.
I feel like I should also mention that I switched all of the lights I use for baking to “Mixed”, does that have to do anything with that?
This error probably also caused my lighting data asset to just get deleted:
I think the only issue I have right now is that I can’t delete the ReflectonProbe exr.
Assertion failed on expression: ‘openCLRenderBuffers.HasBakingBuffers()’ (this error was there before too but I didn’t think much of it)
This usually indicates some kind of out of memory issue. What kind of GPU do you have, and what size are the lightmaps?
Some assets could not be deleted. Make sure nothing is keeping a hook on them, like a loaded DLL for example.
Hmm. I’d probably try explicitly clearing the lighting data via the lighting window first. It’s on the dropdown on the Generate Lighting button. If that doesn’t work either, you can manually delete the relevant assets.
I feel like I should also mention that I switched all of the lights I use for baking to “Mixed”, does that have to do anything with that?
Mixed lighting just controls whether direct contribution from lights is treated as realtime, or is baked into lightmaps. It may affect the appearance but shouldn’t cause additional issues when baking.
This usually indicates some kind of out of memory issue. What kind of GPU do you have, and what size are the lightmaps?
I have an AMD Radeon RX 7900XTX and the lightmaps have a resolution of 40.
Hmm. I’d probably try explicitly clearing the lighting data via the lighting window first. It’s on the dropdown on the Generate Lighting button. If that doesn’t work either, you can manually delete the relevant assets.
Tried that, but somehow the assets are still there? I still can’t delete the “Reflection Probe” exr (The very last one in the image).
I have an AMD Radeon RX 7900XTX and the lightmaps have a resolution of 40.
Actually I was asking about the size the lightmaps, not the lightmap resolution setting. What is the width and height of the final textures on disk? (Max Lightmap Size)
Tried that, but somehow the assets are still there? I still can’t delete the “Reflection Probe” exr (The very last one in the image).
Did you try manually deleting the assets in the project browser?
Also, after clearing the data and baking the lighting again, the original problem also appeared again.
So now I have two issues.
The point of rebaking was to enable the scene debug view modes. How are they looking?
Actually I was asking about the size the lightmaps, not the lightmap resolution setting. What is the width and height of the final textures on disk? (Max Lightmap Size)
All of the lightmaps are 512x512.
Did you try manually deleting the assets in the project browser?
Yes, that’s where I got this message:
The point of rebaking was to enable the scene debug view modes. How are they looking?
I know what caused the UV overlap warning; when modeling in blender, I used the mirror modifier, so multiple parts of that mesh use the same part of a texture.
Also, the baking can finish now again! I strongly assume that I know what caused the “Cannot delete” error. I think the issue was that somehow my lighting data asset dissapeared. Today I accidentally deleted my lighting settings asset, so I created a new one and tried baking again. Et voilà! A new lighting data asset was created when baking and the baking can finish again.
As for fixing my baking, I’ll try what sacb0y said, since it could make sense that my light map density might be the issue.
Looks like something has a lock on the file. There are tools to figure out what exactly for Windows, you can google around. Perhaps you had it open in an image viewer or something?
Given what you’ve shown, I’m not sure what is causing these artifacts. You are welcome to submit a bug report so we can investigate further, though.
Nw, as I mentioned later in that message, I could delete it afterwards. Probably was because my lighting data asset was gone. My bad, I should’ve removed that first part for better clearance.
As for reporting the artifacts as a bug, yeah, maybe I’ll do that. But fist I’ll try using something different than the standard cube and rebake the lighting. If nothing works, then I’ll report the bug.
Thanks for your help though, I appreciate it a lot.