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