The Exciting World of 3D Environments & Lighting

Time to dive into the power of Unity 3D, first building lights.

Photo by Milad B. Fakurian on Unsplash

The 2D Space Shooter project was very fun for a first project and a lot was learned from working in 2D, but we all know that we want to try our hand at 3D! Today’s article will starts a new series on working in Unity 3D with lighting, cinematography, and cutscenes.

Over the next several days I will cover a range of topics that will cover how we work with 3D in objects in Unity and bring our games to life with shaders, materials, lighting, etc.

The Great Fleece, GameDevHQ

Since I am working through the Unity Professional Developer program with @GameDevHQ

I will be using the project ‘The Great Fleece’ available on the Unity Asset Store to provide samples and walkthroughs. Today’s article is going to cover a basic concept. Building lighting in your Unity 3D game.

The Great Fleece is great because it includes tons of starter assets needed to really explore the topics but when you start working you will quickly notice a few frustrating obstacles.

The first thing you might notice is that your game may not look as great when you first fire up the Unity Editor and that making changes to the game produces weird affects with the shadows and details.

This occurs because Unity is trying to rebuild your lighting on the fly, which can be helpful if you want to avoid longer light baking sessions.

Light baking is the process in which game lighting, reflections and shadows are calculated and applied to your game scene to give it more realism. To make life a little easier we can tweak a couple of settings.

First open the Lighting Window: In Unity 2021 you can do this with Window > Rendering > Lighting or clicking the small lighting icon in the bottom right of Unity.

Lighthing Window

There are a lot of options in the Lighting Window and we won’t cover all of them today. But we there are two that will will change right away.

Lightmapper — this dropdown has three options and will most likely be set to Enlighten, Unity’s default lightmapper. It is being deprecated and replaced by the other options. Progressive CPU and Progressive GPU. These do what you think they will, handle the light baking on the chosen device. If you have a modern GPU I would suggest attempting to use Progressive GPU to handle the baking. It will be the fastest option (Fast is relative here).

Auto Generate — for the sake of sanity just uncheck this box unless you are running a very high-end machine dedicated to this kind of work. It will save you some headaches with editor lag.

It is important to note that turning off Auto Generate means you will be on the hook for manually building you lights. This requires a massive amount of patience. To start you just click Generate Lighting and let Unity do its thing. Even with an RTX 2080 Founders Edition (not the best 2080 out there, but still a 2080), 32 GB of RAM and an Intel i7–8700K running at 3.7 GHz a full lighting build after switching to Progressive GPU takes 20–30 minutes to complete. There are plugins like Bakery that can massively speed up light baking and might be worth the $55 dollar investment down the line.

You will notice other tabs in the Lighting Window as well. Under Environment we can set the sun source and a skybox material, which we will talk about in a few days. Under Realtime lightmaps and Baked Lightmaps we can actually see the lightmap textures that the engine has built for us. Those are more advanced topics we probably won’t cover.

Lighting may seem like a hassle but just remember it is worth it in the long run.

Turning my passion for video games and 11 years of software development experience into a focus on video game development using Unity3D.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store