字幕列表 影片播放 列印英文字幕 The Standard Shader is a powerful and versatile shader. This single physically-based shader can be used to make such a wide variety of materials it's easily possible that this one shader can make every material in a given project. The standard is used to create Unity's default material. So all mesh rendered using the default material will be using the standard shader. All new materials that are created will use the standard shader as well. To change the shader used by a material select the Shader menu on the material. Select Standard to use the standard shader. It is worth noting the Unity has shaders available for both popular approaches to physically-based rendering. Metallic, as default, and specular. To choose the standard shader using the specular approach select Standard (Specular Setup). Otherwise use Standard for the metallic approach. It is important to understand that the metallic approach to physically-based shading is not only for materials which are supposed to look metallic. This mode is known as metallic because this approach is based on defining how metallic or non-metallic that material's surface is. This is opposed to the specular approach which defines how specular, or non-specular that surface is. Both approaches are valid ways to describe a physically-based material. This physically-based material is still a standard Unity material and this material is associated with a renderer in the same way as usual. There are three sections to the standard shader. Rendering Mode. Main Maps and Secondary Maps. The standard shader has four rendering modes. Opaque, Cutout, Fade and Transparent. Most materials are opaque, or solid materials. Opaque is the default render mode. For transparent materials, such as glass, choose Transparent. In transparent rendering mode the alpha channel on the diffuse colour property is used to control the level of transparency. With rendering mode cutout the alpha channel of the diffuse image is used to mask out parts of the texture. If the alpha channel has a gradient value to the mask the alpha cutoff slider can be used to adjust the shape of the cutout. based on the strength of the mask in the alpha channel. Rendering mode fade is similar to rendering mode transparent. Fade is intended for fading out game objects on screen. With rendering mode transparent a transparent material will preserve it's reflectivity regardless of it's alpha value. Fade however will fade all relevant aspects of the material so the faded material is completely invisible. The main map section defines the look of the material. Before going in to the details of each property there are a few subjects that are worth covering first. Optimisation. The standard shader is highly optimised. When the standard shader is built two important things happen. All properties that are not being used are discarded. The build target is checked and the shader is optimised for that device. Because of this there is no need to populate every property with a map or values. And there is no need to worry about wasted resources due to unused properties. Physically-based shading. Physically-based shading tries to define certain physical aspects of a material's surface. Including it's diffuse colour, specular refection and other properties so the material behaves correctly and believably in all lighting environments. 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.
B1 中級 Unity 5 Graphics - 標準著色器 - Unity官方教程 (Unity 5 Graphics - The Standard Shader - Unity Official Tutorials) 90 4 陳志源 發佈於 2021 年 01 月 14 日 更多分享 分享 收藏 回報 影片單字