Created
August 19, 2014 10:20
-
-
Save arxae/27c8e06457778481b170 to your computer and use it in GitHub Desktop.
Dynamic shadows in Unity pro using an orthogonal camera. Use as shader for all objects that need to cast and/or receive shadows.
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 "ArxOrthoShadows" { | |
Properties { | |
_Color ("Main Color", Color) = (1,1,1,1) | |
_MainTex ("Base (RGB) Gloss (A)", 2D) = "white" {} | |
_BumpMap ("Normalmap", 2D) = "bump" {} | |
_Detail ("Detail (RGB)", 2D) = "gray" {} | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
LOD 400 | |
CGPROGRAM | |
#pragma surface surf BlinnPhong fullforwardshadows | |
sampler2D _MainTex; | |
sampler2D _BumpMap; | |
sampler2D _Detail; | |
fixed4 _Color; | |
struct Input { | |
float2 uv_MainTex; | |
float2 uv_BumpMap; | |
float2 uv_Detail; | |
}; | |
void surf (Input IN, inout SurfaceOutput o) { | |
fixed4 tex = tex2D(_MainTex, IN.uv_MainTex); | |
tex.rgb *= tex2D(_Detail,IN.uv_Detail).rgb*2; | |
o.Albedo = tex.rgb * _Color.rgb; | |
o.Gloss = tex.a; | |
o.Alpha = tex.a * _Color.a; | |
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap)); | |
} | |
ENDCG | |
} | |
Fallback "VertexLit" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment