This is the eighth of a series of articles that cover my journey learning and exploring one of the most powerful indie game creation tools available - Unity. I’ll be sharing my knowledge and discoveries over a 12 week period. Each week I’ll post primarily on the process of learning Unity 3D along with other topics such as the history of the game engine, the community, and prominent artists/creators.
Last week I went into more detail on creating colliders for Unity game objects and then went on to talk about what I’ve learned regarding sound/audio for Unity. And then at the end of the article I shared my struggle to avoid buying everything in the Unity Asset store.
I’ve been learning Unity using the Lynda.com course, “Unity 3D Essential Training” by Craig Barr as a guide. At this point, I’m a little over half-way through the course,.
Lighting in Unity
Craig Barr’s coverage of lighting in Unity is excellent. In approximately six chapters he introduces you to basic components of lighting, how to make adjustments to light properties, how to animated lighting and (my favorite part) goes into detail on “baking” you lighting for a Unity scene. Don’t worry if you don’t know what “baking” is because I’ll explain it a little further in this article
The lighting system in Unity is really awesome. Keeping in mind that you can add components (including lighting) to any game objecty in Unity it’s possible to make a prop or set piece self-illuminating. This might strike you as being unrealistic, but inside of a game it’s all part of the style you want your game to be. In fact, one of the things I had to get out of my head was real-world lighting situations like every light has to have a real source (lamp, bulb, lighting fixture). Lighting your scene in Unity allows you to use your imagination in figuring out the best way to illumine your scene.
There are essentially three types of lighting objects in Unity: the point light, the spotlight, and the area light. The name of each light describes what it does. You would use point lights for obvious lighting fixtures in your scene. A spotlight can illumine a specific area or space in the scene. And, finally, the area light is your ambient light source.
What’s cool about adjusting the properties of your lights is that you can fine-tune the intensity, color, and area the light covers. Once you choose a light from the drop-down menu and place it in your scene the Inspector window shows all of the elements of that light that are adjustable.
In the scene I’ve been working on for the 3D Essentials course, I place point lights in front of all of the fluorescent light fixtures, adjusted the intensity and spread of the lights and then colored them to fit the cool color tone of a real-world fluorescent light.
Similarly, three spotlights fit just under the beams of the space to illuminate three areas of the entire space. Then, and this was very cool, I added an area light then adjusted it’s size to fit the entire space and moved it to the ceiling to light the overall scene.
This is an essential part of lighting in Unity. Baking means instead of having real-time lighting and shadows, you “bake” the light effects as a texture map in the scene. The advantage is that you don’t force a huge amount of computations for the game players computer/media device so the scene runs faster. Real-time lighting can be very demanding in-game scenes, so Unity provides an excellent way of solving this problem
The Unity manual has a great section on Baked lighting, so check out the page for more detailed info.
Baked Lighting Helpers
Static objects (game objects that don’t move) are excellent choices for baking your lighting effects. In fact, area lights can only be baked in Unity so you are saving computational time on this type of light already. Once you have your lights set up, you can go through the properties and choose “static” for each non-moving object
Dynamic objects, on the other hand, are moving objects and require real-time light calculations. In our tech scene, we have a combination of real-time lighting and baked lighting.
Knowing that many game creators will use baked lighting, Unity provides help in providing even your baked lighting to look good. Light probes and Reflection probes can be added to your Unity scene to provide help in getting your baked lights to look close to real-time lights. To learn in more detail try the Unity manual.
Note: A new version of Unity is out now. Version 2018.1 has many updates, most importantly new rending choices. See our Renderosity Magazine article for more news. I updated Unity to this new version with no problems