回答編集履歴

1

移植版コードでR=G=Bの時の色相判定が狂っていたため修正

2018/05/01 20:32

投稿

Bongo
Bongo

スコア10807

test CHANGED
@@ -190,7 +190,7 @@
190
190
 
191
191
  float3 c = tex2D(_MainTex, i.uv).rgb * 255.0;
192
192
 
193
-
193
+
194
194
 
195
195
  float I = dot(float3(0.596, -0.274, -0.322), c);
196
196
 
@@ -202,13 +202,13 @@
202
202
 
203
203
  float3 H3 = float3(c.g - c.b, 2.0 - c.r + c.b, 4.0 - c.g + c.r) / (6.0 * D);
204
204
 
205
- float H = dot(floor(c / V) * H3, 1.0);
205
+ float H = dot(floor(c / V) * H3, 1.0 - floor(saturate(dot(normalize(c), 1.0))));
206
206
 
207
207
 
208
208
 
209
209
  float result = step(0.20, S) * step(S, 0.75) * step(0.35, V) * step(0.0, H) * step(H, 25.0) * step(I, 90.0) * step(20.0, I);
210
210
 
211
-
211
+
212
212
 
213
213
  return fixed4(result, result, result, 1.0);
214
214
 
@@ -222,7 +222,7 @@
222
222
 
223
223
  ※ちゃんと移植できたか自信がないので、オリジナルの論文をご覧になった方がいいかと思います...
224
224
 
225
- ![例2](f011bc38fdb2260232734714076e9a38.png)
225
+ ![例2](6cc3056015e2c5126104da9a46a7237c.png)
226
226
 
227
227
 
228
228