What am i doing wrong with Lighting?

So let me just start by saying that I have been pulling my hair out trying to figure out lighting in Unity 5.x for around 6 months now. As some backstory, about 2 years ago I worked a lot in Unity 4.x on a few projects and never had any issues with lightmapping and lighting in general. However, a few months ago I started working with Unity 5 as I no longer had access to the machine with the Unity 4 license. I had so many issues with Unity lighting in Unity 5 that I had to put these issues on the backburner, because we needed to focus on the project’s functionality. Now I have started to get back into lighting to avoid using realtime lights and have run into several issues that leave me baffled.

The first issue I found was that any time I would attempt to bake a scene it would go horrendously slow at Clustering or Light Transport and then if left would crash at the final gather every time. After some searching I found that it seems one Unity-made cube in my scene was causing it, but it was no different from any other Unity-made object (cube or otherwise). So I deleted everything in the scene, which namely made up several shelves, and remade them all with SketchUp. That fixed this issue and allowed us to actually bake the scene.

Another issue that I haven’t been able to fix is the Peter Panning (the shadows are not connected to the objects and make them appear as though they are floating) that is happening to EVERY SINGLE OBJECT in my scene. I tried changing “shadow near plane” but it didn’t fix this issue – even at its minimum there is still a considerable gap (http://i.imgur.com/PEsHHqb.jpg ) This was consistent in some bakes and was corrected in others. The difference between the two also eludes me.

Next, when I was able to lightmap again, I began to get these issues with the corners of my scene where every corner it would fade out regardless of what lighting “should” be there (screenshot below) so I continued to use realtime lights in the main part of my scene.

Now I have expanded on my scene and have a long hallway that has to be lit, but I can’t light it with one or two point lights as the lighting wouldn’t be even at all, and the lights flicker when rendered, as I assume there are too many on one object at a time. I tried to bake the scene again with just the hallway being baked and the lights in the main room staying as realtime. Unfortunately, this doesn’t work, because regardless, the entire scene is baked as if all my lights were static baked lights (http://i.imgur.com/B9V6DHi.jpg ). In fact, even when all baked lights are turned off and a bake is done, it still bakes the scene as though there were lights to bake and gives that awful faded effect (http://i.imgur.com/En2TSUW.jpg ).

What am I doing wrong here? I’ve followed a few tutorials on setting up light mapping and are using these settings (http://i.imgur.com/BV682Ft.jpg ) I just haven’t been able to fix any of these glaring issues with lighting in what I thought would be a small enough scene and now it’s beginning to impede my group’s ability to continue with our project, as the memory for runtime is starting to impede performance.

Any help you wizards could give would save me a lot of pain and suffering trying to work this out. If you need any other information just let me know.

So I don’t think I can fix every issue, but I might be able to help with a few. Lightmapping in Unity uses a third party product called Enlighten and its documentation is not spectacular.

You have a huge number of texels per unit - this is probably causing your crash. When I do intermediary bakes as I develop, I use 2-4 texels. I use 40 for final bakes. Similarly, I only enable Final Gather for final bakes. With a resolution of 100 texels and only a 1024 bit atlas you’re going to run into all kinds of unexpected issues - try cranking your atlas size up a bit when you reduce your texels.

The shadows you see in the bake in your second image might to be ambient occlusion from your indirect light. With the distance set to 2 and the intensity cranked that could be causing the large shadows at object intersections (is that what you mean by the “faded effect”?). I’m guessing you already know this, but also remember that only objects marked static in the inspector will be affected by light baking. Similarly, non-static objects won’t be lit by baked lightmaps unless you use light probes.

Peter panning is hard to diagnose but I err on the side of mesh issues for that. Does it also happen to unity primitives on default settings, or only to the objects you create? Have you attempted changing the bias at all? Try backing it up so far you start getting shadow acne and align from there. If you look online there’s a number of threads where peter panning was caused by problems with meshes (oversize, undersize, broken geometry, etc) so that may be the cause. Ambient Occlusion is a common solution to small peter panning (there’s a known tradeoff that self-shadowing will always cause either peter panning or acne to SOME degree) so once you sort your issues with AO that may fix it. Maybe investigate using a screen-space AO plugin - there’s one included with Standard Assets Effects that’s pretty bad but good enough to test with.

I’m optimistic you’ll be able to solve this. The only really frustrating bug I’ve encountered in Unity Enlighten is a long-standing issue where sometimes certain static primitives can cause baking to hang at clustering or light transport…only thing that fixes that for me is to delete them or mark them unstatic.