Mercurial > hg > Game > Games
comparison Orchestland/Assets/LeapMotion/Materials/Sources/Shaders/Toony-Basic.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/Basic" { | |
2 Properties { | |
3 _Color ("Main Color", Color) = (.5,.5,.5,1) | |
4 _MainTex ("Base (RGB)", 2D) = "white" {} | |
5 _ToonShade ("ToonShader Cubemap(RGB)", CUBE) = "" { Texgen CubeNormal } | |
6 } | |
7 | |
8 | |
9 SubShader { | |
10 Tags { "RenderType"="Opaque" } | |
11 Pass { | |
12 Name "BASE" | |
13 Cull Off | |
14 | |
15 CGPROGRAM | |
16 #pragma vertex vert | |
17 #pragma fragment frag | |
18 #pragma fragmentoption ARB_precision_hint_fastest | |
19 | |
20 #include "UnityCG.cginc" | |
21 | |
22 sampler2D _MainTex; | |
23 samplerCUBE _ToonShade; | |
24 float4 _MainTex_ST; | |
25 float4 _Color; | |
26 | |
27 struct appdata { | |
28 float4 vertex : POSITION; | |
29 float2 texcoord : TEXCOORD0; | |
30 float3 normal : NORMAL; | |
31 }; | |
32 | |
33 struct v2f { | |
34 float4 pos : POSITION; | |
35 float2 texcoord : TEXCOORD0; | |
36 float3 cubenormal : TEXCOORD1; | |
37 }; | |
38 | |
39 v2f vert (appdata v) | |
40 { | |
41 v2f o; | |
42 o.pos = mul (UNITY_MATRIX_MVP, v.vertex); | |
43 o.texcoord = TRANSFORM_TEX(v.texcoord, _MainTex); | |
44 o.cubenormal = mul (UNITY_MATRIX_MV, float4(v.normal,0)); | |
45 return o; | |
46 } | |
47 | |
48 float4 frag (v2f i) : COLOR | |
49 { | |
50 float4 col = _Color * tex2D(_MainTex, i.texcoord); | |
51 float4 cube = texCUBE(_ToonShade, i.cubenormal); | |
52 return float4(2.0f * cube.rgb * col.rgb, col.a); | |
53 } | |
54 ENDCG | |
55 } | |
56 } | |
57 | |
58 SubShader { | |
59 Tags { "RenderType"="Opaque" } | |
60 Pass { | |
61 Name "BASE" | |
62 Cull Off | |
63 SetTexture [_MainTex] { | |
64 constantColor [_Color] | |
65 Combine texture * constant | |
66 } | |
67 SetTexture [_ToonShade] { | |
68 combine texture * previous DOUBLE, previous | |
69 } | |
70 } | |
71 } | |
72 | |
73 Fallback "VertexLit" | |
74 } |