
That's done by setting the light's Mode to Baked. We can also bake all lighting into the map, both direct and indirect. Brighter areas around the building at the center are caused by indirect lighting from the light source bouncing off the ground and walls. The baked lighting is mostly blue because it is dominated by the sky box, which represents indirect illumination from the environment's sky. They'll still affect the baked results, but won't take up space in the light map. Static objects could also be excluded from the map by switching their Receive Global Illumination mode back to Light Probes. They'll have to depend on light probes, which we'll cover later. The spheres don't show up in the light map because they don't contribute to global illumination and are thus considered dynamic. Shouldn't there be a lot of green indirect light? Lightmapping settings also shows up in the MeshRenderer components, including a view of the light map that contains the object. Once enabled, the scene's lighting will be baked again, assuming that Auto Generate is enabled in the Lighting window, otherwise you'll have to press the Generate Lighting button. You can also enable this mode by enabling Contribute GI from the object's Static dropdown list, or by making it fully static. Enabling this also automatically switches their Receive Global Illumination mode to Lightmaps, which means that the indirect light that reaches their surfaces get baked into the light map. This is done by enabling the Contribute Global Illumination toggle of their MeshRenderer components. They'll be the objects from which the light bounces off, thus becoming indirect. I also include the ground plane and all cubes-including those that form the structure-in the baking process. Besides that the light still works like a regular realtime light. This tells Unity that it should bake the indirect lighting for this light. The scene has a single directional light with its Mode set to Mixed. To demonstrate baked lighting I created a scene with a green plane as the ground, a few boxes and spheres, and a structure in the center that only has one open side so its interior is fully shadowed. As we don't support normal mapping at this point there's no reason to enable it. It also bakes directionality data, which makes it possible to have normal maps affect incoming baked light.

I also use the Progressive CPU lightmapper. I'll use the default settings except that LightMap Resolution is reduced to 20, Compress Lightmaps is disabled, and Directional Mode is set to Non-Directional. Baked indirect lighting only.įurther down is a Lightmapping Settings section that can be used to control the lightmapping process, which is done by the Unity editor. If your project was created in Unity 2019.3 or later then that option won't be shown. If your project was created in Unity 2019.2 or earlier then you'll also see an option to enable realtime lighting, which should be disabled. There's also a Lighting Mode option, which we'll set the Baked Indirect, which means that we bake all static indirect lighting. Baked lighting is enabled via the Baked Global Illumination toggle under Mixed Lighting. Global Illumination is configured per scene, via the Scene tab of the Lighting window.

Besides that reflection probes can be rendered at runtime to create specular environment reflections, but we won't cover them in this tutorial. Unity uses the Enlighten system for realtime global illumination, but this has been deprecated so we won't use it. It also needs to be stored, which increases both build size and memory usage. The downside of baked lighting is that it is static so cannot change at runtime. The latter is part of what's collectively known as global illumination: light that's not coming from light sources directly, but indirectly via reflection, from the environment, or from emissive surfaces. There are two main reasons why this is done: to reduce the amount of realtime calculations and to add indirect lighting that cannot be calculated at runtime.

Lighting can also be calculated ahead of time and stored in light maps and probes. Up to this point we've calculated all lighting while rendering, but this isn't the only option.
#Brighter 3d brdf plus
Scene illuminated by a single mixed-mode light, plus a little emission. This tutorial is made with Unity 2019.2.18f1. It makes it possible to bake static lighting into maps and probes.
#Brighter 3d brdf series
This is the fifth part of a tutorial series about creating a custom scriptable render pipeline.
