Хочу объединить два шейдера в один. Оба шейдера по отдельности работают, но после того как объединяю их,
работает только тот Subshader, который первый по списку. Что я не так делаю? Хочу Bunped Diffuse + Alpha Cutoff
http://docs.unity3d.com/Documentation/C ... aTest.html
Синтаксис:
Используется glsl
Shader "V4"
{
Properties
{
_Color ("Diffuse tint", COLOR) = (1,1,1)
_MainTex ("Diffuse texture", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
_Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
Material {
Diffuse [_Color]
Ambient [_Color]
}
Lighting On
Cull Off
Pass {
AlphaTest Greater [_Cutoff]
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
Pass {
ZWrite off
ZTest Less
AlphaTest LEqual [_Cutoff]
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 250
CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff
sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
} ;
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
}
}
{
Properties
{
_Color ("Diffuse tint", COLOR) = (1,1,1)
_MainTex ("Diffuse texture", 2D) = "white" {}
_BumpMap ("Normalmap", 2D) = "bump" {}
_Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
Material {
Diffuse [_Color]
Ambient [_Color]
}
Lighting On
Cull Off
Pass {
AlphaTest Greater [_Cutoff]
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
Pass {
ZWrite off
ZTest Less
AlphaTest LEqual [_Cutoff]
Blend SrcAlpha OneMinusSrcAlpha
SetTexture [_MainTex] {
combine texture * primary, texture
}
}
}
SubShader {
Tags {"Queue"="AlphaTest" "IgnoreProjector"="True" "RenderType"="TransparentCutout"}
LOD 250
CGPROGRAM
#pragma surface surf Lambert alphatest:_Cutoff
sampler2D _MainTex;
sampler2D _BumpMap;
fixed4 _Color;
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
} ;
void surf (Input IN, inout SurfaceOutput o) {
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = c.a;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
}
}