[SOLVED] Lightmapping not working with Lights

Hello. I have been looking around quite hard, watching Youtube videos and even trying to find the answer in Forums, but I just can’t seem to find an answer to my issue.

Basically, as far as I understand, by using Unity Lightmaps, you can have the objects look like they have lights shining on them, without actual lights being in the scene, correct?

Well, when I try to bake my own lightmaps, stuff like meshes with Emission on them and such things seem to work fine, but whenever I try to add a Light into the scene (like, let’s say, there’s a lamp on a person’s desk) it never works for me. Unity seems to bake something, but as soon as it’s done, the scene becomes dark again, as if the Light wasn’t there.

Yes, I’ve set everything as Static, I’ve tried checking the “Preserve UVs”, and yes, I tried setting the Lights as “Baked” or “Mixed”. Nothing seems to work.

Here are some screenshots of what I mean:

I made a quick New Scene and put a bunch of meshes into a box form, to simulate a closed-off room and I put a single Point Light in it.

This is how it looks when the light is set to “Realtime”:

And this is what happens when I bake the Lightmap:

I have NO idea what I’m doing wrong, so if someone could help me out here, that would be great.
Thank you.

1 Like

Sorry to ask something that you’ve already stated you’ve done but I can only go off the shots. Are you sure you have the lighting culling masks and baking type correct in your scene? Do you have this unity scene I can look over?

Thank you for the response.

I’m really new at this (which might be the problem to begin with), so I’m not entirely sure what Lighting Culling Masks are, OR how I would check baking type. Where would I check that?
Also, if I were to share my scene, how would I go about doing it? By sharing the Project Folder?

1 Like

No Problem Dragriff.

To create a small version of your project, duplicate it to somewhere and remove the Libary folder (leaving Assets and Project settings) along with any files in the assets folder you don’t feel to be relevant. Zip up the project folder and then send it through to my inbox if you don’t want to publically share it.

This is a good resource to explain the different settings available in the light component: Unity - Manual: Lights

Lighting culling masks are a way to exclude some geometry from being affected by the light. based on what I can see happening in your first shot, I’d say this probably isn’t your problem.

Are you using normal primitive boxes included with Unity or is this some geometry you have created in a modelling package?

It should be simple.

  • Set geometry/meshes to Static.
  • Set lights to Baked.
  • Make sure imported meshes have Generate Lightmap UV’s checked.
  • Turn off Precomputed Realtime GI in the Lighting panel.
  • Bake.
5 Likes

Okay, apparently the one thing that I was missing was to Turn off Precomputed Realtime GI.
I did everything else BUT that, and as soon as I checked it, I can bake lightmaps from Lights now.

There are other issues now, like strange artifacts on some parts of my meshes, but I guess that’s a completely other issue now.

Try unchecking Compressed in the lighting window.

So, just came across this myself and combined with the tips above, one last thing got my Lightmap working. I changed my shaders from Specular, to Diffuse… and lo and behold! My lightmap works!!

1 Like

Same here.

1 Like

I’m glad I read that because I probably would’ve never figured it out. Greetings from 2018, lol.

2 Likes

I am having the issue described by the OP, but none of the solutions provided fixed it for me, is there anything else in the settings that I could look at ? (I’m on 5.6.3p1)

None of the methods worked above, but something else helped me. You can check to make sure that the light is the same z level as whatever platform/art you want it to shine on, since its 2D, it will not shine on anything but the z level the art/platform is on.

Weird…I have been having this problem on and off while doing some optimization and I couldnt quite figure out what would cause it to break and what would fix it.

While reading this forum, after playing two rounds of my game, I noticed the lights are back. ?!?!?!

I think its because I cleared the baked lighting data. I think unless you have it auto generated, you have to clear it and rebake when you move lights or add more maybe? I mean it would make sense. I just dont think theres enough lighting direction in cliff-notes style for newbies.

1 Like

For anyone using that free Sci-fi Syled Modular Pack to build worlds off the Asset Store, make sure you go in and manually set each prefab’s models to lightmap static. They aren’t by default and it breaks baked lights.

This may occur based on whether the game object which the light illuminates contributes to global illumination. You can fix this by clicking on the game object and checking Mesh Renderer > Lighting > Contribute Global Illumination checkbox is ticked/unticked on Inspector window.

1 Like

I also have the same issue. Later I check the scene. If you want to bake the light then a minimum of 1 object should be (floor) static(Contribute GI) enabled.

2 Likes