- Home /
Baked indirect/environment lighting still cast shadows from objects that are not suppose to cast shadows
I'm trying to bake a level that has non-movable crates that can be destroyed. I want the crate's lighting to blend with the local surroundings to help not stick out like a sore thumb, but at the same time not leave a permanent imprint even when said crates get destroyed. So I figured that I could make the crates not cast shadows, so that they're still affected by the environment, but not affecting the environment itself.
Turns out that while the baked direct light does work as intended, either the indirect or environmental light (don't know which one) still casts shadows onto the level from the crates. Is there something I can do about it though?
The only way I can see myself working around this is by copying rooms where the crates are suppose to be, and bake said crates in the copied rooms; while the actual rooms bake without any crates present. Obviously this isn't the most efficient way as it creates extra, unused lightmaps for the copied rooms.
Answer by Neran28 · Oct 19, 2019 at 03:22 AM
Baked lighting is precomputed and does not update during runtime. If your crate contrubutes lighting to a nearby surface and your crate is then destroyed the baked lighting will not get updated so the surface remains shadowed from the indirect lighting.
Uncheck the contribute to GI flag in the static drop down of the crate object. You then have to place light probes in your scene in order to get indirect lighting for your crates so they do not stick out. You can also enable them to cast shadows.
Alternatively you have to use realtime global illumination in the lighting settings and use realtime light sources.
By "direct light" I'm referring to the baked direct light. It's the baked indirect light that is still casting shadows. Unless the indirect light bouncing does not count as a "shadow". If so, is there a way while baking for the crates to not affect the environment, yet be affected by the environment itself?
As is said. You have to unmark the mesh renderers of your crates to not contribute GI. And then place light probes to have your crates get indirect lighting from the environment. When baking lighting it is not possible to remove the contributed GI from a specific object from the lightmaps. Baking is a precomputed process.
Alternatively you have to use realtime global illu$$anonymous$$ation in your lighting settings and use realtime lights.
Tried realtime GI already, but with it on, point lights illu$$anonymous$$ate the rooms up beyond the light's supposed range. Are light probes expensive on performance or do I have to resort to copying rooms then bake crates in the copied room before putting them back in their original position?
Answer by rackert · Nov 23, 2021 at 01:31 AM
Its a bug, here's a workaround - Turn off cast shadows. Set your crate material to transparent and alpha 0. The crate will still receive baked lighting and be included in the lightmap but it will not leave behind AO on adjacent objects. You'll need to do this every time you bake and then remember to set the material back to opaque when done. If remembering that all the time is too open to error for ya, another option might be just leave them transparent all the time and to add a little script on the crates or the scene that sets the material to opaque so it looks right when you play.
Your answer
Follow this Question
Related Questions
Baking ambient color not possible? 1 Answer
Weird dark spots when baking light 1 Answer
Problem with light baking in Unity5 2 Answers
Baked Lightmap shadows issue 0 Answers