我有一个关于着色器的错误。
// Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
Shader "Custom/FurShaderV1" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Base Texture (RGB)", 2D) = "white" {}
_FurBlend ("Base Color Cutoff", Range(0,1)) = 0
_FurTex ("Fur Texture (RGBA)", 2D) = "white" {}
_FurColor ("Color", Color) = (1,1,1,1)
_FurMat ("Fur Color (RGBA)", 2D) = "white" {}
_FurShadow("Darken Lower Layers", Range(0,4)) = 1
_CutOff ("Cut Off", Range(0,0.5)) = -0.01
_FurLength("Fur Length", Range(0,1)) = 0.0
_Layer("Fur Layer", Range(0,1)) = 0.0
_Gravity("Gravity Strength", Range(0,-2)) = 0.0
_Wind("Wind", Vector) = (0,0,0,0)
[MaterialEnum(Off,0,Front,1,Back,2)] _Cull ("Cull", Int) = 2
}
SubShader {
Tags { "RenderType"="Opaque" }
Cull [_Cull]
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Lambert vertex:vert addshadow
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
sampler2D _FurTex;
sampler2D _FurMat;
struct Input {
float2 uv_MainTex;
//float4 T0; // fur alpha
float Layer;
};
float _FurLength;
float UVScale = 1.0f;
float _Gravity;
float3 _Wind;
float _Layer;
void vert(inout appdata_full i, out Input OUT)
{
UNITY_INITIALIZE_OUTPUT(Input, OUT);
//This line is responsible for creating the layers
float3 P = i.vertex.xyz + (i.normal * _FurLength);
//Modify our normal so it faces the correct direction for lighting if we
//want any lighting
//float3 normal = normalize(i.normal);
// Couple of lines to give a swaying effect
// Additional Gravity/Force Code
float3 vGravity = float3(0,_Gravity,0);
vGravity = mul(vGravity, unity_ObjectToWorld);
float k = pow(_Layer, 2); // We use the pow function, so that only the tips of the hairs bend
// As layer goes from 0 to 1, so by using pow(..) function it still
// goes form 0 to 1, but it increases faster exponentially
P = P + (_Wind*k + vGravity*k);
//OUT.T0 = i.texCoordDiffuse * UVScale; // Pass long texture data
// UVScale?? Well we scale the fur texture alpha coords so this effects the fur thickness
// thinness, sort of stretches or shrinks the fur over the object!
i.vertex = float4(P, 1.0f);//mul(float4(P, 1.0f), UNITY_MATRIX_MVP); // Output Vertice Position Data
// i.normal = normal; // Output Normal
OUT.Layer = _Layer;
}
half _Glossiness;
half _Metallic;
fixed4 _Color;
float _CutOff;
fixed4 _FurColor;
float _FurBlend;
float _FurShadow;
void surf (Input IN, inout SurfaceOutput o) {
// Albedo comes from a texture tinted by color
fixed4 f = tex2D (_FurTex, IN.uv_MainTex);
float Lum = ((f.r + f.g + f.b) / 3) * f.a;
clip(Lum - (_CutOff));
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
fixed4 FurColor = tex2D(_FurMat, IN.uv_MainTex) * _FurColor;
if(IN.Layer < _FurBlend)
o.Albedo = c.rgb;
else
{
o.Albedo = (pow(IN.Layer,_FurShadow)) * FurColor.rgb;
}
// Metallic and smoothness come from slider variables
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
当我将其转换为.exe时,它实际上在PC上工作但是当我尝试将其转换为android为.apk时,此错误显示出来。我无法找到有关我的问题的任何相关问题,而且我已经被锁定了3天。
我的转换是成功的,但问题在于我打开它。它只是我手机上的黑屏。而且我推测这个错误是它的原因?