以前,UV、逐顶点颜色和逐顶点用户数据均由索引引用。这将产生管线难题,因为很难强制索引。
现在,默认情况下,会将数据块添加到每个形状节点,这些节点能够提供每个数据片段(UV、CVP 以及逐顶点自定义数据)的名称。可以从着色器 API 中查询该表以获取并解析传递到某个着色器的 string 值。
渲染时可以将着色网络指定给多个对象,并指定逐顶点颜色和 UV,而无需在 Maya 场景中显式创建连接。渲染时,着色器负责将名称引用转化为逐实例索引或逐形状节点索引。
data "pPlaneShape1:PerVertexNomenclature" "PerVertexNomenclature" ( "magicnumber" 5149248936, "tex" // texture space or Maya UVs [ { "name" "uvset1", "index" 0 } { "name" "myUVset", "index" 1 } { "name" "bakeUV", "index" 2 } ], "cpv" // color per vertex (RGB only) [ { "name" "ColorSet1", "index" 3 } { "name" "CPV_DirtMask", "index" 4 } { "name" "CPV_WetMask", "index" 5 } ], "cudpv" //custom data per vertex [ { "name" "LightIndexField", "index" 6 } ] ) object "pPlaneShape1" visible on shadow 3 transparency 3 reflection 3 refraction 3 finalgather 3 face both tagged trilist vertex 4 p n t 2 b 2 u 3 triangle 2 [ vertex data goes here ] [ 0 0 1 3 0 3 1 2 ] end trilist data "pPlaneShape1:PerVertexNomenclature" end object shader "DirtMapCPVLookup1" "myCustomVertexColor" ( "cpvname" "CPV_Dirtmask", .... )