官术网_书友最值得收藏!

Introduction

Surface Shaders have been introduced in Chapter 1, Creating Your First Shader, as the main type of shader used in Unity. This chapter will show in detail what these actually are and how they work. Generally speaking, there are two essential steps in every Surface Shader. First, you have to specify certain physical properties of the material that you want to describe, such as its diffuse color, smoothness, and transparency. These properties are initialized in a function called surface function and stored in a structure called surface output. Secondly, the surface output is passed to a lighting model. This is a special function that will also take information about the nearby lights in the scene. Both these parameters are then used to calculate the final color for each pixel of your model. The lighting function is where the real calculations of a shader take place as it's the piece of code that determines how light should behave when it touches a material.

The following diagram loosely summarizes how a Surface Shader works. Custom lighting models will be explored in Chapter 3, Understanding Lighting Models, while Chapter 5, Vertex Functions, will focus on vertex modifiers:

主站蜘蛛池模板: 玉田县| 泽普县| 定兴县| 穆棱市| 木兰县| 乌兰县| 南康市| 西贡区| 东至县| 桐梓县| 玉田县| 永定县| 甘谷县| 四子王旗| 铜梁县| 车险| 盖州市| 东乡县| 霞浦县| 青田县| 京山县| 个旧市| 沧州市| 乌拉特后旗| 孟津县| 弋阳县| 济阳县| 柳林县| 福海县| 台东县| 南宁市| 六安市| 泊头市| 永州市| 万盛区| 桐庐县| 玉田县| 娄底市| 延寿县| 本溪市| 华宁县|