通道(Pass)是子着色器(SubShader)的组成部分,每个Pass代表对象被渲染一次。
例如:
Shader "Custom/pass/Pass" {
Properties {
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Pass {
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
fixed4 frag(v2f_img i) : COLOR
{
return fixed4(1,0,0,1);
}
ENDCG
}
Pass {
Blend One One
CGPROGRAM
#pragma vertex vert_img
#pragma fragment frag
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
fixed4 frag(v2f_img i) : COLOR
{
return fixed4(0,1,0,1);
}
ENDCG
}
}
FallBack "Diffuse"
}