Instead of computing the light calculations as the game is running on a device like a Nintendo Switch or in the Unity Player at runtime (when you click play in Unity), the calculations are made while you are working in your scene automatically or manually based on your lightmapping settings. GI comprises both direct and indirect lighting to produce simple to complex high-fidelity renderings of a lighted environment. This can be via algorithm optimizations, using sampling points like Light Probes (for another blog) using the GPU instead of CPU or in the case of Unity’s Baked Global Illumination (GI) system, baked lightmaps are used. Programmers are always trying to come up with tricks to reduce the CPU overhead of graphics at runtime. Trying to simulate realistic lighting in a game can very CPU (Central Processing Unit) or GPU (Graphics Processing Unit) intensive.
Once you set the Bounces for indirect light to 1, you can see the light from the wall on the left bounce one time on surrounding surfaces and back to the camera / player as seen below: Baked Lightmaps There are currently no Global Illumination calculations to be made. In the scene above you are now seeing the direct light rays from the baked area light hitting the wall and then the camera / player.
The reason for this: All lights produce at least direct lighting. Strangely, you could set the Bounces value to “None” but still see light bouncing off a surface: The higher the number, the more realistic the lighting in your scene will look but the “baking” (more on this further below) of the lightmap will take longer. You can set the number of surface reflection bounces for indirect lighting by going to Window->Rendering->Lighting->Scene and adjusting number in the “Bounces” drop down: This is known as Global Illumination or how the light of one surface affects another surface. In Unity 2020 you can have up to four bounces of indirect light in a scene. Looking at the image above, you can see the white light hitting the red tail of the airplane (changes to red) then hitting the grey are of the wing (mixes the grey and red) and finally landing on the lizard’s eye. Indirect light in Unity accounts for light that bounces more than once prior to hitting your eye. In this case the white light morphs to the color grey. Note that when the white light hits the grey wing area, it picks up some information from the surface and carries that to the eye. In the image above you can see the direct light photon from the sun directly hitting the lizard’s eye and another direct light ray bouncing off the grey area of the wing and hitting the lizard’s eye. In real life this includes a light photon that directly hits your eye from a light source or a light photon that hits an object once, gets reflected and hits your eye. Direct Lighting Direct VS Indirect Lightingĭirect lighting in Unity includes light with one or zero bounces.
To understand concepts like Baked and Realtime Lighting we first need to grasp the workings of direct and indirect lighting. What does it mean when your lighting gets “baked” into a lightmap? How does direct light differ from indirect lighting? Why is your moving object’s shadow not being casted by your baked area light? In this blog I will go over the basics of lighting in Unity 2020 to give you a head start into the wonderful world of lighting so you can build prettier (or uglier if that’s what you are going for) games.