Mercurial > hg > Game > Games
comparison Orchestland/Assets/LeapMotion/Materials/Sources/Shaders/Toony-BasicOutline.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 Outline" { | |
2 Properties { | |
3 _Color ("Main Color", Color) = (.5,.5,.5,1) | |
4 _OutlineColor ("Outline Color", Color) = (0,0,0,1) | |
5 _Outline ("Outline width", Range (.002, 0.03)) = .005 | |
6 _MainTex ("Base (RGB)", 2D) = "white" { } | |
7 _ToonShade ("ToonShader Cubemap(RGB)", CUBE) = "" { Texgen CubeNormal } | |
8 } | |
9 | |
10 CGINCLUDE | |
11 #include "UnityCG.cginc" | |
12 | |
13 struct appdata { | |
14 float4 vertex : POSITION; | |
15 float3 normal : NORMAL; | |
16 }; | |
17 | |
18 struct v2f { | |
19 float4 pos : POSITION; | |
20 float4 color : COLOR; | |
21 }; | |
22 | |
23 uniform float _Outline; | |
24 uniform float4 _OutlineColor; | |
25 | |
26 v2f vert(appdata v) { | |
27 v2f o; | |
28 o.pos = mul(UNITY_MATRIX_MVP, v.vertex); | |
29 | |
30 float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal); | |
31 float2 offset = TransformViewToProjection(norm.xy); | |
32 | |
33 o.pos.xy += offset * o.pos.z * _Outline; | |
34 o.color = _OutlineColor; | |
35 return o; | |
36 } | |
37 ENDCG | |
38 | |
39 SubShader { | |
40 Tags { "RenderType"="Opaque" } | |
41 UsePass "Toon/Basic/BASE" | |
42 Pass { | |
43 Name "OUTLINE" | |
44 Tags { "LightMode" = "Always" } | |
45 Cull Front | |
46 ZWrite On | |
47 ColorMask RGB | |
48 Blend SrcAlpha OneMinusSrcAlpha | |
49 | |
50 CGPROGRAM | |
51 #pragma vertex vert | |
52 #pragma fragment frag | |
53 half4 frag(v2f i) :COLOR { return i.color; } | |
54 ENDCG | |
55 } | |
56 } | |
57 | |
58 SubShader { | |
59 Tags { "RenderType"="Opaque" } | |
60 UsePass "Toon/Basic/BASE" | |
61 Pass { | |
62 Name "OUTLINE" | |
63 Tags { "LightMode" = "Always" } | |
64 Cull Front | |
65 ZWrite On | |
66 ColorMask RGB | |
67 Blend SrcAlpha OneMinusSrcAlpha | |
68 | |
69 CGPROGRAM | |
70 #pragma vertex vert | |
71 #pragma exclude_renderers shaderonly | |
72 ENDCG | |
73 SetTexture [_MainTex] { combine primary } | |
74 } | |
75 } | |
76 | |
77 Fallback "Toon/Basic" | |
78 } |