forked from crosire/reshade-shaders
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Clarity.fx
537 lines (434 loc) · 19 KB
/
Clarity.fx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
//Clarity by Ioxa
//Version 1.5 for ReShade 3.0
//>Clarity Settings<\\
uniform int ClarityRadius
<
ui_type = "drag";
ui_min = 0; ui_max = 4;
ui_tooltip = "[0|1|2|3|4] Higher values will increase the radius of the effect.";
ui_step = 1.00;
> = 3;
uniform float ClarityOffset
<
ui_type = "drag";
ui_min = 1.00; ui_max = 5.00;
ui_tooltip = "Additional adjustment for the blur radius. Increasing the value will increase the radius.";
ui_step = 1.00;
> = 2.00;
uniform int ClarityBlendMode
<
ui_type = "combo";
ui_items = "\Soft Light\0Overlay\0Hard Light\0Multiply\0Vivid Light\0Linear Light\0Addition";
ui_tooltip = "Blend modes determine how the clarity mask is applied to the original image";
> = 2;
uniform int ClarityBlendIfDark
<
ui_type = "drag";
ui_min = 0; ui_max = 255;
ui_tooltip = "Any pixels below this value will be excluded from the effect. Set to 50 to target mid-tones.";
ui_step = 5;
> = 50;
uniform int ClarityBlendIfLight
<
ui_type = "drag";
ui_min = 0; ui_max = 255;
ui_tooltip = "Any pixels above this value will be excluded from the effect. Set to 205 to target mid-tones.";
ui_step = 5;
> = 205;
uniform bool ClarityViewBlendIfMask
<
ui_tooltip = "The mask used for BlendIf settings. The effect will not be applied to areas covered in black";
> = false;
uniform float ClarityStrength
<
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_tooltip = "Adjusts the strength of the effect";
> = 0.400;
uniform float ClarityDarkIntensity
<
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_tooltip = "Adjusts the strength of dark halos.";
> = 0.400;
uniform float ClarityLightIntensity
<
ui_type = "drag";
ui_min = 0.00; ui_max = 1.00;
ui_tooltip = "Adjusts the strength of light halos.";
> = 0.000;
uniform bool ClarityViewMask
<
ui_tooltip = "The mask is what creates the effect. View it when making adjustments to get a better idea of how your changes will affect the image.";
> = false;
#include "ReShade.fxh"
texture ClarityTex{ Width = BUFFER_WIDTH*0.5; Height = BUFFER_HEIGHT*0.5; Format = R8; };
texture ClarityTex2{ Width = BUFFER_WIDTH*0.5; Height = BUFFER_HEIGHT*0.5; Format = R8; };
texture ClarityTex3{ Width = BUFFER_WIDTH*0.25; Height = BUFFER_HEIGHT*0.25; Format = R8; };
sampler ClaritySampler { Texture = ClarityTex;};
sampler ClaritySampler2 { Texture = ClarityTex2;};
sampler ClaritySampler3 { Texture = ClarityTex3;};
float3 ClarityFinal(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD) : COLOR
{
float color = tex2D(ClaritySampler3, texcoord).r;
if(ClarityRadius == 0)
{
float offset[4] = { 0.0, 1.1824255238, 3.0293122308, 5.0040701377 };
float weight[4] = { 0.39894, 0.2959599993, 0.0045656525, 0.00000149278686458842 };
color *= weight[0];
[loop]
for(int i = 1; i < 4; ++i)
{
color += tex2D(ClaritySampler3, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
color += tex2D(ClaritySampler3, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
}
}
if(ClarityRadius == 1)
{
float offset[6] = { 0.0, 1.4584295168, 3.40398480678, 5.3518057801, 7.302940716, 9.2581597095 };
float weight[6] = { 0.13298, 0.23227575, 0.1353261595, 0.0511557427, 0.01253922, 0.0019913644 };
color *= weight[0];
[loop]
for(int i = 1; i < 6; ++i)
{
color += tex2D(ClaritySampler3, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
color += tex2D(ClaritySampler3, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
}
}
if(ClarityRadius == 2)
{
float offset[11] = { 0.0, 1.4895848401, 3.4757135714, 5.4618796741, 7.4481042327, 9.4344079746, 11.420811147, 13.4073334, 15.3939936778, 17.3808101174, 19.3677999584 };
float weight[11] = { 0.06649, 0.1284697563, 0.111918249, 0.0873132676, 0.0610011113, 0.0381655709, 0.0213835661, 0.0107290241, 0.0048206869, 0.0019396469, 0.0006988718 };
color *= weight[0];
[loop]
for(int i = 1; i < 11; ++i)
{
color += tex2D(ClaritySampler3, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
color += tex2D(ClaritySampler3, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
}
}
if(ClarityRadius == 3)
{
float offset[15] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4401038149, 21.43402885, 23.4279736431, 25.4219399344, 27.4159294386 };
float weight[15] = { 0.0443266667, 0.0872994708, 0.0820892038, 0.0734818355, 0.0626171681, 0.0507956191, 0.0392263968, 0.0288369812, 0.0201808877, 0.0134446557, 0.0085266392, 0.0051478359, 0.0029586248, 0.0016187257, 0.0008430913 };
color *= weight[0];
[loop]
for(int i = 1; i < 15; ++i)
{
color += tex2D(ClaritySampler3, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
color += tex2D(ClaritySampler3, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
}
}
if(ClarityRadius == 4)
{
float offset[18] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4661974725, 21.4627427973, 23.4592916956, 25.455844494, 27.4524015179, 29.4489630909, 31.445529535, 33.4421011704 };
float weight[18] = { 0.033245, 0.0659162217, 0.0636705814, 0.0598194658, 0.0546642566, 0.0485871646, 0.0420045997, 0.0353207015, 0.0288880982, 0.0229808311, 0.0177815511, 0.013382297, 0.0097960001, 0.0069746748, 0.0048301008, 0.0032534598, 0.0021315311, 0.0013582974 };
color *= weight[0];
[loop]
for(int i = 1; i < 18; ++i)
{
color += tex2D(ClaritySampler3, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
color += tex2D(ClaritySampler3, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r * weight[i];
}
}
float3 orig = tex2D(ReShade::BackBuffer, texcoord).rgb; //Original Image
float luma = dot(orig.rgb,float3(0.32786885,0.655737705,0.0163934436));
float3 chroma = orig.rgb/luma;
float sharp = 1-color;
sharp = (luma+sharp)*0.5;
float sharpMin = lerp(0.0,1.0,smoothstep(0.0,1.0,sharp));
float sharpMax = sharpMin;
sharpMin = lerp(sharp,sharpMin,ClarityDarkIntensity);
sharpMax = lerp(sharp,sharpMax,ClarityLightIntensity);
sharp = lerp(sharpMin,sharpMax,step(0.5,sharp));
if(ClarityViewMask)
{
orig.rgb = sharp;
luma = sharp;
chroma = 1.0;
}
else
{
if(ClarityBlendMode == 0)
{
//softlight
sharp = lerp(2*luma*sharp + luma*luma*(1.0-2*sharp), 2*luma*(1.0-sharp)+pow(luma,0.5)*(2*sharp-1.0), step(0.49,sharp));
}
if(ClarityBlendMode == 1)
{
//overlay
sharp = lerp(2*luma*sharp, 1.0 - 2*(1.0-luma)*(1.0-sharp), step(0.50,luma));
}
if(ClarityBlendMode == 2)
{
//Hardlight
sharp = lerp(2*luma*sharp, 1.0 - 2*(1.0-luma)*(1.0-sharp), step(0.50,sharp));
}
if(ClarityBlendMode == 3)
{
//Multiply
sharp = saturate(2 * luma * sharp);
}
if(ClarityBlendMode == 4)
{
//vivid light
sharp = lerp(2*luma*sharp, luma/(2*(1-sharp)), step(0.5,sharp));
}
if(ClarityBlendMode == 5)
{
//Linear Light
sharp = luma + 2.0*sharp-1.0;
}
if(ClarityBlendMode == 6)
{
//Addition
sharp = saturate(luma + (sharp - 0.5));
}
}
if( ClarityBlendIfDark > 0 || ClarityBlendIfLight < 255 || ClarityViewBlendIfMask)
{
float ClarityBlendIfD = (ClarityBlendIfDark/255.0)+0.0001;
float ClarityBlendIfL = (ClarityBlendIfLight/255.0)-0.0001;
float mix = dot(orig.rgb, 0.333333);
float mask = 1.0;
if(ClarityBlendIfDark > 0)
{
mask = lerp(0.0,1.0,smoothstep(ClarityBlendIfD-(ClarityBlendIfD*0.2),ClarityBlendIfD+(ClarityBlendIfD*0.2),mix));
}
if(ClarityBlendIfLight < 255)
{
mask = lerp(mask,0.0,smoothstep(ClarityBlendIfL-(ClarityBlendIfL*0.2),ClarityBlendIfL+(ClarityBlendIfL*0.2),mix));
}
sharp = lerp(luma,sharp,mask);
if (ClarityViewBlendIfMask)
{
sharp = mask;
luma = mask;
chroma = 1.0;
}
}
orig.rgb = lerp(luma, sharp, ClarityStrength);
orig.rgb *= chroma;
return saturate(orig);
}
float Clarity1(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD) : COLOR
{
float3 color = tex2D(ReShade::BackBuffer, texcoord).rgb;
if(ClarityRadius == 0)
{
float offset[4] = { 0.0, 1.1824255238, 3.0293122308, 5.0040701377 };
float weight[4] = { 0.39894, 0.2959599993, 0.0045656525, 0.00000149278686458842 };
color *= weight[0];
[loop]
for(int i = 1; i < 4; ++i)
{
color += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
color += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
}
}
if(ClarityRadius == 1)
{
float offset[6] = { 0.0, 1.4584295168, 3.40398480678, 5.3518057801, 7.302940716, 9.2581597095 };
float weight[6] = { 0.13298, 0.23227575, 0.1353261595, 0.0511557427, 0.01253922, 0.0019913644 };
color *= weight[0];
[loop]
for(int i = 1; i < 6; ++i)
{
color += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
color += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
}
}
if(ClarityRadius == 2)
{
float offset[11] = { 0.0, 1.4895848401, 3.4757135714, 5.4618796741, 7.4481042327, 9.4344079746, 11.420811147, 13.4073334, 15.3939936778, 17.3808101174, 19.3677999584 };
float weight[11] = { 0.06649, 0.1284697563, 0.111918249, 0.0873132676, 0.0610011113, 0.0381655709, 0.0213835661, 0.0107290241, 0.0048206869, 0.0019396469, 0.0006988718 };
color *= weight[0];
[loop]
for(int i = 1; i < 11; ++i)
{
color += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
color += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
}
}
if(ClarityRadius == 3)
{
float offset[15] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4401038149, 21.43402885, 23.4279736431, 25.4219399344, 27.4159294386 };
float weight[15] = { 0.0443266667, 0.0872994708, 0.0820892038, 0.0734818355, 0.0626171681, 0.0507956191, 0.0392263968, 0.0288369812, 0.0201808877, 0.0134446557, 0.0085266392, 0.0051478359, 0.0029586248, 0.0016187257, 0.0008430913 };
color *= weight[0];
[loop]
for(int i = 1; i < 15; ++i)
{
color += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
color += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
}
}
if(ClarityRadius == 4)
{
float offset[18] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4661974725, 21.4627427973, 23.4592916956, 25.455844494, 27.4524015179, 29.4489630909, 31.445529535, 33.4421011704 };
float weight[18] = { 0.033245, 0.0659162217, 0.0636705814, 0.0598194658, 0.0546642566, 0.0485871646, 0.0420045997, 0.0353207015, 0.0288880982, 0.0229808311, 0.0177815511, 0.013382297, 0.0097960001, 0.0069746748, 0.0048301008, 0.0032534598, 0.0021315311, 0.0013582974 };
color *= weight[0];
[loop]
for(int i = 1; i < 18; ++i)
{
color += tex2D(ReShade::BackBuffer, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
color += tex2D(ReShade::BackBuffer, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).rgb * weight[i];
}
}
return dot(color.rgb,float3(0.32786885,0.655737705,0.0163934436));
}
float Clarity2(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD) : COLOR
{
float color = tex2D(ClaritySampler, texcoord).r;
if(ClarityRadius == 0)
{
float offset[4] = { 0.0, 1.1824255238, 3.0293122308, 5.0040701377 };
float weight[4] = { 0.39894, 0.2959599993, 0.0045656525, 0.00000149278686458842 };
color *= weight[0];
[loop]
for(int i = 1; i < 4; ++i)
{
color += tex2D(ClaritySampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 1)
{
float offset[6] = { 0.0, 1.4584295168, 3.40398480678, 5.3518057801, 7.302940716, 9.2581597095 };
float weight[6] = { 0.13298, 0.23227575, 0.1353261595, 0.0511557427, 0.01253922, 0.0019913644 };
color *= weight[0];
[loop]
for(int i = 1; i < 6; ++i)
{
color += tex2D(ClaritySampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 2)
{
float offset[11] = { 0.0, 1.4895848401, 3.4757135714, 5.4618796741, 7.4481042327, 9.4344079746, 11.420811147, 13.4073334, 15.3939936778, 17.3808101174, 19.3677999584 };
float weight[11] = { 0.06649, 0.1284697563, 0.111918249, 0.0873132676, 0.0610011113, 0.0381655709, 0.0213835661, 0.0107290241, 0.0048206869, 0.0019396469, 0.0006988718 };
color *= weight[0];
[loop]
for(int i = 1; i < 11; ++i)
{
color += tex2D(ClaritySampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 3)
{
float offset[15] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4401038149, 21.43402885, 23.4279736431, 25.4219399344, 27.4159294386 };
float weight[15] = { 0.0443266667, 0.0872994708, 0.0820892038, 0.0734818355, 0.0626171681, 0.0507956191, 0.0392263968, 0.0288369812, 0.0201808877, 0.0134446557, 0.0085266392, 0.0051478359, 0.0029586248, 0.0016187257, 0.0008430913 };
color *= weight[0];
[loop]
for(int i = 1; i < 15; ++i)
{
color += tex2D(ClaritySampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 4)
{
float offset[18] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4661974725, 21.4627427973, 23.4592916956, 25.455844494, 27.4524015179, 29.4489630909, 31.445529535, 33.4421011704 };
float weight[18] = { 0.033245, 0.0659162217, 0.0636705814, 0.0598194658, 0.0546642566, 0.0485871646, 0.0420045997, 0.0353207015, 0.0288880982, 0.0229808311, 0.0177815511, 0.013382297, 0.0097960001, 0.0069746748, 0.0048301008, 0.0032534598, 0.0021315311, 0.0013582974 };
color *= weight[0];
[loop]
for(int i = 1; i < 18; ++i)
{
color += tex2D(ClaritySampler, texcoord + float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler, texcoord - float2(0.0, offset[i] * ReShade::PixelSize.y) * ClarityOffset).r* weight[i];
}
}
return color;
}
float Clarity3(in float4 pos : SV_Position, in float2 texcoord : TEXCOORD) : COLOR
{
float color = tex2D(ClaritySampler2, texcoord).r;
if(ClarityRadius == 0)
{
float offset[4] = { 0.0, 1.1824255238, 3.0293122308, 5.0040701377 };
float weight[4] = { 0.39894, 0.2959599993, 0.0045656525, 0.00000149278686458842 };
color *= weight[0];
[loop]
for(int i = 1; i < 4; ++i)
{
color += tex2D(ClaritySampler2, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler2, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 1)
{
float offset[6] = { 0.0, 1.4584295168, 3.40398480678, 5.3518057801, 7.302940716, 9.2581597095 };
float weight[6] = { 0.13298, 0.23227575, 0.1353261595, 0.0511557427, 0.01253922, 0.0019913644 };
color *= weight[0];
[loop]
for(int i = 1; i < 6; ++i)
{
color += tex2D(ClaritySampler2, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler2, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 2)
{
float offset[11] = { 0.0, 1.4895848401, 3.4757135714, 5.4618796741, 7.4481042327, 9.4344079746, 11.420811147, 13.4073334, 15.3939936778, 17.3808101174, 19.3677999584 };
float weight[11] = { 0.06649, 0.1284697563, 0.111918249, 0.0873132676, 0.0610011113, 0.0381655709, 0.0213835661, 0.0107290241, 0.0048206869, 0.0019396469, 0.0006988718 };
color *= weight[0];
[loop]
for(int i = 1; i < 11; ++i)
{
color += tex2D(ClaritySampler2, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler2, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 3)
{
float offset[15] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4401038149, 21.43402885, 23.4279736431, 25.4219399344, 27.4159294386 };
float weight[15] = { 0.0443266667, 0.0872994708, 0.0820892038, 0.0734818355, 0.0626171681, 0.0507956191, 0.0392263968, 0.0288369812, 0.0201808877, 0.0134446557, 0.0085266392, 0.0051478359, 0.0029586248, 0.0016187257, 0.0008430913 };
color *= weight[0];
[loop]
for(int i = 1; i < 15; ++i)
{
color += tex2D(ClaritySampler2, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler2, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
}
}
if(ClarityRadius == 4)
{
float offset[18] = { 0.0, 1.4953705027, 3.4891992113, 5.4830312105, 7.4768683759, 9.4707125766, 11.4645656736, 13.4584295168, 15.4523059431, 17.4461967743, 19.4661974725, 21.4627427973, 23.4592916956, 25.455844494, 27.4524015179, 29.4489630909, 31.445529535, 33.4421011704 };
float weight[18] = { 0.033245, 0.0659162217, 0.0636705814, 0.0598194658, 0.0546642566, 0.0485871646, 0.0420045997, 0.0353207015, 0.0288880982, 0.0229808311, 0.0177815511, 0.013382297, 0.0097960001, 0.0069746748, 0.0048301008, 0.0032534598, 0.0021315311, 0.0013582974 };
color *= weight[0];
[loop]
for(int i = 1; i < 18; ++i)
{
color += tex2D(ClaritySampler2, texcoord + float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
color += tex2D(ClaritySampler2, texcoord - float2(offset[i] * ReShade::PixelSize.x, 0.0) * ClarityOffset).r* weight[i];
}
}
return color;
}
technique Clarity
{
pass Clarity1
{
VertexShader = PostProcessVS;
PixelShader = Clarity1;
RenderTarget = ClarityTex;
}
pass Clarity2
{
VertexShader = PostProcessVS;
PixelShader = Clarity2;
RenderTarget = ClarityTex2;
}
pass Clarity3
{
VertexShader = PostProcessVS;
PixelShader = Clarity3;
RenderTarget = ClarityTex3;
}
pass ClarityFinal
{
VertexShader = PostProcessVS;
PixelShader = ClarityFinal;
}
}