< Return to Video

Unity 5 Graphics - Lighting Overview - Unity Official Tutorials

  • 0:03 - 0:06
    Lighting in Unity is more fully featured than ever.
  • 0:08 - 0:12
    The lighting pipeline includes realtime global illumination,
  • 0:12 - 0:15
    in addition to traditional baked light mapping techniques.
  • 0:17 - 0:20
    These combined with physically-based rendering
  • 0:20 - 0:21
    and the standard shader
  • 0:21 - 0:25
    give more power and versatility to light more complex scenes.
  • 0:28 - 0:33
    Unity uses physically-based rendering, or PBR
  • 0:33 - 0:36
    to create a friendly way of achieving a consistent
  • 0:36 - 0:40
    plausible look for materials under all lighting conditions.
  • 0:40 - 0:45
    In order to do so, Unity models how light actually behaves
  • 0:45 - 0:47
    and follows the laws of physics on how
  • 0:47 - 0:49
    light interacts with materials.
  • 0:50 - 0:54
    These materials are usually created using the standard shader.
  • 0:54 - 0:56
    The standard shader makes physically
  • 0:56 - 0:59
    based rendering easy and accessible to use.
  • 1:01 - 1:03
    One of the most powerful tools in the Unity
  • 1:03 - 1:07
    pipeline is Unity's realtime global illumination,
  • 1:07 - 1:09
    or GI.
  • 1:09 - 1:12
    Using GI, all lights in the scene can effect
  • 1:12 - 1:15
    the object's within range with both
  • 1:15 - 1:18
    direct and indirect illumination.
  • 1:18 - 1:20
    Direct illumination comes from lights
  • 1:20 - 1:24
    shining directly on the objects in the scene.
  • 1:24 - 1:26
    Indirect illumination however
  • 1:26 - 1:29
    is the light reflected, or bounced off of
  • 1:29 - 1:31
    the light surfaces in the scene.
  • 1:31 - 1:33
    This bounced indirect light
  • 1:33 - 1:35
    can illuminate nearby objects
  • 1:35 - 1:39
    mimicking how light behaves in the real world
  • 1:39 - 1:41
    This indirect light is effected
  • 1:41 - 1:44
    by the colour of the surfaces it bounces off of,
  • 1:44 - 1:47
    taking a contribution of that surface's colour with it.
  • 1:47 - 1:49
    Direct and indirect light will
  • 1:49 - 1:53
    blend together to create a much more realistic look.
  • 1:56 - 1:58
    In addition to the default main camera
  • 1:58 - 2:00
    a new scene in Unity comes with
  • 2:00 - 2:02
    a default sky box
  • 2:02 - 2:04
    and a default directional light aligned
  • 2:04 - 2:06
    with that sky box.
  • 2:10 - 2:12
    Each scene also contains default
  • 2:12 - 2:14
    values for ambient light.
  • 2:15 - 2:18
    Ambient light illuminates all surfaces in the scene.
  • 2:19 - 2:22
    Ambient light is controlled by the settings in the
  • 2:22 - 2:25
    lighting panels Environment Lighting tab.
  • 2:28 - 2:30
    Ambient light can be created by either
  • 2:30 - 2:32
    using a sky box,
  • 2:33 - 2:36
    a user generated gradient of 3 colours,
  • 2:44 - 2:46
    or a single colour.
  • 2:55 - 2:57
    All objects added to the scene
  • 2:57 - 2:58
    will receive ambient light
  • 2:58 - 3:02
    unless the ambient intensity value is set to 0
  • 3:03 - 3:06
    or the ambient light's colour values are set to black.
  • 3:08 - 3:10
    It is rare, if not impossible
  • 3:10 - 3:12
    for any real-world material
  • 3:12 - 3:16
    to have absolutely no reflectivity.
  • 3:16 - 3:19
    By default all objects in the scene
  • 3:19 - 3:21
    will also receive reflection information.
  • 3:22 - 3:26
    Even though the cube, sphere and plane in the scene
  • 3:26 - 3:29
    are unlit and ambient light is none
  • 3:29 - 3:31
    they still receive lighting information
  • 3:31 - 3:34
    in the form of reflections.
  • 3:34 - 3:37
    The default reflection source is the sky box.
  • 3:37 - 3:40
    This can be changed to a custom cube map.
  • 3:40 - 3:42
    To receive no default reflections
  • 3:42 - 3:44
    either set the custom cube map to none,
  • 3:47 - 3:49
    or remove the sky box.
  • 3:52 - 3:54
    It is worth noting that the default sky box
  • 3:54 - 3:56
    is procedurally generated
  • 3:56 - 3:58
    and new procedural sky boxes
  • 3:58 - 4:00
    can be created and saved as assets.
  • 4:14 - 4:16
    When lighting scenes in Unity
  • 4:16 - 4:18
    we can work with realtime lighting,
  • 4:18 - 4:20
    baked lighting,
  • 4:20 - 4:22
    or a mixture of both.
  • 4:23 - 4:26
    Realtime lighting is more easily modified at run time.
  • 4:26 - 4:28
    but it comes at a cost to performance.
  • 4:29 - 4:32
    Baked lighting on the other hand pre-calculates
  • 4:32 - 4:34
    much more detailed lighting information
  • 4:34 - 4:37
    and saves it to a light mapped texture on disc.
  • 4:37 - 4:39
    This light map information is then
  • 4:39 - 4:41
    read from the texture at run time,
  • 4:41 - 4:43
    avoiding the need to do any lighting
  • 4:43 - 4:45
    calculations when the project is running.
  • 4:46 - 4:48
    This saves performance,
  • 4:48 - 4:52
    but at the cost of dynamic changes in the scene.
  • 4:52 - 4:55
    Baked light maps are not updated at run time.
  • 4:55 - 4:59
    Lights can be switched between realtime, baked,
  • 4:59 - 5:01
    and mixed lighting on a per-light basis.
  • 5:02 - 5:04
    Using baked lighting exclusively
  • 5:04 - 5:07
    would be more appropriate for target platforms
  • 5:07 - 5:11
    such as mobile devices with lower performance capabilities.
  • 5:14 - 5:16
    The light mapping system can either work
  • 5:16 - 5:18
    continuously or on demand.
  • 5:20 - 5:22
    When continuous baking is selected
  • 5:22 - 5:25
    lighting changes will be baked in the background while editing.
  • 5:26 - 5:28
    These changes can either be properties
  • 5:28 - 5:29
    adjusted in the inspector,
  • 5:29 - 5:32
    or objects changed in the scene.
  • 5:43 - 5:45
    When continuous baking is not selected
  • 5:46 - 5:49
    changes will only preview on demand.
  • 5:50 - 5:53
    When the Build button in the lighting panel has been selected.
  • 6:00 - 6:02
    In this scene there is a directional light
  • 6:02 - 6:05
    coming in through the skylight in the ceiling.
  • 6:06 - 6:09
    This light contributes to the illumination of the entire scene
  • 6:09 - 6:11
    as the light bounces off of the surfaces
  • 6:11 - 6:13
    it lights directly,
  • 6:13 - 6:16
    on to other nearby surfaces in an indirect manner.
  • 6:17 - 6:19
    This light continues to indirectly
  • 6:19 - 6:21
    illuminate nearby surfaces
  • 6:21 - 6:23
    until the strength of the light fades
  • 6:23 - 6:25
    and it can bounce no more.
  • 6:26 - 6:28
    Decrease the intensity of the light
  • 6:28 - 6:31
    and the illumination of the scene decreases accordingly.
  • 6:35 - 6:37
    Likewise, if the directional light
  • 6:37 - 6:39
    is rotated to directly light a
  • 6:39 - 6:41
    different part of the scene,
  • 6:41 - 6:43
    it will now illuminate the scene in a different way,
  • 6:43 - 6:46
    with both it's direct and indirect lighting.
  • 6:49 - 6:52
    As materials created with a standard shader
  • 6:52 - 6:55
    can mimic a wide variety of physical surfaces
  • 6:55 - 6:57
    and different materials can have different
  • 6:57 - 6:59
    amounts of reflectivity
  • 6:59 - 7:01
    this can effect the scene's lighting.
  • 7:02 - 7:05
    To help balance this the Bounce Intensity can be adjusted
  • 7:05 - 7:08
    on either a per-light basis
  • 7:08 - 7:10
    or globally by adjusting the settings
  • 7:10 - 7:12
    in the lighting panel.
  • 7:13 - 7:15
    Adjustments can be made here to artificially
  • 7:15 - 7:19
    change the potential bounce of light from a lit surface.
  • 7:20 - 7:22
    Adjust the mount of indirect light
  • 7:22 - 7:24
    in the scene, and more.
  • 7:27 - 7:29
    In addition to lights we can use
  • 7:29 - 7:32
    emissive surfaces to contribute to the scene's lighting.
  • 7:33 - 7:35
    This scene is lit with a variety of lights
  • 7:35 - 7:39
    and light types, including emissive surfaces.
  • 7:39 - 7:43
    Emissive surfaces are a light source,
  • 7:43 - 7:47
    but they behave very much like indirect bounced light.
  • 7:47 - 7:49
    The primary emissive surfaces in the scene
  • 7:49 - 7:51
    are in the main corridor junction.
  • 7:51 - 7:54
    But additional panels are located throughout the scene.
  • 7:57 - 7:59
    All of these emissive surfaces use
  • 7:59 - 8:01
    the standard shader's Emission property
  • 8:02 - 8:04
    by adjusting the Emissive scale.
  • 8:04 - 8:07
    The float value next to the Emission property
  • 8:07 - 8:09
    and by adding a touch of colour,
  • 8:09 - 8:11
    the mood of our scene changes.
  • 8:14 - 8:17
    As these lights can participate in realtime light mapping
  • 8:17 - 8:19
    they can be controlled at runtime using
  • 8:19 - 8:21
    code or animation to create
  • 8:21 - 8:23
    complex changes in mood
  • 8:23 - 8:25
    while our projects are running.
  • 8:28 - 8:30
    The final contributing factor in lighting
  • 8:30 - 8:32
    a Unity scene are probes.
  • 8:33 - 8:35
    There are 2 types of probes in Unity.
  • 8:35 - 8:37
    Light probes
  • 8:38 - 8:40
    and reflection probes.
  • 8:41 - 8:43
    Light probes sample the lighting in the scene
  • 8:43 - 8:45
    at different positions in the world.
  • 8:47 - 8:50
    The information in these probes can be used
  • 8:50 - 8:52
    to light dynamic elements in the scene
  • 8:53 - 8:56
    such as characters or other moving objects
  • 8:56 - 8:58
    at a low cost to performance.
  • 9:02 - 9:04
    Reflection probes on the other hand
  • 9:04 - 9:06
    act as a single point of reference to
  • 9:06 - 9:08
    calculate reflections from
  • 9:09 - 9:11
    Surrounding each reflection probes
  • 9:11 - 9:13
    is a cuboid that specifies
  • 9:13 - 9:16
    what should be included in that reflection.
  • 9:17 - 9:20
    These probes sample the elements surrounding them
  • 9:20 - 9:22
    using box projection,
  • 9:22 - 9:24
    and store that information in a cube map.
  • 9:27 - 9:29
    Materials with reflective surfaces
  • 9:29 - 9:33
    that are on objects within the reflection probe's volume
  • 9:33 - 9:35
    can then reference this cube map to
  • 9:35 - 9:36
    create reflective surfaces.
  • 9:37 - 9:39
    By default there is one built-in
  • 9:39 - 9:41
    reflection probe in every scene.
  • 9:41 - 9:43
    This default reflection probe
  • 9:43 - 9:46
    reflects the sky box to create basic reflections.
  • 9:46 - 9:48
    For more detail in the reflections
  • 9:48 - 9:50
    additional reflection probes
  • 9:50 - 9:52
    should be added and positioned appropriately
  • 9:52 - 9:54
    for the reflective objects.
  • 9:57 - 10:00
    It is worth noting that phyically-based rendering
  • 10:00 - 10:02
    works best in linear colour space.
  • 10:02 - 10:04
    Linear colour space will give
  • 10:04 - 10:08
    a more realistic and mathematically correct result.
  • 10:10 - 10:12
    For best results make sure that
  • 10:12 - 10:14
    the colour space is set to linear
  • 10:14 - 10:16
    in the project's
  • 10:16 - 10:18
    Player Settings window.
  • 10:19 - 10:22
    Linear colour space is the default setting.
  • 10:23 - 10:25
    Be aware that not all platforms
  • 10:25 - 10:27
    support linear colour space however,
  • 10:27 - 10:29
    and that gamma is currently the
  • 10:29 - 10:32
    required colour space for most mobile platforms,.
  • 10:35 - 10:37
    When looking at all these aspects
  • 10:37 - 10:39
    to lighting a scene in Unity
  • 10:39 - 10:42
    they can be summed up effectively
  • 10:42 - 10:44
    with the main contributory factors.
  • 10:47 - 10:48
    Ambient light.
  • 10:49 - 10:51
    Reflections.
  • 10:51 - 10:53
    And light sources.
  • 10:53 - 10:55
    Working with materials created
  • 10:55 - 10:57
    with the standard shader being
  • 10:57 - 11:00
    drawn using phyically-based rendering
  • 11:00 - 11:02
    with global illumination to calculate
  • 11:02 - 11:04
    the indirect light and create
  • 11:04 - 11:07
    more complex, more realistic scenes.
Title:
Unity 5 Graphics - Lighting Overview - Unity Official Tutorials
Description:

more » « less
Video Language:
English
Duration:
11:17

English subtitles

Revisions