Shaderlab Syntax: bindchannels bind channel.
Bindchannels command allows you to specify how vertex data maps to the graphics hardware.
The bindchannels command allows you to specify how vertex data is mapped to the video card.
Bindchannels has no effect when programmable vertex shaders are used, as in that case bindings are controlled by vertex shader inputs.
Bindchannels is ineffective when you use the programmable Vertex coloring tool. In this case, the binding is controlled by the vertex shader input.
By default, unity figures out the bindings for you, but in some cases you want custom ones to be used.
By default, unity3d is calculated and bound for you, but in some cases, you need to use custom binding.
For example you cocould 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 shocould be taken into account.
For example, you can map the primary UV in 1st texture processing phases and then use secondary UV in 2nd texture processing phases. Or tell the hardware to consider the vertex color.
Syntax
Bindchannels {bind"Source", Target
}
-
Specifies that vertex data source maps to hardware target.
-
Specifies that the vertex data source is mapped to the target hardware.
SourceCan be one:
The source can be one of the following
- Vertex: vertex position vertex: vertex position
- Normal: vertex normal: the normal of the vertex.
- Tangent: vertex tangent
- Texcoord: Primary UV coordinate main UV coordinates
- Texcoord1: Secondary UV coordinate secondary UV coordinates
- Color: Per-vertex color: color of each vertex
TargetCan be one:
The target can be one of the following:
- Vertex: vertex position vertex: vertex position
- Normal: vertex normal: the normal of the vertex.
- Tangent: vertex tangent
- Texcoord0, texcoord1,...: texture coordinates of each texture processing stage in texture coordinates for corresponding texture stage
- Texcoord: texture coordinates for all texture stages texture coordinates of all texture Processing Stages
- Color: vertex color
Details 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
All texture stages, or texcoordn for a specific stage ).
Unity imposes some limitations on source/Target ing. The source and target must match the vertex, normal, tangent, and color. The texture coordinates (texcoord and texcoord1) obtained from the grid can be mapped to the target of the texture coordinate (texcoord can be used in all texture processing stages, or texcoordn can be used in a specific stage ).
There are two typical use cases for bindchannels: There are two typical cases where bindchannels can be used.
- Shaders that take vertex colors into account.
- The color of the vertex must be considered.
- Shaders that use two UV sets. Use the two UV sets of the shaders.
Examples example
// Maps the first UV set to the first texture stage maps 1st Uvs in the texture processing stage 1st // and the second UV set to the second texture stage maps 2nd in the texture processing stage 2nd uvbindchannels {bind "vertex ", vertex bind "texcoord", texcoord0 bind "texcoord1", texcoord1}
// Maps the first UV set to all texture stages map 1st Uvs to all texture processing phases and use vertex colors // and uses vertex colorsbindchannels {bind "vertex ", vertex bind "texcoord", texcoord bind "color", color}Original at www.j2megame.com. For more information, see.