0:00:02.635,0:00:06.218 Lighting in Unity is more fully featured than ever. 0:00:07.635,0:00:11.786 The lighting pipeline includes realtime global illumination, 0:00:11.786,0:00:15.109 in addition to traditional baked light mapping techniques. 0:00:16.621,0:00:19.710 These combined with physically-based rendering 0:00:19.710,0:00:21.297 and the standard shader 0:00:21.297,0:00:25.421 give more power and versatility to light more complex scenes. 0:00:28.492,0:00:32.688 Unity uses physically-based rendering, or PBR 0:00:32.688,0:00:35.699 to create a friendly way of achieving a consistent 0:00:35.699,0:00:39.956 plausible look for materials under all lighting conditions. 0:00:39.956,0:00:44.764 In order to do so, Unity models how light actually behaves 0:00:44.764,0:00:46.764 and follows the laws of physics on how 0:00:46.764,0:00:48.764 light interacts with materials. 0:00:49.612,0:00:53.704 These materials are usually created using the standard shader. 0:00:53.704,0:00:55.704 The standard shader makes physically 0:00:55.704,0:00:58.749 based rendering easy and accessible to use. 0:01:01.322,0:01:03.322 One of the most powerful tools in the Unity 0:01:03.322,0:01:07.195 pipeline is Unity's realtime global illumination, 0:01:07.195,0:01:08.948 or GI. 0:01:08.948,0:01:12.404 Using GI, all lights in the scene can effect 0:01:12.404,0:01:14.923 the object's within range with both 0:01:14.923,0:01:17.928 direct and indirect illumination. 0:01:17.928,0:01:19.928 Direct illumination comes from lights 0:01:19.928,0:01:23.564 shining directly on the objects in the scene. 0:01:23.564,0:01:25.564 Indirect illumination however 0:01:25.564,0:01:28.780 is the light reflected, or bounced off of 0:01:28.780,0:01:30.780 the light surfaces in the scene. 0:01:31.364,0:01:33.364 This bounced indirect light 0:01:33.364,0:01:35.364 can illuminate nearby objects 0:01:35.364,0:01:38.694 mimicking how light behaves in the real world 0:01:38.694,0:01:40.694 This indirect light is effected 0:01:40.694,0:01:43.551 by the colour of the surfaces it bounces off of, 0:01:43.551,0:01:47.375 taking a contribution of that surface's colour with it. 0:01:47.375,0:01:49.375 Direct and indirect light will 0:01:49.375,0:01:52.971 blend together to create a much more realistic look. 0:01:56.368,0:01:58.368 In addition to the default main camera 0:01:58.368,0:02:00.368 a new scene in Unity comes with 0:02:00.368,0:02:02.368 a default sky box 0:02:02.368,0:02:04.368 and a default directional light aligned 0:02:04.368,0:02:06.368 with that sky box. 0:02:09.609,0:02:11.609 Each scene also contains default 0:02:11.609,0:02:13.609 values for ambient light. 0:02:14.683,0:02:17.974 Ambient light illuminates all surfaces in the scene. 0:02:19.435,0:02:22.015 Ambient light is controlled by the settings in the 0:02:22.015,0:02:24.523 lighting panels Environment Lighting tab. 0:02:27.783,0:02:29.783 Ambient light can be created by either 0:02:29.783,0:02:31.783 using a sky box, 0:02:32.650,0:02:35.917 a user generated gradient of 3 colours, 0:02:44.208,0:02:46.208 or a single colour. 0:02:54.593,0:02:56.593 All objects added to the scene 0:02:56.593,0:02:58.499 will receive ambient light 0:02:58.499,0:03:01.881 unless the ambient intensity value is set to 0 0:03:02.898,0:03:06.265 or the ambient light's colour values are set to black. 0:03:08.093,0:03:10.093 It is rare, if not impossible 0:03:10.093,0:03:12.093 for any real-world material 0:03:12.093,0:03:15.638 to have absolutely no reflectivity. 0:03:15.638,0:03:18.676 By default all objects in the scene 0:03:18.676,0:03:21.433 will also receive reflection information. 0:03:22.055,0:03:25.630 Even though the cube, sphere and plane in the scene 0:03:25.630,0:03:28.970 are unlit and ambient light is none 0:03:28.970,0:03:30.970 they still receive lighting information 0:03:30.970,0:03:33.631 in the form of reflections. 0:03:33.631,0:03:37.015 The default reflection source is the sky box. 0:03:37.015,0:03:40.034 This can be changed to a custom cube map. 0:03:40.034,0:03:42.352 To receive no default reflections 0:03:42.352,0:03:44.352 either set the custom cube map to none, 0:03:47.084,0:03:49.084 or remove the sky box. 0:03:52.024,0:03:54.024 It is worth noting that the default sky box 0:03:54.024,0:03:56.494 is procedurally generated 0:03:56.494,0:03:58.494 and new procedural sky boxes 0:03:58.494,0:04:00.494 can be created and saved as assets. 0:04:13.646,0:04:15.646 When lighting scenes in Unity 0:04:15.646,0:04:17.646 we can work with realtime lighting, 0:04:18.475,0:04:19.881 baked lighting, 0:04:20.475,0:04:22.053 or a mixture of both. 0:04:22.607,0:04:26.129 Realtime lighting is more easily modified at run time. 0:04:26.129,0:04:28.129 but it comes at a cost to performance. 0:04:29.429,0:04:31.562 Baked lighting on the other hand pre-calculates 0:04:31.562,0:04:34.004 much more detailed lighting information 0:04:34.004,0:04:36.961 and saves it to a light mapped texture on disc. 0:04:37.470,0:04:39.470 This light map information is then 0:04:39.470,0:04:41.470 read from the texture at run time, 0:04:41.470,0:04:43.470 avoiding the need to do any lighting 0:04:43.470,0:04:45.470 calculations when the project is running. 0:04:46.450,0:04:48.450 This saves performance, 0:04:48.450,0:04:51.846 but at the cost of dynamic changes in the scene. 0:04:51.846,0:04:54.722 Baked light maps are not updated at run time. 0:04:55.363,0:04:58.975 Lights can be switched between realtime, baked, 0:04:58.975,0:05:00.975 and mixed lighting on a per-light basis. 0:05:02.256,0:05:04.256 Using baked lighting exclusively 0:05:04.256,0:05:07.020 would be more appropriate for target platforms 0:05:07.020,0:05:10.844 such as mobile devices with lower performance capabilities. 0:05:13.674,0:05:16.011 The light mapping system can either work 0:05:16.011,0:05:18.011 continuously or on demand. 0:05:19.575,0:05:22.081 When continuous baking is selected 0:05:22.081,0:05:25.019 lighting changes will be baked in the background while editing. 0:05:25.754,0:05:27.754 These changes can either be properties 0:05:27.754,0:05:29.242 adjusted in the inspector, 0:05:29.242,0:05:31.926 or objects changed in the scene. 0:05:43.058,0:05:45.343 When continuous baking is not selected 0:05:46.189,0:05:48.686 changes will only preview on demand. 0:05:50.137,0:05:53.426 When the Build button in the lighting panel has been selected. 0:06:00.360,0:06:02.360 In this scene there is a directional light 0:06:02.360,0:06:05.004 coming in through the skylight in the ceiling. 0:06:05.607,0:06:09.488 This light contributes to the illumination of the entire scene 0:06:09.488,0:06:11.488 as the light bounces off of the surfaces 0:06:11.488,0:06:13.127 it lights directly, 0:06:13.127,0:06:16.096 on to other nearby surfaces in an indirect manner. 0:06:17.445,0:06:19.445 This light continues to indirectly 0:06:19.445,0:06:21.445 illuminate nearby surfaces 0:06:21.445,0:06:23.445 until the strength of the light fades 0:06:23.445,0:06:24.993 and it can bounce no more. 0:06:25.860,0:06:27.594 Decrease the intensity of the light 0:06:28.048,0:06:31.132 and the illumination of the scene decreases accordingly. 0:06:34.693,0:06:36.693 Likewise, if the directional light 0:06:36.693,0:06:38.693 is rotated to directly light a 0:06:38.693,0:06:40.562 different part of the scene, 0:06:40.562,0:06:43.349 it will now illuminate the scene in a different way, 0:06:43.349,0:06:45.971 with both it's direct and indirect lighting. 0:06:49.306,0:06:51.948 As materials created with a standard shader 0:06:51.948,0:06:55.297 can mimic a wide variety of physical surfaces 0:06:55.297,0:06:57.297 and different materials can have different 0:06:57.297,0:06:59.030 amounts of reflectivity 0:06:59.030,0:07:01.030 this can effect the scene's lighting. 0:07:01.690,0:07:05.475 To help balance this the Bounce Intensity can be adjusted 0:07:05.475,0:07:07.832 on either a per-light basis 0:07:07.832,0:07:09.832 or globally by adjusting the settings 0:07:09.832,0:07:11.832 in the lighting panel. 0:07:12.981,0:07:15.338 Adjustments can be made here to artificially 0:07:15.338,0:07:18.705 change the potential bounce of light from a lit surface. 0:07:20.307,0:07:22.307 Adjust the mount of indirect light 0:07:22.307,0:07:24.307 in the scene, and more. 0:07:26.982,0:07:28.982 In addition to lights we can use 0:07:28.982,0:07:32.328 emissive surfaces to contribute to the scene's lighting. 0:07:33.421,0:07:35.421 This scene is lit with a variety of lights 0:07:35.421,0:07:39.297 and light types, including emissive surfaces. 0:07:39.297,0:07:42.550 Emissive surfaces are a light source, 0:07:42.550,0:07:46.836 but they behave very much like indirect bounced light. 0:07:46.836,0:07:48.836 The primary emissive surfaces in the scene 0:07:48.836,0:07:50.836 are in the main corridor junction. 0:07:51.194,0:07:54.044 But additional panels are located throughout the scene. 0:07:56.644,0:07:58.644 All of these emissive surfaces use 0:07:58.644,0:08:00.872 the standard shader's Emission property 0:08:01.814,0:08:04.255 by adjusting the Emissive scale. 0:08:04.255,0:08:07.382 The float value next to the Emission property 0:08:07.382,0:08:09.229 and by adding a touch of colour, 0:08:09.229,0:08:11.229 the mood of our scene changes. 0:08:13.697,0:08:16.996 As these lights can participate in realtime light mapping 0:08:16.996,0:08:18.996 they can be controlled at runtime using 0:08:18.996,0:08:20.996 code or animation to create 0:08:20.996,0:08:22.996 complex changes in mood 0:08:22.996,0:08:24.996 while our projects are running. 0:08:28.200,0:08:30.200 The final contributing factor in lighting 0:08:30.200,0:08:32.200 a Unity scene are probes. 0:08:32.822,0:08:34.822 There are 2 types of probes in Unity. 0:08:35.425,0:08:36.931 Light probes 0:08:37.915,0:08:39.915 and reflection probes. 0:08:41.121,0:08:43.121 Light probes sample the lighting in the scene 0:08:43.121,0:08:45.121 at different positions in the world. 0:08:46.892,0:08:49.568 The information in these probes can be used 0:08:49.568,0:08:51.568 to light dynamic elements in the scene 0:08:52.944,0:08:55.912 such as characters or other moving objects 0:08:55.912,0:08:57.912 at a low cost to performance. 0:09:02.492,0:09:04.492 Reflection probes on the other hand 0:09:04.492,0:09:06.492 act as a single point of reference to 0:09:06.492,0:09:08.492 calculate reflections from 0:09:09.114,0:09:11.114 Surrounding each reflection probes 0:09:11.114,0:09:13.114 is a cuboid that specifies 0:09:13.114,0:09:15.618 what should be included in that reflection. 0:09:16.522,0:09:19.840 These probes sample the elements surrounding them 0:09:19.840,0:09:21.840 using box projection, 0:09:21.840,0:09:23.840 and store that information in a cube map. 0:09:26.779,0:09:28.779 Materials with reflective surfaces 0:09:28.779,0:09:32.656 that are on objects within the reflection probe's volume 0:09:32.656,0:09:34.656 can then reference this cube map to 0:09:34.656,0:09:36.352 create reflective surfaces. 0:09:36.939,0:09:38.939 By default there is one built-in 0:09:38.939,0:09:41.070 reflection probe in every scene. 0:09:41.070,0:09:43.070 This default reflection probe 0:09:43.070,0:09:46.486 reflects the sky box to create basic reflections. 0:09:46.486,0:09:48.486 For more detail in the reflections 0:09:48.486,0:09:50.486 additional reflection probes 0:09:50.486,0:09:52.486 should be added and positioned appropriately 0:09:52.486,0:09:54.486 for the reflective objects. 0:09:57.124,0:09:59.919 It is worth noting that phyically-based rendering 0:09:59.919,0:10:01.919 works best in linear colour space. 0:10:02.484,0:10:04.484 Linear colour space will give 0:10:04.484,0:10:07.621 a more realistic and mathematically correct result. 0:10:09.788,0:10:11.788 For best results make sure that 0:10:11.788,0:10:13.788 the colour space is set to linear 0:10:13.788,0:10:15.788 in the project's 0:10:15.788,0:10:17.788 Player Settings window. 0:10:18.919,0:10:22.065 Linear colour space is the default setting. 0:10:22.988,0:10:24.988 Be aware that not all platforms 0:10:24.988,0:10:26.988 support linear colour space however, 0:10:26.988,0:10:28.988 and that gamma is currently the 0:10:28.988,0:10:31.964 required colour space for most mobile platforms,. 0:10:35.280,0:10:37.280 When looking at all these aspects 0:10:37.280,0:10:39.280 to lighting a scene in Unity 0:10:39.280,0:10:41.906 they can be summed up effectively 0:10:41.906,0:10:44.210 with the main contributory factors. 0:10:46.544,0:10:47.914 Ambient light. 0:10:48.762,0:10:50.762 Reflections. 0:10:50.762,0:10:52.762 And light sources. 0:10:53.271,0:10:55.271 Working with materials created 0:10:55.271,0:10:57.271 with the standard shader being 0:10:57.271,0:11:00.182 drawn using phyically-based rendering 0:11:00.182,0:11:02.182 with global illumination to calculate 0:11:02.182,0:11:04.182 the indirect light and create 0:11:04.182,0:11:07.308 more complex, more realistic scenes.