- Unity 2018 Shaders and Effects Cookbook
- John P. Doran Alan Zucconi
- 199字
- 2021-06-18 19:04:16
Introduction
Surface Shaders were introduced in Chapter 2, Creating Your First Shader, as the main type of shader that's used in Unity. This chapter will show you 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 the surface function and are stored in a structure called the SurfaceOutput. Secondly, the SurfaceOutput is passed to a lighting model. This is a special function that will also take information about the nearby lights in the scene. Both of 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 4, Understanding Lighting Models, while Chapter 6, Vertex Functions, will focus on vertex modifiers:

- 極簡算法史:從數(shù)學到機器的故事
- Learning NServiceBus(Second Edition)
- R語言數(shù)據(jù)分析從入門到精通
- Learning Real-time Processing with Spark Streaming
- 青少年美育趣味課堂:XMind思維導圖制作
- SAS數(shù)據(jù)統(tǒng)計分析與編程實踐
- Unreal Engine 4 Shaders and Effects Cookbook
- C語言程序設計
- Learning Vaadin 7(Second Edition)
- Android應用開發(fā)實戰(zhàn)(第2版)
- 玩轉(zhuǎn).NET Micro Framework移植:基于STM32F10x處理器
- LabVIEW數(shù)據(jù)采集
- C# 7.1 and .NET Core 2.0:Modern Cross-Platform Development(Third Edition)
- JavaWeb從入門到精通(視頻實戰(zhàn)版)
- C語言程序設計教程