Writing vertex and fragment shaders 写顶点与片断着色器
本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)
仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。
文章中涉及到的操作都是基于Unity2018.2版本
参考链接:https://docs.unity3d.com/Manual/SL-ShaderPrograms.html
ShaderLab shaders encompass more than just “hardware shaders”. They do many things. They describe properties that are displayed in the Material Inspector, contain multiple shader implementations for different graphics hardware, configure fixed function hardware state and so on. The actual programmable shaders - like vertex and fragment programs - are just a part of the whole ShaderLab’s “shader” concept. Take a look at shader tutorial for a basic introduction. Here we’ll call the low-level hardware shaders shader programs.
ShaderLab 着色器不仅仅包含“硬件着色器”。他们做很多事情。它们描述了在材质检查器中显示的属性,包含不同图形硬件的多个着色器实现,配置固定渲染管线硬件状态等等。实际的可编程着色器——比如顶点和片段程序——只是整个着色实验室的“着色器”概念的一部分。看一看shader 教程的基本介绍。这里我们将调用低级硬件着色器着色程序。
If you want to write shaders that interact with lighting, take a look at Surface Shaders documentation. For some examples, take a look at Vertex and Fragment Shader Examples. The rest of this page assumes shaders do not interact with Unity lights (for example