ity3D Shader官方教程翻譯(十四)—-Shader文法:Pass的BindChannels 綁定通道

來源:互聯網
上載者:User
ShaderLab syntax: BindChannels 綁定通道。

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:

源可以是下面其中的一個

  • 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:

目標可以是下面其中的一個:

  • 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個UVBindChannels {   Bind "Vertex", vertex   Bind "texcoord", texcoord0   Bind "texcoord1", texcoord1} 
// Maps the first UV set to all texture stages 將第1個UV映射到所有紋理處理階段並使用頂點顏色// and uses vertex colorsBindChannels {   Bind "Vertex", vertex   Bind "texcoord", texcoord   Bind "Color", color} 
 由www.J2meGame.com原創,轉載請說明。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.