Challenge - Bake the Scene Lighting

Tutorial

·

intermediate

·

+10XP

·

15 mins

·

(31)

Unity Technologies

Challenge - Bake the Scene Lighting

In this tutorial, you will bake the scenes lighting to increase performance of the project.

Languages available:

1. Profiling the Scene

1. Use the Profiler to identify an issue with Batching
a. Open the Profiler in Unity, by going to Window > Analysis > Profiler.
b. Play the game and observe the performance profile
c. Use the Rendering Profiler and the GPU Profiler to identify areas for optimization

Figure 01: Profiling the scene before optimization

Figure 01: Profiling the scene before optimization

d. Record the profile data to use as a baseline (never optimize without a baseline)

Figure 02: Saving the Profiler data

Figure 02: Saving the Profiler data

2. Setting up Batching and Light Baking

1. Configure Static Batching and Light Baking
a. Configure Static and Dynamic batching in Player Settings

Figure 03: Setting up Static and Dynamic Batching in Project Settings > Player

Figure 03: Setting up Static and Dynamic Batching in Project Settings > Player

b. Mark stationary objects Static. All of the Module GameObjects can be marked static

Figure 04: Using the Static Checkbox to make an object static

Figure 04: Using the Static Checkbox to make an object static

c. Configure the scene lights for Baking.

Figure 05: Switching the Light Mode to Baked, to ensure the light is included in the baking.

Figure 05: Switching the Light Mode to Baked, to ensure the light is included in the baking.

Pro Tip: You can use the Light inspector to quickly find and manipulate all of the lights in the scene. ( Window > Rendering > Light Explorer )

Figure 06: The Light Explorer shows all lights in the scene.

Figure 06: The Light Explorer shows all lights in the scene.

d. Use the Lighting Window to bake the scene’s lighting

Figure 07: Baking the scene. Ensure that Baked Global Illumination is checked.

Figure 07: Baking the scene. Ensure that Baked Global Illumination is checked.

3. Comparing the Result

1. Use the Profiler to analyze the results
a. Open the Profiler in Unity, by going to Window > Analysis > Profiler.
b. Play the game and observe the performance profile|
c. Compare to your benchmark

Complete this tutorial