Mercurial > hg > Game > Games
comparison Orchestland/Assets/LeapMotion/Materials/Sources/Shaders/Toony-Lighted.shader @ 1:f7675884f2a1
Add Orchestland project
author | Daiki OYAKAWA <e135764@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 17 Jul 2015 23:09:20 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
0:347d21cdfc22 | 1:f7675884f2a1 |
---|---|
1 Shader "Toon/Lighted" { | |
2 Properties { | |
3 _Color ("Main Color", Color) = (0.5,0.5,0.5,1) | |
4 _MainTex ("Base (RGB)", 2D) = "white" {} | |
5 _Ramp ("Toon Ramp (RGB)", 2D) = "gray" {} | |
6 } | |
7 | |
8 SubShader { | |
9 Tags { "RenderType"="Opaque" } | |
10 LOD 200 | |
11 | |
12 CGPROGRAM | |
13 #pragma surface surf ToonRamp | |
14 | |
15 sampler2D _Ramp; | |
16 | |
17 // custom lighting function that uses a texture ramp based | |
18 // on angle between light direction and normal | |
19 #pragma lighting ToonRamp exclude_path:prepass | |
20 inline half4 LightingToonRamp (SurfaceOutput s, half3 lightDir, half atten) | |
21 { | |
22 #ifndef USING_DIRECTIONAL_LIGHT | |
23 lightDir = normalize(lightDir); | |
24 #endif | |
25 | |
26 half d = dot (s.Normal, lightDir)*0.5 + 0.5; | |
27 half3 ramp = tex2D (_Ramp, float2(d,d)).rgb; | |
28 | |
29 half4 c; | |
30 c.rgb = s.Albedo * _LightColor0.rgb * ramp * (atten * 2); | |
31 c.a = 0; | |
32 return c; | |
33 } | |
34 | |
35 | |
36 sampler2D _MainTex; | |
37 float4 _Color; | |
38 | |
39 struct Input { | |
40 float2 uv_MainTex : TEXCOORD0; | |
41 }; | |
42 | |
43 void surf (Input IN, inout SurfaceOutput o) { | |
44 half4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color; | |
45 o.Albedo = c.rgb; | |
46 o.Alpha = c.a; | |
47 } | |
48 ENDCG | |
49 | |
50 } | |
51 | |
52 Fallback "Diffuse" | |
53 } |