Last active
November 26, 2015 14:38
-
-
Save sugi-cho/184417a56327283eac63 to your computer and use it in GitHub Desktop.
Shaderの影を投影する部分。
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
Shader "Custom/ShadowCaster" { | |
Properties { | |
_Color ("Color", Color) = (1,1,1,1) | |
_MainTex ("Albedo (RGB)", 2D) = "white" {} | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
LOD 200 | |
// ---- shadow caster pass: | |
Pass { | |
Name "ShadowCaster" | |
Tags { "LightMode" = "ShadowCaster" } | |
ZWrite On ZTest LEqual | |
CGPROGRAM | |
#pragma vertex vert | |
#pragma fragment frag | |
#pragma target 3.0 | |
#pragma multi_compile_shadowcaster | |
#include "UnityCG.cginc" | |
struct v2f { | |
V2F_SHADOW_CASTER; | |
}; | |
// vertex shader | |
v2f vert (appdata_full v) { | |
v2f o; | |
TRANSFER_SHADOW_CASTER_NORMALOFFSET(o) | |
return o; | |
} | |
// fragment shader | |
fixed4 frag (v2f i) : SV_Target { | |
SHADOW_CASTER_FRAGMENT(i) | |
} | |
ENDCG | |
} | |
} | |
FallBack "Diffuse" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment