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

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:

主站蜘蛛池模板: 桦甸市| 霍山县| 定陶县| 望谟县| 封开县| 保康县| 潞城市| 屏山县| 长垣县| 密云县| 精河县| 贡嘎县| 和林格尔县| 北票市| 电白县| 临桂县| 乌恰县| 嫩江县| 太保市| 枣强县| 周宁县| 临清市| 洛隆县| 称多县| 日喀则市| 曲松县| 云梦县| 葫芦岛市| 遂溪县| 会昌县| 上杭县| 方山县| 怀安县| 锡林郭勒盟| 大港区| 陆河县| 郑州市| 乐亭县| 黄陵县| 苍山县| 油尖旺区|