目录索引
译文
标签可以告诉我们着色器是在什么时候、是怎么被处理的。像 GameObject 标签,它们可以被用于识别着色器的渲染方式或一组着色器的行为。
标签的语法如下所示:
Tags
{
"TagName1"="TagValue1"
"TagName2"="TagValue2"
}
它们可以根据我们最终想要的结果被写在 Pass 或 SubShader 语义块里。如果我们把标签加在子着色器语义块中,那么标签就会影响着色器里的所有 pass 。但如果我们把标签写在 Pass 语义块里,那么标签将只会影响这个pass。
“队列(Queue)”是我们最常用的一个标签,它允许我们定义物体表面的外观。默认情况下,表面被定义为“不透明(opaque)”,这使得物体不具备透明度。
现在看看我们的 USB_simple_color 着色器,我们可以在子着色器语义块中找到这么一行定义了不透明表面的代码:
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass { … }
}
原文对照
Tags are labels that show how and when our shaders are processed.
Like a GameObject Tag, these can be used to recognize how a shader will be rendered or how a group of shaders will behave graphically.
The syntax for all Tags is as follows:
Tags
{
"TagName1"="TagValue1"
"TagName2"="TagValue2"
}
These can be written in two different fields, either within the SubShader or inside the Pass. All this depends on the result we want to obtain. If we write a tag inside the SubShader it will affect all the passes that are included in the shader, but if we write it inside the Pass, it will only affect the selected pass.
The “Queue” is a Tag that we use more frequently, since it allows us to define how the surface of the object will look. By default, all surfaces are defined as “opaque”, that is, they do not have transparency.
If we look at our USB_simple_color shader, we will find the following line of code inside the SubShader, which defines an opaque surface for our shader.
SubShader
{
Tags { "RenderType"="Opaque" }
LOD 100
Pass { … }
}
暂无评论内容