We’ve been tackling a lot of issues so far this semester and one of the larger ones has been light leaking in Unity. Light leaking is basically when light shows up when it isn’t supposed to. For example, light will sometimes leak through the model where two planes intersect. Other times, the light will completely ignore the fact that there is a model there and no light should be going through it at all. This image illustrates light leaking where the wall and ceiling connect:
We had been trying to figure out the issue for weeks and it was mostly resolved after being given to me, since I am the “lighting specialist” on the team. The issue we were dealing with was lights ignoring the models and shining through everything:
After familiarizing myself with how lighting works in Unity 5, I got to work. I tried adjusting light settings, project settings, shadows, layers…everything. The light problem was still there. Next, I tried making different versions of a room with walls to see if any of those would work. Sometimes walls that are made with a thickness work better than walls that are just planes. Sometimes inverting the normals of a cube and using that as a room works best. I ended up creating six different variations of walls that were made into rooms in order to test the lights again. This way, we could see if a different way of modeling our levels would fix it. Guess what happened? The light went through every single one. Here’s an image illustrating this phenomenon:
The next thing we tried was putting someone else’s model into our scene. I used a model from one of the lighting tutorials I had worked on earlier and imported it into our scene. Again, I tried lighting it and it still went through, even though it didn’t go through when the model was in a separate project. That was when I knew that there was something wrong with our project. I imported our game models into a new project and the lights behaved correctly. We ended up moving all of our stuff into a new project and keeping an eye on the lights as we re-imported things. Even though we weren’t able to pinpoint the specific cause of the light leaking, we were at least able to narrow it down enough so that we could move forward with our project and have continued to make excellent progress.