如果在不存在的“ FallBack”着色器中添加,则会出现此错误““ Curved / CurvedAlpha”中的着色器警告:此GPU不支持着色器(子着色器/后备均不适用)。因此,我可以得出一个结论:仅添加一个变量(进一步查看)后,此GPU不支持此着色器吗?
我的视频卡geforce gtx 1060 3gb。
Shader "Curved/CurvedAlpha" {
Properties {
_Color("Color", COLOR) = (1, 1, 1, 1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_QOffset ("Offset", Vector) = (0,0,0,0)
_Dist ("Distance", Float) = 100.0
_Alpha ("Alpha", Range(0.0,1.0)) = 1.0
}
SubShader {
Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
LOD 100
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
Pass
{
Lighting Off
CGPROGRAM
// Upgrade NOTE: excluded shader from DX11; has structs without semantics (struct v2f members factor)
#pragma exclude_renderers d3d11
#pragma vertex vert
#pragma fragment frag
#include "UnityCG.cginc"
half4 _Color;
sampler2D _MainTex;
float4 _QOffset;
float _Dist;
float _Alpha;
uniform float4 _MainTex_ST;
struct v2f {
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
在addind“ factor”并在vert函数着色器中计算后,回退到“旧版着色器/透明/ VertexLit”
float4 factor: COLOR;
};
v2f vert (appdata_base v)
{
v2f o;
float4 vPos = mul (UNITY_MATRIX_MV, v.vertex);
float zOff = vPos.z/_Dist;
vPos += _QOffset*zOff*zOff;
o.pos = mul (UNITY_MATRIX_P, vPos);
o.uv = TRANSFORM_TEX(v.texcoord, _MainTex);
float factor = max(0, dot(v.normal, float3(0,1,0)));
o.factor = float4(factor,0,0,0);
return o;
}
fixed4 frag (v2f i) : COLOR
{
//fixed4 color = tex2D(_MainTex, i.uv) * _Color;
return tex2D(_MainTex, i.uv) * float4(_Color.r, _Color.g, _Color.b, _Alpha) * i.factor.x;
}
ENDCG
}
}
FallBack "Legacy Shaders/Transparent/VertexLit"
}
问题是在曲面着色器中添加了照明处理。