Baked, Mixed, Realtime Lighting and Choosing between Static or Dynamic Objects

What is Baked lighting? What are static objects? Let’s take a look at all of this and more, as we explore different ways to light a scene.

I will be using Unity and the HDRP (High Definition Render Pipeline) for this article, as well as a scene I have been building with assets from the Filebase asset library.

Static and Dynamic Objects
The Physics based definition of the term Static, is “concerned with bodies at rest or forces in equilibrium.” A static object in your scene will be anything that will remain still. This could be a floor, wall or ceiling. Static objects can be furniture or other items that the player won’t be able to move. A mountain, unless exploding with Lava, is the definition of a Static object!

A dynamic object is quite the opposite. Dynamic can be defined as “characterized by constant change, activity, or progress.” There is probably nothing more dynamic in a game scene than the player. Under most circumstances the player will be moving around the scene and interacting with various objects, enemies or other players. Any enemy that isn’t an immoveable stone statue is dynamic. Objects in a room that can be moved by player interaction or some other force are also dynamic. Lights can be static, dynamic or both (mixed).

Baked, Realtime and Mixed Lighting

Baked lighting is essentially static lighting. If you have an object casting a shadow with baked lights and you move the object, the shadow will not move until you update the baked lighting info. Every time you move a light source in your scene, or an object casting shadows or reflecting light, your scene lighting will have to bake again before the visual changes properly update. Depending on the speed of your graphics processor and how many objects and lights there are in your scene, this could take a long time. Why would you want to bake the lighting info? Well, baked lighting is fantastic for GI (global illumination). A real light source will bounce off one object and reflect light on to another. Depending on the strength of your light and the reflectivity of the object, that light could also perform secondary and tertiary bounces to other objects in the scene. This bounced light will give a natural feel to the darkest corners in your scene. Typically, there will always be details in the shadows even in a dimly lit room. That subtle detail from indirect bounced light sources is what global illumination is all about! It gives your scene a very natural feel, and can be accomplished by baking the light. A baked light is really what bounces light off objects and their materials, and is a huge contributor to global illumination.

One thing about Baked light, is that it needs to bounce off static objects. As mentioned, moving an object that has baked shadow information will leave the shadow where the object was rather than following it. Since the objects in your scene receiving the baked light need to be static, you will need to mark them as such in the inspector for your baked lighting to take effect. This tells Unity, “Hey! I don’t plan on moving this object!”

Placing all of your static objects in a folder(empty game object), is a great way to keep the hierarchy clean, but not all of those objects actually need to be set to static for your baked light.

The inspector is where you can give your object the static tag by ticking the check box.

Realtime lighting is the opposite of baked lighting. These lights update every frame in well…real-time! If you move an object casting a shadow in real-time light, the shadow moves with the object. Light reflections update immediately, as does volumetric lighting and objects being lit. Realtime lights are perfect for illuminating and casting shadows with dynamic objects like the player. Realtime lights work on static and dynamic objects alike. If by chance this is unappealing to you because you want to separate your real-time and baked lighting, you can always separate your lights and objects using light layers.

Mixed lighting is a combination of baked and real-time lighting. On one hand, you get the best of both worlds. Mixed lights will have the gorgeous light bounces and global illumination that come with baked lighting, as well as the continuous update that comes with real-time lighting. The downside is that your GPU will be making two lighting passes, which will double up on your light processing. Just keep that in mind when considering what the end platform is for your project.

Let’s get into using the different light settings, and well as choosing which objects to make static and what to leave dynamic. Navigate to Window>Rendering>Lighting to open up your light settings window.

This Baked Global Illumination check box is really important. Unity is telling me that because it is not checked, that all of my Baked and Mixed lights are being overridden to Realtime lights.

Tick the Baked Global Illumination box to enable baked and mixed lighting.

In your Lightmapping Settings, your Lightmapper will most likely be set to Progressive CPU by default. If you feel confident in your graphics processor, feel free to change this to Progressive GPU (preview).

In Workflow Settings, enable the Auto Generate option to automatically update your baked lighting when changes are made. As soon as you check this box, your scene will start baking light, so be ready for that. Every time you make a change to the lighting in your scene, the lighting will need to bake again.

If this is undesirable you can un-tick the Auto Generate option and press the Generate Lighting button instead.

This will update lighting whenever you press the Generate Lighting button, and store the lightmap information in your scenes folder with your current scene.

Now let’s get into the lights! Unity offers directional (sun), point, spot and area light sources.

To add a light to your scene, click the plus+ icon in the hierarchy and select Light, and then you will see the different light options.

Select the light in the hierarchy to view editing options in the inspector. Under General>Mode, you can select between Baked, Mixed or Realtime.

While all lighting options can be set to Baked, Mixed or Realtime, you will see a warning about Spot and Point lights not being supported for Realtime indirect bounce shadowing.

Choosing between Static and Dynamic for Objects

If you have a small scene with not too many objects or baked lights, you could set all of your static objects to have the static tag, hopefully without any trouble. If you have a large scene with lots of static objects and lights, your lighting bake time might a very long time, or even crash Unity. Bouncing multiple light sources a handful of times off a lot of objects can be quite taxing for the GPU. In those situations, it is better to assess which objects in the scene are the most important to have the static tag, and which are not.

Being that baked light is bouncing off static objects, and can have multiple light bounces if desired, the first place you want to look might be the floor and ceiling. Just those two surfaces will bounce light off each other, especially if your light is coming from the ceiling. If your only light source is coming through windows, you may consider making the floor and walls static. If more ambient light is needed, make the ceiling static as well.

When considering objects to make static, absolutely consider objects with emission channels. A static emissive object will cast lighting information on to other static objects, under a baked light source. Also to note, you can use light probes to project that baked light from the static objects on to your dynamic ones!

Here are some examples using an Area light. Keep in mind that I didn’t use any light probes in these examples, so the Baked lighting would otherwise have much better Global Illumination if I added those in. For these shots, the floor and console are marked as Static.

Realtime

Baked

Mixed

Now that we have come full circle with our lighting discussion, feel free to have fun and experiment for yourselves. Thanks for reading and happy lighting!

--

--

--

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

How to Zip and Unzip Files and/or Folders on Windows 10

Proxy, Facade and Adapter Pattern using Python

Animating Sprites in Unity

Every week on YouTube there are 100 million social actions including comments shares & likes.

Finite-state machines

Esp32: Digital Inputs and Outputs

Another iconic billionaire investor, George Soros, called the stock market a

A Lagom Recipe: Deploying Lagom Microservices on Kubernetes with Istio

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
Jared Amlin

Jared Amlin

I am an artist and musician, that is currently diving headfirst into game development with C# and Unity3D.

More from Medium

Using Cookies to Create Realistic Lighting

More Productive Editor Layout in Unity

Creating Elevator in Unity — Part 3: Moving Elevator.

Day 104: Creating A Ledge Grab In Unity Part 2