Pass通道块控制被渲染的对象的几何体。
Syntax 语法
Pass { [Name and Tags] [RenderSetup] [TextureSetup] }
基本通道命令包含一个可选的渲染设置命令的列表,和可选的被使用的纹理的列表。
Name and tags 名称和标签
一个通道能定义它的Name 和任意数量的Tags (用于向渲染引擎传递通道的意图的名称/值的字符串)。
Render Setup 渲染设置
通道设定显示硬件的各种状态,例如能打开alpha混合,能使用雾,等等。这些命令如下:
-
Material {
Material Block
}
-
Defines a material to use in a vertex lighting pipeline. See
material page for details.
定义一个使用顶点光照管线的材质,参考material页面。 -
-
Turn vertex lighting on or off. See material page for details.
开启或关闭顶点光照,参考material页面。
-
Cull Back | Front | Off
- Set polygon culling mode. 设置多边形剔除模式
-
ZTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always)
- Set depth testing mode. 设置深度测试模式
-
- Set depth writing mode. 设置深度写模式
-
Fog { Fog Block }
- Set fog parameters. 设置雾参数
-
AlphaTest (Less | Greater | LEqual | GEqual | Equal | NotEqual | Always)
CutoffValue
- Turns on alpha testing. 开启alpha测试
-
- Sets alpha blending mode. 设置alpha混合模式
-
Color Color value
-
Sets color to use if vertex lighting is turned off.
设置当顶点光照关闭时所使用的颜色
-
ColorMask RGB | A | 0 | any combination of R, G, B, A
-
Set color writing mask. Writing ColorMask 0 turns off rendering to all color channels.
设置颜色写遮罩。设置为0将关闭所有颜色通道的渲染 - Set depth offset. 设置深度偏移
Offset OffsetFactor , OffsetUnits
-
SeparateSpecular On | Off
-
Turns separate specular color for vertex lighting on or off. See
material page for details.
开启或关闭顶点光照相关的平行高光颜色, 参考material页面。
-
ColorMaterial AmbientAndDiffuse | Emission
-
Uses per-vertex color when computing vertex lighting. See material page for details.
当计算顶点光照时使用每顶点颜色, 参考material页面。
Texture Setup 纹理设置
在完成渲染设定后,你能指定一定数量的纹理和当使用 SetTexture 命令时所采用的混合模式:
SetTexture texture property { [Combine options] }
The texture setup configures fixed function multitexturing pipeline, and is ignored if customfragment shaders are used.
纹理设置 配置了 固定函数多纹理管线,当自定义fragment shaders 被使用时,将忽略这个设置。
Details 细节
Per-pixel Lighting 每像素光照
每像素光照管线通过多次通道渲染对象来完成。Unity渲染对象一次来获取阴影色和任何顶点光照。然后再在额外的并行通道中渲染出每像素光照的效果。参考Render Pipeline。
Per-vertex Lighting 每顶点光照
每顶点光照是标准的Direct3D/OpenGL光照模式,通过计算每个顶点的光照来完成。Lighting on命令开启光照。光照被材质块,颜色材质和平行高光命令所影响,参考material页面。