< Return to Video

Unity 5 Graphics - The Standard Shader - Unity Official Tutorials

  • 0:03 - 0:06
    Standard Shader jest bardzo realistycznym i wszechstronnym shaderem.
  • 0:08 - 0:10
    Ten prosty, oparty na fizyce shader
  • 0:10 - 0:12
    może zostać wykorzystany do stworzenia olbrzymiej ilości
  • 0:12 - 0:14
    materiałów. Często się zdaża
  • 0:14 - 0:16
    że jedynie ten shader wystarczy
  • 0:16 - 0:18
    do stworzenia wszystkich materiałów w danym projekcie.
  • 0:20 - 0:24
    Ten shader jest używany do dmyślnych materiałów.
  • 0:24 - 0:26
    więc każdy kształt renderowany z
  • 0:26 - 0:30
    domyślnym materiałem będzie wykorzystywał standard shader.
  • 0:33 - 0:36
    Wszystkie nowo utworzone materiały
  • 0:37 - 0:39
    także będą używały standard shader
  • 0:40 - 0:43
    Aby zmienić shader używany przez materiał
  • 0:43 - 0:45
    wybierz menu shaderów w materiale
  • 0:46 - 0:49
    Zaznacz standard, aby używać standard shader
  • 0:50 - 0:52
    Warto zauważyć, że unity
  • 0:52 - 0:54
    posiada shadery dla obu
  • 0:54 - 0:57
    popularnych podejśc do opartego na fizyce renderowania
  • 0:58 - 0:59
    domyślnie metaliczny(metalic)
  • 1:00 - 1:02
    i lustrzany(specular)
  • 1:02 - 1:03
    Aby wybrać standard shader
  • 1:03 - 1:05
    korzystający z podejścia lustrzanego(specular)
  • 1:05 - 1:08
    wybierz Standard (Specular Setup).
  • 1:08 - 1:10
    W przeciwnym razie zaznacz Standard
  • 1:10 - 1:12
    dla podejścia metalicznego(metalic)
  • 1:15 - 1:17
    Ważne, aby zrozumieć, że
  • 1:17 - 1:19
    podejście metaliczne do opartego na fizyce renderowania
  • 1:19 - 1:21
    nie jest jedynie dla materiałów
  • 1:21 - 1:23
    mających wyglądać metalicznie.
  • 1:24 - 1:26
    To podejście jest zwane metalicznym
  • 1:26 - 1:28
    ponieważ polega na
  • 1:28 - 1:31
    ustalaniu jak bardzo metaliczna, bądź niemetaliczna
  • 1:31 - 1:33
    jest dana powierzchnia.
  • 1:33 - 1:36
    Jest to przeciwstawne do podejścia "specular"
  • 1:36 - 1:37
    w którym wybieramy jak bardzo lustrzana,
  • 1:37 - 1:39
    lub nielustrzana jest dana powierzchnia.
  • 1:41 - 1:43
    Oba podejścia są poprawne
    37
    00:01:42,505 --> 00:01:44,505
    dla materiałów opartych na fizyce.
  • 1:47 - 1:49
    Ten oparty na fizyce materiał
  • 1:49 - 1:51
    wciąż jest standardowym materiałem Unity
  • 1:52 - 1:54
    i jest skojarzony
  • 1:54 - 1:56
    ze standardowym systemem renderowania.
  • 2:00 - 2:03
    Standard shader składa się z trzech części:
  • 2:04 - 2:06
    Rendering Mode(sposób renderowania)
  • 2:06 - 2:08
    Main Maps(Mapy podstawowe)
  • 2:08 - 2:10
    and Secondary Maps(mapy drugorzędne)
  • 2:12 - 2:15
    W standard shader możemy wybrać spośród trzech sposobów renderowania:
  • 2:15 - 2:18
    Opaque, Cutout, Fade and Transparent.
  • 2:19 - 2:23
    Większość materiałów jest nieprzeźroczystych, czyli "opaque"
  • 2:23 - 2:26
    "Opaque" jest domyślnym sposobem renderowania.
  • 2:26 - 2:29
    Dla materiałów przezroczystych, takich jak szkło
  • 2:29 - 2:31
    wybierz tryb "Transparent"
  • 2:32 - 2:34
    W przezroczystym trybie renderowania
  • 2:34 - 2:37
    kanał alpha głównej tekstury
  • 2:37 - 2:40
    jest używany do kontroli przezroczystości danego materiału
  • 2:42 - 2:44
    W trybie renderowania "cutout"
  • 2:44 - 2:46
    kanał alpha głównej tekstury
  • 2:46 - 2:49
    jest używany do wycięcia niektórych części tejże tekstury
  • 2:50 - 2:53
    Jeśli kanał alpha głównej tekstury zawiera zróżnicowane wartości
  • 2:53 - 2:55
    suwak o nazwie "alpha cutoff" może zostać użyty
  • 2:55 - 2:57
    do dostosowania wielkości wyciętego obszaru
  • 2:57 - 3:01
    do dostosowania wielkości wyciętego obszaru
  • 3:03 - 3:05
    Tryb renderowania o nazwie "Fade" jest bardzo podobny
  • 3:05 - 3:07
    do trybu "Transparent"
  • 3:08 - 3:10
    "Fade" służy do całkowitego wymazywania
  • 3:10 - 3:12
    obiektów na ekranie.
  • 3:12 - 3:14
    W trybie renderowania "transparent"
  • 3:14 - 3:17
    przezroczysty materiał zachowa swoją zdolność
  • 3:17 - 3:21
    odbijania części światła, niezależnie wartości kanału alpha.
  • 3:21 - 3:23
    "Fade" natomiast wymaże wszystkie
  • 3:23 - 3:25
    odpowiednie aspekty materiału,
  • 3:25 - 3:28
    więc w tym przypadku przy ustawieniu alpha na 0, obiekt będzie całkowicie niewidzialny.
  • 3:30 - 3:34
    Część z mapami głównymi "main maps" określa wygląd materiału.
  • 3:34 - 3:37
    Zanim przyjrzymy się z bliska każdej zmiennej,
  • 3:37 - 3:41
    jest kilka tematów, które warto poruszyć wcześniej
  • 3:41 - 3:43
    Optymalizacja
  • 3:43 - 3:46
    shader "Standard" jest świetnie zoptymalizowany.
  • 3:47 - 3:49
    Kiedy shader się kompiluje
  • 3:49 - 3:51
    wykonują się dwie ważne rzeczy:
  • 3:51 - 3:55
    Wszystkie nieużywane zmienne są pomijane, oraz
  • 3:55 - 3:57
    sprawdzana jest docelowa platforma
  • 3:57 - 4:00
    i shader zostaje zoptymalizowany dla danego urządzenia
  • 4:01 - 4:04
    Z tego powodu nie ma potrzeby wypełniać każdej
  • 4:04 - 4:06
    zmiennej wartością lub teksturą
  • 4:08 - 4:10
    i nie ma obawy, że niepotrzebnie zostaną zużyte
  • 4:10 - 4:12
    zasoby sprzętowe do nieużywanych właściwości.
  • 4:16 - 4:18
    Cieniowanie oparte na fizyce.
  • 4:18 - 4:20
    Cieniowanie oparte na fizyce stara się zastosować
  • 4:20 - 4:24
    pewne fizyczne aspekty powierzchni materiału
  • 4:24 - 4:26
    włączając jego kolor światła rozproszonego,
  • 4:26 - 4:28
    odbicie lustrzane i inne właściwości,
  • 4:28 - 4:30
    więc materiał zachowuje się poprawnie
  • 4:30 - 4:33
    i wiarygodnie we wszystkich warunkach oświetleniowych.
  • 4:34 - 4:36
    The response of the scene lighting to the material
  • 4:36 - 4:38
    created with a physically based shader
  • 4:38 - 4:41
    mimics light in the real physical world.
  • 4:42 - 4:44
    This means that even though there is
  • 4:44 - 4:46
    full control over the values on
  • 4:46 - 4:49
    all of the properties in the standard shader
  • 4:49 - 4:51
    there are certain ranges of values that
  • 4:51 - 4:53
    work best for certain types of materials.
  • 4:54 - 4:58
    This is particularly true of the metallic and specular values
  • 4:58 - 5:01
    depending up which approach is being used
  • 5:01 - 5:04
    Taking specular colour for example,
  • 5:04 - 5:06
    when analysing real-world materials
  • 5:06 - 5:08
    most materials have a specular range
  • 5:08 - 5:10
    that is a very dark grey.
  • 5:11 - 5:15
    Metals created with a specular workflow are one of the few exceptions,
  • 5:15 - 5:18
    they have very bright specular values.
  • 5:19 - 5:22
    As well, no material, even the most dull,
  • 5:22 - 5:24
    has no specularity at all.
  • 5:25 - 5:27
    This means to have a physically based
  • 5:27 - 5:29
    material behave correctly
  • 5:29 - 5:31
    some attention needs to be paid in using
  • 5:31 - 5:34
    the correct physical values for some key properties,
  • 5:34 - 5:37
    especially the specular or metallic properties
  • 5:37 - 5:39
    depending upon the approach being used.
  • 5:40 - 5:43
    For more information on physical-based shading,
  • 5:43 - 5:46
    material charts and sample materials
  • 5:46 - 5:48
    please see the information linked below.
  • 5:49 - 5:51
    There is no need to panic however.
  • 5:51 - 5:53
    Items with materials from previous versions of Unity
  • 5:53 - 5:55
    will work well out of the box.
  • 5:56 - 5:58
    Upgrading from a legacy diffuse shader
  • 5:58 - 6:01
    to the standard shader should display little or no difference.
  • 6:03 - 6:06
    In the main map section each of these properties
  • 6:06 - 6:08
    control one aspect of the final material.
  • 6:09 - 6:12
    Each property can be defined by a texture map.
  • 6:13 - 6:15
    With the metallic approach,
  • 6:15 - 6:18
    for the albido, metallic and emission properties
  • 6:18 - 6:20
    the texture is optional.
  • 6:21 - 6:23
    The albido and emission properties
  • 6:23 - 6:26
    can simply use a colour value instead of a texture.
  • 6:27 - 6:28
    The colour value is not available on
  • 6:28 - 6:30
    the emission property until the emissive
  • 6:30 - 6:32
    scale is larger than 0.
  • 6:35 - 6:37
    The metallic property can use a slider
  • 6:37 - 6:39
    instead of a texture.
  • 6:43 - 6:45
    The albido property uses a
  • 6:45 - 6:47
    combination of an optional texture.
  • 6:49 - 6:52
    And a colour value to define the base look of the material.
  • 6:53 - 6:56
    The colour value will tint the texture.
  • 6:57 - 7:01
    Where pure white leaves the main texture unaffected,
  • 7:02 - 7:04
    if there is no texture being used
  • 7:04 - 7:07
    the tint colour will be the base colour for the material
  • 7:10 - 7:12
    The metallic property can be defined
  • 7:12 - 7:14
    by either a texture
  • 7:15 - 7:18
    or a value from 0 to 1
  • 7:18 - 7:20
    set by the slider.
  • 7:20 - 7:24
    This defines the metalness of the material surface.
  • 7:25 - 7:27
    Metalness works very closely with smoothness.
  • 7:29 - 7:31
    The smoothness property is used to
  • 7:31 - 7:32
    control the smoothness,
  • 7:32 - 7:35
    or micro-surface detail, of the material.
  • 7:35 - 7:38
    It is also a value between 0 and 1.
  • 7:41 - 7:43
    The less smooth the surface is,
  • 7:43 - 7:45
    the more diffuse the reflections will be.
  • 7:45 - 7:48
    The more smooth, the sharper the reflections.
  • 7:53 - 7:55
    The metallic property can use a texture
  • 7:55 - 7:57
    to define the material's metalness.
  • 7:58 - 8:00
    This texture can be a simple shade of grey
  • 8:00 - 8:03
    used to define the metalness from black,
  • 8:03 - 8:05
    or non-metallic,
  • 8:05 - 8:07
    to white, completely metallic.
  • 8:07 - 8:10
    However, the advantage of using a texture
  • 8:10 - 8:13
    to define the metalness of a material
  • 8:13 - 8:15
    is to vary the metalness value
  • 8:15 - 8:17
    across the surface of the material.
  • 8:18 - 8:21
    An additional advantage is this texture's alpha channel.
  • 8:22 - 8:24
    This alpha channel can be used to define
  • 8:24 - 8:26
    a smoothness map.
  • 8:28 - 8:30
    Many materials are far more complex
  • 8:30 - 8:32
    than a single uniform surface.
  • 8:33 - 8:35
    Take this leather case for example.
  • 8:35 - 8:37
    With a single value for metalness and a
  • 8:37 - 8:39
    single value for smoothness
  • 8:40 - 8:42
    the case looks good.
  • 8:42 - 8:43
    But it could look better.
  • 8:44 - 8:46
    Use a metalness and smoothness map
  • 8:46 - 8:48
    to describe the properties.
  • 8:50 - 8:52
    And it looks much better.
  • 8:52 - 8:54
    Note how the straps are far more glossy
  • 8:54 - 8:56
    than the main body of the case.
  • 8:56 - 8:58
    Giving them a feel of polished leather.
  • 8:59 - 9:01
    It is worth noting that when using a texture
  • 9:01 - 9:03
    to define the metalness
  • 9:03 - 9:05
    the smoothness value must also be
  • 9:05 - 9:07
    defined by that texture's alpha channel.
  • 9:08 - 9:10
    It is also worth noting that the metalness
  • 9:10 - 9:12
    value is stored only in the red
  • 9:12 - 9:15
    channel of the metalness map's RGB values.
  • 9:16 - 9:18
    The green and blue channels are ignored.
  • 9:19 - 9:22
    It is often easier however to visualise
  • 9:22 - 9:24
    the metalness values of a texture
  • 9:24 - 9:27
    if all three colour channels share the same map,
  • 9:27 - 9:30
    so the texture appears as a greyscale image.
  • 9:31 - 9:33
    When using the standard shader with the specular setup
  • 9:36 - 9:38
    the metallic property is replaced with
  • 9:38 - 9:39
    the specular property.
  • 9:40 - 9:42
    The specular approach also uses
  • 9:42 - 9:45
    a smoothness property, which behaves essentially
  • 9:45 - 9:48
    in the same way as with the metalness approach.
  • 9:51 - 9:54
    The specualar property can either be a texture
  • 9:55 - 9:57
    or a colour value
  • 9:57 - 9:59
    and defines the specular reflectivity
  • 9:59 - 10:02
    of the material's surface.
  • 10:02 - 10:05
    The specular value can have some colour in it
  • 10:05 - 10:07
    but looking at real world values
  • 10:07 - 10:09
    with the exception of some metals
  • 10:09 - 10:11
    this is usually a grey and often very dark.
  • 10:13 - 10:16
    Specular maps are usually a dark grey as well.
  • 10:18 - 10:20
    When a specular texture map is not being used
  • 10:20 - 10:22
    the overall surface smoothness can be
  • 10:22 - 10:24
    set with the slider.
  • 10:27 - 10:29
    This is easier to see when the albido
  • 10:29 - 10:31
    texture is removed.
  • 10:32 - 10:34
    The ball looks like polished porcelain.
  • 10:35 - 10:39
    For a more true mirror, the specular from dark grey,
  • 10:39 - 10:41
    which makes the ball look like porcelain
  • 10:41 - 10:44
    in to the range of metals and it will now
  • 10:44 - 10:46
    reflect the sky and surroundings.
  • 10:46 - 10:49
    The smoother the surface, the more it is mirror-like.
  • 10:50 - 10:53
    The rougher the surface the more diffuse,
  • 10:53 - 10:55
    or scattered the reflections are.
  • 10:57 - 10:59
    The normal map property is an optional property
  • 10:59 - 11:02
    used to define the apparent bumpiness of the surface.
  • 11:03 - 11:05
    When a normal map is applied
  • 11:06 - 11:08
    the strength of the normal map can be controlled
  • 11:08 - 11:10
    by adjusting the normal map value.
  • 11:11 - 11:13
    As well as positive numbers, this value
  • 11:13 - 11:15
    can be a negative number
  • 11:15 - 11:16
    or 0.
  • 11:18 - 11:20
    The height map property is an optional
  • 11:20 - 11:22
    property used to define the apparent
  • 11:22 - 11:24
    height of the surface.
  • 11:24 - 11:26
    When a height map is applied
  • 11:27 - 11:29
    the strength of the height map can be controlled
  • 11:29 - 11:31
    by adjusting the height map value.
  • 11:33 - 11:35
    The occlusion property uses a
  • 11:35 - 11:37
    texture map to define the amount of
  • 11:37 - 11:40
    ambient occlusion that is applied to the material.
  • 11:41 - 11:43
    This is used to help darken
  • 11:43 - 11:45
    hidden or recessed areas on the texture.
  • 11:46 - 11:48
    The ambient occlusion map also
  • 11:48 - 11:50
    prevents specular and reflections in
  • 11:50 - 11:53
    these occluded areas, given the material
  • 11:53 - 11:55
    a more realistic look.
  • 11:56 - 11:59
    The emission property controls whether or not
  • 11:59 - 12:01
    the material's surface will emit light.
  • 12:02 - 12:04
    The material's emission value can contribute
  • 12:04 - 12:06
    to the scene's global illumination.
  • 12:07 - 12:09
    The strength of the emission can be controlled
  • 12:09 - 12:11
    by the emission value.
  • 12:11 - 12:14
    The shape of the emission can be controlled with an emission map.
  • 12:15 - 12:17
    The map can be a simple black and white map.
  • 12:24 - 12:26
    bBut this texture can also be a colour map.
  • 12:33 - 12:35
    When there is a value for emission
  • 12:35 - 12:37
    the contribution of the emissive light
  • 12:37 - 12:39
    can be assigned to either the baked light maps
  • 12:41 - 12:43
    or to the real time light maps.
  • 12:46 - 12:49
    The detail mask property is an optional mask element
  • 12:49 - 12:51
    to control the secondary maps.
  • 12:52 - 12:55
    Tiling and offset control the position of the map.
  • 12:56 - 12:58
    The secondary maps are used to define
  • 12:58 - 13:00
    additional surface detail.
  • 13:00 - 13:04
    This additional detail, sometimes referred to as micro detail,
  • 13:04 - 13:06
    is added on top of the surface defined
  • 13:06 - 13:07
    by the main maps.
  • 13:08 - 13:10
    This helps to add extra detail and
  • 13:10 - 13:13
    variation to a material, which is overlaid
  • 13:13 - 13:15
    on top of the main maps defining that material.
  • 13:16 - 13:19
    Because detail maps can be tiled across meshes
  • 13:20 - 13:23
    they can add incredibly high levels of surface detail.
Title:
Unity 5 Graphics - The Standard Shader - Unity Official Tutorials
Description:

more » « less
Video Language:
English
Duration:
13:28

Polish subtitles

Revisions