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

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:

主站蜘蛛池模板: 南乐县| 关岭| 昌都县| 石狮市| 灌南县| 明溪县| 登封市| 沙坪坝区| 绩溪县| 永定县| 翁源县| 兴隆县| 内江市| 海原县| 河西区| 凤凰县| 定边县| 南华县| 长阳| 谢通门县| 南乐县| 乌兰察布市| 巴东县| 阿图什市| 重庆市| 佛学| 喀喇| 贵南县| 曲松县| 邹城市| 祁门县| 门源| 涞源县| 年辖:市辖区| 丰县| 岗巴县| 甘肃省| 石泉县| 曲周县| 娄烦县| 礼泉县|