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

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:

主站蜘蛛池模板: 连城县| 江陵县| 丰城市| 长垣县| 团风县| 南安市| 长子县| 城口县| 郸城县| 南康市| 榆林市| 五莲县| 五原县| 连平县| 芷江| 老河口市| 伊宁市| 孝感市| 唐海县| 舟山市| 老河口市| 轮台县| 永福县| 兴安盟| 天柱县| 滁州市| 巴青县| 江孜县| 格尔木市| 乌恰县| 壤塘县| 修文县| 吴川市| 开江县| 永泰县| 杭州市| 巴林右旗| 桐乡市| 肥西县| 门头沟区| 广灵县|