A Guild to Beautiful Games
What is Baked Lighting and how we can use it
Lighting in Unity can be set to 3 different options “Baked, Mixed and Real-Time” and their differences can make a big affect to your gaming performance.
Real Time Lighting:
Real Time lighting is basically taking in all the dynamic lighting and shadows and having it auto generate in real time with an constant update to the lighting data and shadow data. An example of this is when an active player is walking within a scene with a light source. The players shadow is real time because it is constantly being updated on the position and location in reference to the scene.
Baked lighting is the opposite of Real Time Lighting where the light data and shadow data are saved as a final light map data and then displayed. This basically means that all shadows are literally “baked in” into the scene and can not be altered. Baked lighting can not be used on active objects such as the player but are great on static non dynamic objects such as walls, structures and unmovable objects. These static objects will not be taking in new dynamic lights can be creating new dynamic shadows if they were to be moved in the scene.
Mixed Lighting is a combination between both real time and baked lighting, where the light source is both emitting dynamic and static light. Of course this is more taxing to compute than both previous options but it is nice glimpse into what the final render would look like.
Using Baked Lighting:
Since Real Time and Mixed Lighting are set by default when working with Unity renderings, Baked Lighting is what we users have to setup. As mentioned before, Baked Lighting required objects to be “static” or basically unmovable. Therefore, we first must set all our objects that aren’t going to be dynamic to “static”.
Then in the Lighting source object, we are going to select “Baked” within the General Tab > Mode > Baked.
Finally in the Lighting Preferences which can be accessed by Window > Rendering > Lighting, we are going to change some settings around.
The first setting to changed is the Lightmapper, if your computer has a strong GPU we can change the settings to Progressive GPU (preview). This will allow the computer’s Graphic Card to run all the lighting and shadow simulations and leave the CPU alone for physics etc. It should increase performance times while rendering.
The second setting to change is to toggle off the “Auto Generate” then hit the “Generate Lighting” button the the side. This will force Unity to save all the lighting and shadow data into an light mapper.
Unity would then create a new folder with all the lightmapping data compiled to this folder.