123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
- Shader "Santa/Transparent" {
- Properties {
- _Color ("Tint", COLOR) = (1,1,1,1)
- _Light ("Light", Range (0.01,3)) = 1.5
- _Contrast ("Contrast", Range (-5.0,5.0)) = 0.5
- _Cutoff ("Alpha cutoff", Range (0,1)) = 0.5
- [NoScaleOffset]
- _MainTex ("Base (RGBA)", 2D) = "white" {}
- [NoScaleOffset]
- _Lightmap ("Lightmap x2 (RGB)", 2D) = "white" {}
-
- }
- SubShader { Tags { "Queue" = "Transparent" }
- Pass { Blend SrcAlpha OneMinusSrcAlpha
- Lighting Off
- //Fog { Mode Linear }
- CGPROGRAM
- #pragma target 2.0
- #pragma vertex vert
- #pragma fragment frag
- #pragma multi_compile_fog
- #include "UnityCG.cginc"
- #pragma exclude_renderers xbox360 ps3 flash
-
- uniform float4 _Color;
- uniform float _Light;
- uniform float _Contrast;
- uniform float _Cutoff;
- uniform sampler2D _MainTex;
- uniform sampler2D _Lightmap;
-
- struct appdata
- {
- float4 vertex : POSITION;
- fixed4 color : COLOR;
- half4 uv0 : TEXCOORD0;
- half4 uv1 : TEXCOORD1;
- };
- struct v2f
- {
- float4 pos : SV_POSITION;
- fixed4 color : COLOR;
- half4 uv0 : TEXCOORD0;
- half4 uv1 : TEXCOORD1;
- UNITY_FOG_COORDS(n)
- };
-
- v2f vert (appdata v)
- {
- v2f o;
- o.pos = UnityObjectToClipPos( v.vertex );
- o.color = v.color;
- o.uv0 = v.uv0;
- o.uv1 = v.uv1;
- UNITY_TRANSFER_FOG(o, o.pos);
- return o;
- }
-
- fixed4 frag (v2f i) : SV_Target
- {
- fixed4 Tex = tex2D(_MainTex, i.uv0);
- fixed4 LM = tex2D(_Lightmap, i.uv1);
- fixed3 FinalColor = Tex.rgb * LM.rgb * _Light * i.color.rgb * _Color;
- fixed4 c = fixed4(FinalColor, Tex.a);
- _Contrast += 1;
- c = c - _Contrast * (c - 1.0f) * c *(c - 0.5f);
- if(c.a < _Cutoff) discard;
- UNITY_APPLY_FOG(i.fogCoord, c);
- return c;
- }
- ENDCG
- }
- }
- FallBack "Diffuse"
- }
|