BindChannels command allows you to specify how vertex data maps to the graphics hardware.
BindChannels 命令 允许你指定顶点数据如何映射到显卡中。
BindChannels has no effect when programmable vertex shaders are used, as in that case bindings are controlled by vertex shader inputs.
可编程顶点着色器使用时,BindChannels将没有效果。在这种情况下,绑定受顶点着色器输入控制。
By default, Unity figures out the bindings for you, but in some cases you want custom ones to be used.
默认情况下,Unity3D 会为你计算并绑定,但在某些情况下,你要使用自定义绑定。
For example you could map the primary UV set to be used in the first texture stage and the secondary UV set to be used in the second texture stage; or tell the hardware that vertex colors should be taken into account.
例如:你可以在第1个纹理处理阶段映射主UV 然后在第2个纹理处理阶段使用次要UV。或者告诉硬件需要考虑顶点颜色。
Source can be one of:
源可以是下面其中的一个
Target can be one of:
目标可以是下面其中的一个:
Details 详情
Unity places some restrictions on which sources can be mapped to which targets. Source and target must match for Vertex, Normal, Tangent and Color. Texture coordinates from the mesh (Texcoord and Texcoord1) can be mapped into texture coordinate targets (Texcoord for all texture stages, or TexcoordN for a specific stage).
Unity在源和目标的映射上加了一些限制。源和目标必须匹配顶点,法线,切线和颜色。从网格中获取的纹理坐标(Texcoord和Texcoord1)可以映射到纹理坐标的目标(所有纹理处理阶段可以使用Texcoord ,或者在一个特定阶段使用TexcoordN )。
There are two typical use cases for BindChannels:这里有2个典型的情况可以使用BindChannels。
// Maps the first UV set to the first texture stage 在纹理处理第1阶段映射第1个UV // and the second UV set to the second texture stage 在纹理处理第2阶段映射第2个UV BindChannels { Bind "Vertex", vertex Bind "texcoord", texcoord0 Bind "texcoord1", texcoord1 }
// Maps the first UV set to all texture stages 将第1个UV映射到所有纹理处理阶段并使用顶点颜色 // and uses vertex colors BindChannels { Bind "Vertex", vertex Bind "texcoord", texcoord Bind "Color", color }