- 最后登录
- 2018-12-19
- 注册时间
- 2012-8-20
- 阅读权限
- 90
- 积分
- 54706
- 纳金币
- 32328
- 精华
- 41
|
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。或者告诉硬件需要考虑顶点颜色
[Syntax 语法]BindChannels { Bind "source", target }
Specifies that vertex data source maps to hardware target.
例如:指定顶点数据源映射到目标硬件。 Source can be one of:
Source 可以是下面其中一个 Vertex: vertex position 顶点:顶点的位置
Normal: vertex normal 法线:顶点的法线
Tangent: vertex tangent 切线:顶点的切线
Texcoord: primary UV coordinate 主要的UV坐标
Texcoord1: secondary UV coordinate 次要的UV坐标
Color: per-vertex color 颜色:每个顶点颜色Target can be one of: Target可以是下面其中的一个: Vertex: vertex position 顶点:顶点的位置
Normal: vertex normal 法线:顶点的法线
Tangent: vertex tangent 切线:顶点的切线
Texcoord0, Texcoord1, ...: texture coordinates for corresponding texture stage 各个纹理处理阶段的纹理坐标
Texcoord: texture coordinates for all texture stages 所有纹理处理阶段的纹理坐标
Color: vertex color 颜色:顶点颜色 [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。 Shaders that take vertex colors into account.
需要考虑顶点颜色的着色器。
Shaders that use two UV sets.
使用两个UV组的着色器。 [Examples 示例]// 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
// and uses vertex colors
//将第1个UV映射到所有纹理处理阶段并使用顶点颜色
BindChannels {
Bind "Vertex", vertex
Bind "texcoord", texcoord
Bind "Color", color
} 【来源:互联网】
更多精彩教程,尽在web3D纳金网http://www.narkii.com/college/ |
|