Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Shader "Tasharen/Text Decal"
- {
- Properties
- {
- _Color ("Color", Color) = (1,1,1,1)
- _MainTex ("Albedo (RGB)", 2D) = "white" {}
- _Cutoff ("Base Alpha cutoff", Range (0, 0.9)) = 0.5
- _Specular ("Specular", Color) = (0.2,0.2,0.2,1)
- _Smoothness ("Smoothness", Range(0,1)) = 0.81
- }
- SubShader
- {
- Tags
- {
- "Queue" = "AlphaTest+100"
- "RenderType" = "Opaque"
- }
- LOD 200
- Offset -1, -1
- Blend SrcAlpha OneMinusSrcAlpha
- Cull Off
- ZWrite Off
- Pass
- {
- Name "ShadowCaster"
- Tags { "LightMode" = "ShadowCaster" }
- Fog { Mode Off }
- // Seems to work with this removed too
- Offset [_ShadowBias], [_ShadowBiasSlope]
- CGPROGRAM
- #pragma vertex vert
- #pragma fragment frag
- #pragma multi_compile_shadowcaster
- #pragma multi_compile _ LOD_FADE_CROSSFADE
- #pragma fragmentoption ARB_precision_hint_fastest
- #include "UnityCG.cginc"
- sampler2D _MainTex;
- half _Cutoff;
- half4 _Color;
- struct appdata
- {
- float4 vertex : POSITION;
- float4 color: COLOR;
- float2 texcoord : TEXCOORD0;
- };
- struct v2f
- {
- V2F_SHADOW_CASTER;
- half2 uv : TEXCOORD1;
- half4 color : TEXCOORD2;
- UNITY_DITHER_CROSSFADE_COORDS_IDX(3)
- };
- v2f vert (appdata v)
- {
- v2f o;
- UNITY_TRANSFER_DITHER_CROSSFADE(o, v.vertex);
- o.uv = v.texcoord;
- o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
- o.color = v.color;
- TRANSFER_SHADOW_CASTER(o)
- return o;
- }
- float4 frag (v2f IN) : COLOR
- {
- half4 c = IN.color * _Color;
- c.a *= tex2D(_MainTex, IN.uv).a;
- #ifdef LOD_FADE_CROSSFADE
- UNITY_APPLY_DITHER_CROSSFADE(IN);
- #endif
- SHADOW_CASTER_FRAGMENT(IN)
- }
- ENDCG
- }
- CGPROGRAM
- // Physically based Standard lighting model, and enable shadows on all light types
- #pragma surface surf Tasharen vertex:vert fullforwardshadows
- #pragma target 4.0
- #pragma multi_compile _ LOD_FADE_CROSSFADE
- #include "Tasharen Lighting.cginc"
- sampler2D _MainTex;
- struct appdata
- {
- float4 vertex : POSITION;
- float3 normal : NORMAL;
- float2 texcoord : TEXCOORD0;
- fixed4 color: COLOR;
- };
- struct Input
- {
- half2 uv_MainTex;
- half4 color;
- UNITY_DITHER_CROSSFADE_COORDS
- };
- half4 _Color, _Specular;
- half _Smoothness, _Cutoff;
- void vert (inout appdata_full v, out Input o)
- {
- UNITY_INITIALIZE_OUTPUT(Input, o);
- UNITY_TRANSFER_DITHER_CROSSFADE(o, v.vertex);
- o.color = v.color;
- }
- void surf (Input IN, inout Output o)
- {
- // Albedo comes from a texture tinted by color
- half4 c = IN.color * _Color;
- c.a *= tex2D (_MainTex, IN.uv_MainTex).a;
- clip(c.a - _Cutoff);
- o.Albedo = c.rgb;
- o.Smoothness = _Smoothness;
- o.Specular = _Specular;
- o.Alpha = c.a;
- UNITY_APPLY_DITHER_CROSSFADE(IN);
- }
- ENDCG
- }
- FallBack Off
- }
Advertisement
Add Comment
Please, Sign In to add comment