Quantcast
Viewing latest article 16
Browse Latest Browse All 169

Shader is pink without error,console not displaying errors for shader yet shader is clearly erroring

So usually I get some kind of error saying an albeit vague message about what line the error was on and what it was roughly about, but sometimes I get no errors at all, yet my shader material is still a bright pink, implying that it is erroring, but not giving me any info, and when this error happens, I will try to revert what I did and retrace my steps until I find a spot where it wont error, then work back from there to find the exact point, but the thing is, even if I comment out everything that I thought I changed, it would continue to error, implying that I must've messed up a core setting or something, please help! full code (commented stuff is my most recent changes, tried to revert back to a non-erroring version, didn't work) Shader "Materials/Splatter" { Properties { _Albedo("Albedo", 2D) = "white" {} _Noise("NoiseMap", 2D) = "white" {} _Color("Color",Color) = (1,1,1,1) } SubShader { Pass { Tags { "LightMode" = "Vertex" } CGPROGRAM #pragma exclude_renderers d3d11 #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" struct appdata { float4 vert : POSITION; float2 uv : TEXCOORD0; float3 norm : NORMAL; //float3 vpos : TEXCOORD2; }; struct v2f { float4 vert : SV_POSITION; float2 uv : TEXCOORD0; float3 norm : NORMAL; //float3 vpos : TEXCOORD2; }; fixed4 _Color; sampler2D _Noise; sampler2D _Albedo; float random(v2f vert2f) { float rand = frac(sin(dot(vert2f.uv, float2(12.9898, 78.233))) * 43758.5453123); float4 randMap = tex2D(_Noise,float2(vert2f.vert.x + rand*5, vert2f.vert.y + rand*5) / 50); return randMap.r; } v2f vert(appdata IN) { v2f OUT; OUT.vert = UnityObjectToClipPos(IN.vert); OUT.uv = IN.uv; OUT.norm = IN.norm; //OUT.vpos = IN.vpos; return OUT; } fixed4 frag(v2f IN) : SV_Target { fixed4 pixColor = tex2D(_Albedo, IN.uv); //*float4 light = float4(1, 1, 1, 1); //for (int i = 0; i < 8; i++) //{ // float4 lightVal = unity_LightColor[i] * unity_LightAtten[i].w//( * 3 / distance(IN.vpos - unity_LightPosition)); // if (unity_LightAtten[i].w != 0) // { // light *= lightVal; // } //} return (pixColor * _Color);//* light; } ENDCG } } }

Viewing latest article 16
Browse Latest Browse All 169

Trending Articles