我设法修复了以前的错误,但现在我发现了另外两个错误。
'游戏/失真(双面)'中的着色器错误:错误的数量 第179行(在d3d11上)的数值类型构造函数的参数
编译Vertex程序平台定义: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA
代码:
half4 frag (v2f i) : COLOR
{
// Screen space texture coordinates
float2 screenPos = i.screenPos.xy / i.screenPos.w;
screenPos = screenPos * 0.5 + 0.5;
screenPos.y = 1.0 - screenPos.y;
// Time-based movement
screenPos = screenPos * float2(4.0, 12.0) + float2(_Time.w * 3.0);
half4 col = _Color * (0.25 * tex2D(_MainTex, screenPos).b + 0.5);
col.a *= i.screenPos.z;
return col;
}
排在第:
screenPos = screenPos * float2(4.0, 12.0) + float2(_Time.w * 3.0);
还有一个:
'游戏/失真(单面)'中的着色器错误:错误的数量 第179行(在d3d11上)的数值类型构造函数的参数
编译Vertex程序平台定义: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP UNITY_COLORSPACE_GAMMA
代码:
half4 frag (v2f i) : COLOR
{
// Screen space texture coordinates
float2 screenPos = i.screenPos.xy / i.screenPos.w;
screenPos = screenPos * 0.5 + 0.5;
screenPos.y = 1.0 - screenPos.y;
// Time-based movement
screenPos = screenPos * float2(4.0, 12.0) + float2(_Time.w * 3.0);
half4 col = _Color * (0.25 * tex2D(_MainTex, screenPos).b + 0.5);
col.a *= i.screenPos.z;
return col;
}
排在第:
screenPos = screenPos * float2(4.0, 12.0) + float2(_Time.w * 3.0);
实际上是相同的错误。 谢谢你们的帮助!
答案 0 :(得分:1)
如果你正在创建float2,它需要2个值,你现在只需要1个浮点数:
float2(_Time.w * 3.0);
不确定要放置哪些值,请尝试使用1
float2(_Time.w * 3.0, 1.0);