There are different modes for lights. These modes relate to the mobility of a light and how it is used within a scene. The modes differ in terms of performance, so light mode is important to consider when implementing lights. We will look at the advantages and disadvantages of using three different lighting modes: baked, mixed, and real-time.
Baked light mode provides static lighting: objects do not change their lighting during runtime. Baking lights is the process of storing the lighting data in texture maps prior to running the game.
The key features of baked light mode are as follows:
- Light cannot be modified at runtime. Lights and shadows are baked into lightmaps. This processing is done when lighting is created in Unity and does not affect run-time performance.
- Shadows are static, which can look odd with dynamic or moving objects during gameplay.
- Baked light mode is the least expensive computational method that we discuss in this guide.
Mixed light mode provides stationary lights with moving objects. This can be considered as a mixture of the two other methods.
The key features of mixed light mode are as follows:
- Dynamic direct lighting and shadows
- Light can be included in lightmap calculations for static objects.
- Light affects dynamic objects, including generating shadows for those objects.
- Intensity can be changed at runtime, and only direct light is updated.
- Mixed light mode is an expensive computation method.
Real-time light mode provides dynamic or movable lights, which is the most expensive and complicated way of working with lighting.
The key features of real-time light mode are as follows:
- Dynamic light and shadow, with properties that can be modified at runtime, rather than being baked into lightmaps.
- Real-time light mode is the most expensive computational method that we discuss in this guide.
You can learn more about the Unity lighting pipeline in the Unity documentation. There is a link in related information.