写在前面
因为在unity shader方面我并不算是新手了,之前也曾拜读过冯乐乐女神的《unityshader入门精要》,所以觉得第一章其实是很基础的知识,与我自己而言,我觉得第一章的一共有四个重点知识需要我们搞清楚。
知识点一
All the objects that are part of a game contain a number of components that affect their look and behavior. While scripts determine how objects should behave, renderers decide how they
should appear on the screen. Unity comes with several renderers, depending on the type of
object that we are trying to visualise; every 3D model typically has MeshRenderer. An object
should have only one renderer, but the renderer itself can contain several materials. Each
material is a wrapper for a single shader, the fnal ring in the food chain of 3D graphics. The
relationships between these components can be seen in the following diagram:
大意就是游戏中的每个物体都包含一些组件,这些组件决定它的行为和外表,脚本决定行为,而渲染决定它怎么呈现在屏幕上。每一个3D模型都有 MeshRenderer,一个物体只能有一个渲染器,但是一个渲染器可以包含多个材质。他们的关系如下表:
知道他们之间的关系对了解shader工作原理很重要。我认为我们还可以更进一步了解下shader和渲染管线的相关知识Shader和渲染管线(个人认为这篇博文讲的比较浅显易懂)
知识点二
如何创建一个shader并且运用到gameobject上,废话不多说,直接上步骤,我的开发环境是unity2017.3.1
step 1:在场景中创建一个cube
step 2:创建一个shader,命名为“StandardDiffu