-
-
Save haim96/5a102a910073c522e2267c3b5f346dc9 to your computer and use it in GitHub Desktop.
Unlit texture shader which casts shadow on Forward/Defered
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Unlit texture shader which casts shadow on Forward/Defered | |
Shader "Unlit/Texture CastShadow" { | |
Properties { | |
_MainTex ("Base (RGB) Trans (A)", 2D) = "white" {} | |
} | |
SubShader { | |
Tags {"Queue"="Opaque" } | |
LOD 100 | |
Pass { | |
Lighting Off | |
SetTexture [_MainTex] { combine texture } | |
} | |
// Pass to render object as a shadow caster | |
Pass | |
{ | |
Name "ShadowCaster" | |
Tags { "LightMode" = "ShadowCaster" } | |
Fog {Mode Off} | |
ZWrite On ZTest LEqual Cull Off | |
Offset 1, 1 | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#pragma multi_compile_shadowcaster | |
#pragma fragmentoption ARB_precision_hint_fastest | |
#include "UnityCG.cginc" | |
struct v2f { | |
V2F_SHADOW_CASTER; | |
}; | |
v2f vert( appdata_base v ) | |
{ | |
v2f o; | |
TRANSFER_SHADOW_CASTER(o) | |
return o; | |
} | |
float4 frag( v2f i ) : COLOR | |
{ | |
SHADOW_CASTER_FRAGMENT(i) | |
} | |
ENDCG | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment