WEBVTT 00:00:03.150 --> 00:00:06.451 Standard Shader jest bardzo realistycznym i wszechstronnym shaderem. 00:00:07.520 --> 00:00:09.520 Ten prosty, oparty na fizyce shader 00:00:09.520 --> 00:00:11.520 może zostać wykorzystany do stworzenia olbrzymiej ilości 00:00:11.520 --> 00:00:13.520 materiałów. Często się zdaża 00:00:13.520 --> 00:00:15.520 że jedynie ten shader wystarczy 00:00:15.520 --> 00:00:18.121 do stworzenia wszystkich materiałów w danym projekcie. 00:00:19.812 --> 00:00:24.026 Ten shader jest używany do dmyślnych materiałów. 00:00:24.026 --> 00:00:26.026 więc każdy kształt renderowany z 00:00:26.026 --> 00:00:29.768 domyślnym materiałem będzie wykorzystywał standard shader. 00:00:33.412 --> 00:00:36.190 Wszystkie nowo utworzone materiały 00:00:36.930 --> 00:00:38.930 także będą używały standard shader 00:00:40.121 --> 00:00:42.611 Aby zmienić shader używany przez materiał 00:00:42.611 --> 00:00:45.236 wybierz menu shaderów w materiale 00:00:46.046 --> 00:00:49.291 Zaznacz standard, aby używać standard shader 00:00:49.971 --> 00:00:51.971 Warto zauważyć, że unity 00:00:51.971 --> 00:00:53.971 posiada shadery dla obu 00:00:53.971 --> 00:00:56.779 popularnych podejśc do opartego na fizyce renderowania 00:00:57.736 --> 00:00:59.443 domyślnie metaliczny(metalic) 00:00:59.930 --> 00:01:01.613 i lustrzany(specular) 00:01:01.613 --> 00:01:03.251 Aby wybrać standard shader 00:01:03.251 --> 00:01:05.167 korzystający z podejścia lustrzanego(specular) 00:01:05.167 --> 00:01:07.601 wybierz Standard (Specular Setup). 00:01:08.475 --> 00:01:10.475 W przeciwnym razie zaznacz Standard 00:01:10.475 --> 00:01:12.475 dla podejścia metalicznego(metalic) 00:01:14.750 --> 00:01:16.750 Ważne, aby zrozumieć, że 00:01:16.750 --> 00:01:19.337 podejście metaliczne do opartego na fizyce renderowania 00:01:19.337 --> 00:01:21.337 nie jest jedynie dla materiałów 00:01:21.337 --> 00:01:23.100 mających wyglądać metalicznie. 00:01:23.696 --> 00:01:25.696 To podejście jest zwane metalicznym 00:01:25.696 --> 00:01:27.696 ponieważ polega na 00:01:27.696 --> 00:01:30.761 ustalaniu jak bardzo metaliczna, bądź niemetaliczna 00:01:30.761 --> 00:01:32.761 jest dana powierzchnia. 00:01:33.427 --> 00:01:35.703 Jest to przeciwstawne do podejścia "specular" 00:01:35.703 --> 00:01:37.451 w którym wybieramy jak bardzo lustrzana, 00:01:37.451 --> 00:01:39.451 lub nielustrzana jest dana powierzchnia. 00:01:40.505 --> 00:01:42.505 Oba podejścia są poprawne 37 00:01:42,505 --> 00:01:44,505 dla materiałów opartych na fizyce. 00:01:47.459 --> 00:01:49.459 Ten oparty na fizyce materiał 00:01:49.459 --> 00:01:51.362 wciąż jest standardowym materiałem Unity 00:01:51.695 --> 00:01:53.695 i jest skojarzony 00:01:53.695 --> 00:01:56.302 ze standardowym systemem renderowania. 00:02:00.014 --> 00:02:02.990 Standard shader składa się z trzech części: 00:02:03.601 --> 00:02:05.601 Rendering Mode(sposób renderowania) 00:02:05.601 --> 00:02:07.601 Main Maps(Mapy podstawowe) 00:02:07.601 --> 00:02:09.601 and Secondary Maps(mapy drugorzędne) 00:02:11.865 --> 00:02:14.685 W standard shader możemy wybrać spośród trzech sposobów renderowania: 00:02:14.685 --> 00:02:17.996 Opaque, Cutout, Fade and Transparent. 00:02:19.038 --> 00:02:22.598 Większość materiałów jest nieprzeźroczystych, czyli "opaque" 00:02:23.167 --> 00:02:25.558 "Opaque" jest domyślnym sposobem renderowania. 00:02:26.350 --> 00:02:29.225 Dla materiałów przezroczystych, takich jak szkło 00:02:29.225 --> 00:02:31.225 wybierz tryb "Transparent" 00:02:31.656 --> 00:02:33.656 W przezroczystym trybie renderowania 00:02:34.142 --> 00:02:36.819 kanał alpha głównej tekstury 00:02:36.819 --> 00:02:39.930 jest używany do kontroli przezroczystości danego materiału 00:02:41.569 --> 00:02:43.918 W trybie renderowania "cutout" 00:02:43.918 --> 00:02:45.918 kanał alpha głównej tekstury 00:02:45.918 --> 00:02:49.022 jest używany do wycięcia niektórych części tejże tekstury 00:02:49.689 --> 00:02:53.240 Jeśli kanał alpha głównej tekstury zawiera zróżnicowane wartości 00:02:53.240 --> 00:02:55.240 suwak o nazwie "alpha cutoff" może zostać użyty 00:02:55.240 --> 00:02:57.240 do dostosowania wielkości wyciętego obszaru 00:02:57.240 --> 00:03:00.837 do dostosowania wielkości wyciętego obszaru 00:03:02.546 --> 00:03:04.546 Tryb renderowania o nazwie "Fade" jest bardzo podobny 00:03:04.546 --> 00:03:06.546 do trybu "Transparent" 00:03:07.509 --> 00:03:09.509 "Fade" służy do całkowitego wymazywania 00:03:09.509 --> 00:03:11.509 obiektów na ekranie. 00:03:12.192 --> 00:03:14.192 W trybie renderowania "transparent" 00:03:14.192 --> 00:03:16.750 przezroczysty materiał zachowa swoją zdolność 00:03:16.750 --> 00:03:20.681 odbijania części światła, niezależnie wartości kanału alpha. 00:03:20.681 --> 00:03:22.681 "Fade" natomiast wymaże wszystkie 00:03:22.681 --> 00:03:24.681 odpowiednie aspekty materiału, 00:03:24.681 --> 00:03:28.018 więc w tym przypadku przy ustawieniu alpha na 0, obiekt będzie całkowicie niewidzialny. 00:03:30.347 --> 00:03:33.736 Część z mapami głównymi "main maps" określa wygląd materiału. 00:03:34.361 --> 00:03:37.301 Zanim przyjrzymy się z bliska każdej zmiennej, 00:03:37.301 --> 00:03:40.578 jest kilka tematów, które warto poruszyć wcześniej 00:03:41.314 --> 00:03:43.131 Optymalizacja 00:03:43.131 --> 00:03:46.071 shader "Standard" jest świetnie zoptymalizowany. 00:03:46.613 --> 00:03:48.613 Kiedy shader się kompiluje 00:03:48.613 --> 00:03:50.613 wykonują się dwie ważne rzeczy: 00:03:51.113 --> 00:03:54.698 Wszystkie nieużywane zmienne są pomijane, oraz 00:03:55.240 --> 00:03:57.240 sprawdzana jest docelowa platforma 00:03:57.240 --> 00:03:59.907 i shader zostaje zoptymalizowany dla danego urządzenia 00:04:00.559 --> 00:04:03.653 Z tego powodu nie ma potrzeby wypełniać każdej 00:04:03.653 --> 00:04:06.073 zmiennej wartością lub teksturą 00:04:07.681 --> 00:04:09.681 i nie ma obawy, że niepotrzebnie zostaną zużyte 00:04:09.681 --> 00:04:12.357 zasoby sprzętowe do nieużywanych właściwości. 00:04:15.750 --> 00:04:17.750 Cieniowanie oparte na fizyce. 00:04:18.451 --> 00:04:20.451 Cieniowanie oparte na fizyce stara się zastosować 00:04:20.451 --> 00:04:23.952 pewne fizyczne aspekty powierzchni materiału 00:04:23.952 --> 00:04:25.952 włączając jego kolor światła rozproszonego, 00:04:25.952 --> 00:04:27.952 odbicie lustrzane i inne właściwości, 00:04:27.952 --> 00:04:30.355 więc materiał zachowuje się poprawnie 00:04:30.355 --> 00:04:33.279 i wiarygodnie we wszystkich warunkach oświetleniowych. 00:04:33.938 --> 00:04:36.325 The response of the scene lighting to the material 00:04:36.325 --> 00:04:38.325 created with a physically based shader 00:04:38.325 --> 00:04:41.192 mimics light in the real physical world. 00:04:41.839 --> 00:04:43.839 This means that even though there is 00:04:43.839 --> 00:04:45.839 full control over the values on 00:04:45.839 --> 00:04:48.613 all of the properties in the standard shader 00:04:48.613 --> 00:04:50.613 there are certain ranges of values that 00:04:50.613 --> 00:04:53.359 work best for certain types of materials. 00:04:54.057 --> 00:04:57.736 This is particularly true of the metallic and specular values 00:04:57.736 --> 00:05:00.543 depending up which approach is being used 00:05:01.273 --> 00:05:03.723 Taking specular colour for example, 00:05:03.723 --> 00:05:06.199 when analysing real-world materials 00:05:06.199 --> 00:05:08.199 most materials have a specular range 00:05:08.199 --> 00:05:10.199 that is a very dark grey. 00:05:10.768 --> 00:05:15.416 Metals created with a specular workflow are one of the few exceptions, 00:05:15.416 --> 00:05:18.095 they have very bright specular values. 00:05:19.043 --> 00:05:22.066 As well, no material, even the most dull, 00:05:22.066 --> 00:05:24.066 has no specularity at all. 00:05:24.997 --> 00:05:26.997 This means to have a physically based 00:05:26.997 --> 00:05:28.997 material behave correctly 00:05:28.997 --> 00:05:30.997 some attention needs to be paid in using 00:05:30.997 --> 00:05:34.316 the correct physical values for some key properties, 00:05:34.316 --> 00:05:37.149 especially the specular or metallic properties 00:05:37.149 --> 00:05:39.149 depending upon the approach being used. 00:05:40.224 --> 00:05:42.863 For more information on physical-based shading, 00:05:42.863 --> 00:05:45.553 material charts and sample materials 00:05:45.553 --> 00:05:47.553 please see the information linked below. 00:05:48.512 --> 00:05:50.512 There is no need to panic however. 00:05:50.512 --> 00:05:53.002 Items with materials from previous versions of Unity 00:05:53.002 --> 00:05:55.284 will work well out of the box. 00:05:55.894 --> 00:05:58.214 Upgrading from a legacy diffuse shader 00:05:58.214 --> 00:06:01.265 to the standard shader should display little or no difference. 00:06:03.307 --> 00:06:05.738 In the main map section each of these properties 00:06:05.738 --> 00:06:08.318 control one aspect of the final material. 00:06:09.127 --> 00:06:11.942 Each property can be defined by a texture map. 00:06:13.328 --> 00:06:15.096 With the metallic approach, 00:06:15.096 --> 00:06:18.163 for the albido, metallic and emission properties 00:06:18.163 --> 00:06:20.163 the texture is optional. 00:06:20.661 --> 00:06:22.904 The albido and emission properties 00:06:22.904 --> 00:06:25.531 can simply use a colour value instead of a texture. 00:06:26.508 --> 00:06:28.416 The colour value is not available on 00:06:28.416 --> 00:06:30.416 the emission property until the emissive 00:06:30.416 --> 00:06:32.416 scale is larger than 0. 00:06:34.775 --> 00:06:36.775 The metallic property can use a slider 00:06:36.775 --> 00:06:38.775 instead of a texture. 00:06:42.516 --> 00:06:44.516 The albido property uses a 00:06:44.516 --> 00:06:46.516 combination of an optional texture. 00:06:48.543 --> 00:06:51.598 And a colour value to define the base look of the material. 00:06:52.685 --> 00:06:55.682 The colour value will tint the texture. 00:06:57.470 --> 00:07:00.535 Where pure white leaves the main texture unaffected, 00:07:01.552 --> 00:07:03.552 if there is no texture being used 00:07:03.552 --> 00:07:06.792 the tint colour will be the base colour for the material 00:07:09.884 --> 00:07:11.884 The metallic property can be defined 00:07:11.884 --> 00:07:13.884 by either a texture 00:07:15.248 --> 00:07:18.303 or a value from 0 to 1 00:07:18.303 --> 00:07:20.303 set by the slider. 00:07:20.303 --> 00:07:23.506 This defines the metalness of the material surface. 00:07:24.538 --> 00:07:27.332 Metalness works very closely with smoothness. 00:07:28.548 --> 00:07:30.548 The smoothness property is used to 00:07:30.548 --> 00:07:32.061 control the smoothness, 00:07:32.061 --> 00:07:35.453 or micro-surface detail, of the material. 00:07:35.453 --> 00:07:38.453 It is also a value between 0 and 1. 00:07:41.028 --> 00:07:43.028 The less smooth the surface is, 00:07:43.028 --> 00:07:44.824 the more diffuse the reflections will be. 00:07:45.360 --> 00:07:48.204 The more smooth, the sharper the reflections. 00:07:52.650 --> 00:07:54.650 The metallic property can use a texture 00:07:54.650 --> 00:07:57.426 to define the material's metalness. 00:07:58.071 --> 00:08:00.071 This texture can be a simple shade of grey 00:08:00.071 --> 00:08:03.163 used to define the metalness from black, 00:08:03.163 --> 00:08:04.517 or non-metallic, 00:08:04.517 --> 00:08:06.517 to white, completely metallic. 00:08:07.217 --> 00:08:10.339 However, the advantage of using a texture 00:08:10.339 --> 00:08:12.686 to define the metalness of a material 00:08:12.686 --> 00:08:14.686 is to vary the metalness value 00:08:14.686 --> 00:08:16.686 across the surface of the material. 00:08:17.589 --> 00:08:20.654 An additional advantage is this texture's alpha channel. 00:08:21.524 --> 00:08:23.524 This alpha channel can be used to define 00:08:23.524 --> 00:08:25.524 a smoothness map. 00:08:27.791 --> 00:08:29.791 Many materials are far more complex 00:08:29.791 --> 00:08:31.791 than a single uniform surface. 00:08:32.657 --> 00:08:34.657 Take this leather case for example. 00:08:35.486 --> 00:08:37.486 With a single value for metalness and a 00:08:37.486 --> 00:08:39.131 single value for smoothness 00:08:39.615 --> 00:08:41.615 the case looks good. 00:08:41.615 --> 00:08:43.138 But it could look better. 00:08:43.890 --> 00:08:45.891 Use a metalness and smoothness map 00:08:45.891 --> 00:08:47.891 to describe the properties. 00:08:49.660 --> 00:08:51.660 And it looks much better. 00:08:51.660 --> 00:08:53.660 Note how the straps are far more glossy 00:08:53.660 --> 00:08:55.660 than the main body of the case. 00:08:55.660 --> 00:08:57.660 Giving them a feel of polished leather. 00:08:58.969 --> 00:09:00.969 It is worth noting that when using a texture 00:09:00.969 --> 00:09:02.969 to define the metalness 00:09:02.969 --> 00:09:04.969 the smoothness value must also be 00:09:04.969 --> 00:09:06.969 defined by that texture's alpha channel. 00:09:07.983 --> 00:09:09.983 It is also worth noting that the metalness 00:09:09.983 --> 00:09:11.983 value is stored only in the red 00:09:11.983 --> 00:09:15.013 channel of the metalness map's RGB values. 00:09:15.990 --> 00:09:17.990 The green and blue channels are ignored. 00:09:19.059 --> 00:09:21.923 It is often easier however to visualise 00:09:21.923 --> 00:09:23.923 the metalness values of a texture 00:09:23.923 --> 00:09:26.709 if all three colour channels share the same map, 00:09:26.709 --> 00:09:29.573 so the texture appears as a greyscale image. 00:09:30.716 --> 00:09:33.440 When using the standard shader with the specular setup 00:09:35.615 --> 00:09:37.615 the metallic property is replaced with 00:09:37.615 --> 00:09:39.173 the specular property. 00:09:39.891 --> 00:09:41.891 The specular approach also uses 00:09:41.891 --> 00:09:44.775 a smoothness property, which behaves essentially 00:09:44.775 --> 00:09:47.546 in the same way as with the metalness approach. 00:09:50.956 --> 00:09:53.585 The specualar property can either be a texture 00:09:55.278 --> 00:09:56.728 or a colour value 00:09:57.499 --> 00:09:59.499 and defines the specular reflectivity 00:09:59.499 --> 00:10:01.628 of the material's surface. 00:10:01.628 --> 00:10:04.527 The specular value can have some colour in it 00:10:04.527 --> 00:10:06.527 but looking at real world values 00:10:06.527 --> 00:10:08.527 with the exception of some metals 00:10:08.527 --> 00:10:11.449 this is usually a grey and often very dark. 00:10:12.610 --> 00:10:15.518 Specular maps are usually a dark grey as well. 00:10:17.545 --> 00:10:20.332 When a specular texture map is not being used 00:10:20.332 --> 00:10:22.332 the overall surface smoothness can be 00:10:22.332 --> 00:10:24.332 set with the slider. 00:10:26.765 --> 00:10:28.765 This is easier to see when the albido 00:10:28.765 --> 00:10:30.765 texture is removed. 00:10:31.502 --> 00:10:33.502 The ball looks like polished porcelain. 00:10:34.737 --> 00:10:38.692 For a more true mirror, the specular from dark grey, 00:10:38.692 --> 00:10:40.692 which makes the ball look like porcelain 00:10:40.692 --> 00:10:43.547 in to the range of metals and it will now 00:10:43.547 --> 00:10:45.547 reflect the sky and surroundings. 00:10:46.487 --> 00:10:49.357 The smoother the surface, the more it is mirror-like. 00:10:50.330 --> 00:10:53.077 The rougher the surface the more diffuse, 00:10:53.077 --> 00:10:55.077 or scattered the reflections are. 00:10:56.588 --> 00:10:58.938 The normal map property is an optional property 00:10:58.938 --> 00:11:01.787 used to define the apparent bumpiness of the surface. 00:11:02.893 --> 00:11:04.893 When a normal map is applied 00:11:05.649 --> 00:11:07.649 the strength of the normal map can be controlled 00:11:07.649 --> 00:11:09.927 by adjusting the normal map value. 00:11:11.033 --> 00:11:13.033 As well as positive numbers, this value 00:11:13.033 --> 00:11:14.758 can be a negative number 00:11:15.420 --> 00:11:16.455 or 0. 00:11:18.040 --> 00:11:20.040 The height map property is an optional 00:11:20.040 --> 00:11:22.040 property used to define the apparent 00:11:22.040 --> 00:11:24.040 height of the surface. 00:11:24.040 --> 00:11:26.040 When a height map is applied 00:11:26.667 --> 00:11:28.667 the strength of the height map can be controlled 00:11:28.667 --> 00:11:30.667 by adjusting the height map value. 00:11:32.842 --> 00:11:34.842 The occlusion property uses a 00:11:34.842 --> 00:11:36.842 texture map to define the amount of 00:11:36.842 --> 00:11:39.509 ambient occlusion that is applied to the material. 00:11:40.799 --> 00:11:42.799 This is used to help darken 00:11:42.799 --> 00:11:45.095 hidden or recessed areas on the texture. 00:11:46.200 --> 00:11:48.200 The ambient occlusion map also 00:11:48.200 --> 00:11:50.200 prevents specular and reflections in 00:11:50.200 --> 00:11:52.676 these occluded areas, given the material 00:11:52.676 --> 00:11:54.676 a more realistic look. 00:11:56.058 --> 00:11:58.690 The emission property controls whether or not 00:11:58.690 --> 00:12:00.690 the material's surface will emit light. 00:12:01.630 --> 00:12:03.630 The material's emission value can contribute 00:12:03.630 --> 00:12:05.630 to the scene's global illumination. 00:12:06.791 --> 00:12:08.791 The strength of the emission can be controlled 00:12:08.791 --> 00:12:10.791 by the emission value. 00:12:11.215 --> 00:12:14.235 The shape of the emission can be controlled with an emission map. 00:12:15.359 --> 00:12:17.359 The map can be a simple black and white map. 00:12:23.699 --> 00:12:26.447 bBut this texture can also be a colour map. 00:12:32.529 --> 00:12:34.529 When there is a value for emission 00:12:34.529 --> 00:12:36.529 the contribution of the emissive light 00:12:36.529 --> 00:12:39.262 can be assigned to either the baked light maps 00:12:40.607 --> 00:12:42.607 or to the real time light maps. 00:12:45.740 --> 00:12:48.930 The detail mask property is an optional mask element 00:12:48.930 --> 00:12:50.930 to control the secondary maps. 00:12:52.054 --> 00:12:54.708 Tiling and offset control the position of the map. 00:12:55.961 --> 00:12:57.961 The secondary maps are used to define 00:12:57.961 --> 00:12:59.961 additional surface detail. 00:12:59.961 --> 00:13:03.608 This additional detail, sometimes referred to as micro detail, 00:13:03.608 --> 00:13:05.608 is added on top of the surface defined 00:13:05.608 --> 00:13:07.111 by the main maps. 00:13:07.848 --> 00:13:09.848 This helps to add extra detail and 00:13:09.848 --> 00:13:12.657 variation to a material, which is overlaid 00:13:12.657 --> 00:13:15.460 on top of the main maps defining that material. 00:13:16.187 --> 00:13:19.217 Because detail maps can be tiled across meshes 00:13:19.899 --> 00:13:22.693 they can add incredibly high levels of surface detail.