回答編集履歴

1

コードが誤っていたため差し替え

2018/09/07 10:41

投稿

Bongo
Bongo

スコア10807

test CHANGED
@@ -74,21 +74,21 @@
74
74
 
75
75
  #pragma multi_compile _ ETC1_EXTERNAL_ALPHA
76
76
 
77
-
78
-
77
+
78
+
79
- // 追加
79
+ // 追加
80
-
80
+
81
- #pragma multi_compile __ UNITY_UI_CLIP_RECT
81
+ #pragma multi_compile __ UNITY_UI_CLIP_RECT
82
-
83
-
84
-
82
+
83
+
84
+
85
- #include "UnityCG.cginc"
85
+ #include "UnityCG.cginc"
86
-
87
-
88
-
86
+
87
+
88
+
89
- // 追加
89
+ // 追加
90
-
90
+
91
- #include "UnityUI.cginc"
91
+ #include "UnityUI.cginc"
92
92
 
93
93
 
94
94
 
@@ -116,7 +116,7 @@
116
116
 
117
117
  float2 texcoord : TEXCOORD0;
118
118
 
119
- float4 worldPosition : TEXCOORD1; // 追加
119
+ float4 worldPosition : TEXCOORD1; // 追加
120
120
 
121
121
  };
122
122
 
@@ -136,7 +136,7 @@
136
136
 
137
137
  OUT.texcoord = IN.texcoord;
138
138
 
139
- OUT.worldPosition = IN.vertex; // 追加
139
+ OUT.worldPosition = IN.vertex; // 追加
140
140
 
141
141
  OUT.color = IN.color * _Color;
142
142
 
@@ -158,6 +158,8 @@
158
158
 
159
159
  sampler2D _AlphaTex;
160
160
 
161
+ float4 _ClipRect; // 追加
162
+
161
163
 
162
164
 
163
165
  fixed4 SampleSpriteTexture (float2 uv)
@@ -178,38 +180,40 @@
178
180
 
179
181
 
180
182
 
183
+ return color;
184
+
185
+ }
186
+
187
+
188
+
189
+ fixed4 frag(v2f IN) : SV_Target
190
+
191
+ {
192
+
193
+ fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;
194
+
195
+
196
+
181
197
  // 追加
182
198
 
183
199
  #ifdef UNITY_UI_CLIP_RECT
184
200
 
185
- color.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
201
+ c.a *= UnityGet2DClipping(IN.worldPosition.xy, _ClipRect);
186
-
202
+
187
- clip (color.a - 0.001);
203
+ clip (c.a - 0.001);
188
204
 
189
205
  #endif //UNITY_UI_CLIP_RECT
190
206
 
207
+
208
+
191
-
209
+ c.rgb = c.rgb*2+max(fixed3(0,0,0),IN.color.rgb-0.5)*2;
210
+
192
-
211
+ c.rgb *= c.a;
212
+
193
- return color;
213
+ return c;
194
214
 
195
215
  }
196
216
 
197
-
198
-
199
- fixed4 frag(v2f IN) : SV_Target
200
-
201
- {
202
-
203
- fixed4 c = SampleSpriteTexture (IN.texcoord) * IN.color;
204
-
205
- c.rgb = c.rgb*2+max(fixed3(0,0,0),IN.color.rgb-0.5)*2;
206
-
207
- c.rgb *= c.a;
208
-
209
- return c;
210
-
211
- }
212
-
213
217
  ENDCG
214
218
 
215
219
  }