forked from NatronGitHub/natron-plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLs_FXAA_GL.py
739 lines (587 loc) · 70.1 KB
/
Ls_FXAA_GL.py
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
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
# -*- coding: utf-8 -*-
# DO NOT EDIT THIS FILE
# This file was automatically generated by Natron PyPlug exporter version 10.
# Hand-written code should be added in a separate file named Ls_FXAA_GLExt.py
# See http://natron.readthedocs.org/en/master/devel/groups.html#adding-hand-written-code-callbacks-etc
# Note that Viewers are never exported
import NatronEngine
import sys
# Try to import the extensions file where callbacks and hand-written code should be located.
try:
from Ls_FXAA_GLExt import *
except ImportError:
pass
def getPluginID():
return "natron.community.plugins.Ls_FXAA_GL"
def getLabel():
return "Ls_FXAA_GL"
def getVersion():
return 1.0
def getIconPath():
return "Ls_FXAA_GL.png"
def getGrouping():
return "Community/GLSL/Effect"
def getPluginDescription():
return "Fast cheap antialiasing."
def createInstance(app,group):
# Create all nodes in the group
# Create the parameters of the group node the same way we did for all internal nodes
lastNode = group
lastNode.setColor(1, 0.2353, 0.2353)
# Create the user parameters
lastNode.Controls = lastNode.createPageParam("Controls", "Controls")
param = lastNode.createStringParam("sep01", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep01 = param
del param
param = lastNode.createStringParam("sep02", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep02 = param
del param
param = lastNode.createSeparatorParam("SETUP", "Setup")
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setPersistent(False)
param.setEvaluateOnChange(False)
lastNode.SETUP = param
del param
param = lastNode.createStringParam("sep03", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep03 = param
del param
param = lastNode.createStringParam("sep04", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep04 = param
del param
param = lastNode.createDoubleParam("Shadertoy1paramValueFloat1", "Subpixel amount : ")
param.setMinimum(0, 0)
param.setMaximum(1, 0)
param.setDisplayMinimum(0, 0)
param.setDisplayMaximum(1, 0)
param.setDefaultValue(0.75, 0)
param.restoreDefaultValue(0)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setAddNewLine(True)
param.setAnimationEnabled(True)
lastNode.Shadertoy1paramValueFloat1 = param
del param
param = lastNode.createStringParam("sep05", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep05 = param
del param
param = lastNode.createDoubleParam("Shadertoy1paramValueFloat2", "Edge treshold : ")
param.setMinimum(0, 0)
param.setMaximum(1, 0)
param.setDisplayMinimum(0, 0)
param.setDisplayMaximum(1, 0)
param.setDefaultValue(0.005, 0)
param.restoreDefaultValue(0)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setAddNewLine(True)
param.setAnimationEnabled(True)
lastNode.Shadertoy1paramValueFloat2 = param
del param
param = lastNode.createStringParam("sep06", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep06 = param
del param
param = lastNode.createDoubleParam("Shadertoy1paramValueFloat3", "Dark treshold : ")
param.setMinimum(0, 0)
param.setMaximum(1, 0)
param.setDisplayMinimum(0, 0)
param.setDisplayMaximum(1, 0)
param.setDefaultValue(0.04, 0)
param.restoreDefaultValue(0)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setAddNewLine(True)
param.setAnimationEnabled(True)
lastNode.Shadertoy1paramValueFloat3 = param
del param
param = lastNode.createStringParam("sep07", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep07 = param
del param
param = lastNode.createStringParam("sep08", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep08 = param
del param
param = lastNode.createSeparatorParam("LINE01", "")
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setPersistent(False)
param.setEvaluateOnChange(False)
lastNode.LINE01 = param
del param
param = lastNode.createDoubleParam("Shadertoy1paramValueFloat0", "Mix : ")
param.setMinimum(0, 0)
param.setMaximum(1, 0)
param.setDisplayMinimum(0, 0)
param.setDisplayMaximum(1, 0)
param.setDefaultValue(1, 0)
param.restoreDefaultValue(0)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setAddNewLine(True)
param.setAnimationEnabled(True)
lastNode.Shadertoy1paramValueFloat0 = param
del param
param = lastNode.createStringParam("sep09", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep09 = param
del param
param = lastNode.createStringParam("sep10", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Controls.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep10 = param
del param
lastNode.Credits = lastNode.createPageParam("Credits", "Credits")
param = lastNode.createStringParam("sep101", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep101 = param
del param
param = lastNode.createStringParam("sep102", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep102 = param
del param
param = lastNode.createSeparatorParam("NAME", "Ls_FXAA_GL v1.0")
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setPersistent(False)
param.setEvaluateOnChange(False)
lastNode.NAME = param
del param
param = lastNode.createStringParam("sep103", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep103 = param
del param
param = lastNode.createStringParam("sep104", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep104 = param
del param
param = lastNode.createSeparatorParam("LINE101", "")
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setPersistent(False)
param.setEvaluateOnChange(False)
lastNode.LINE101 = param
del param
param = lastNode.createStringParam("sep105", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep105 = param
del param
param = lastNode.createStringParam("sep106", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep106 = param
del param
param = lastNode.createSeparatorParam("FR", "ShaderToy 0.8.8")
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setPersistent(False)
param.setEvaluateOnChange(False)
lastNode.FR = param
del param
param = lastNode.createStringParam("sep107", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep107 = param
del param
param = lastNode.createStringParam("sep108", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep108 = param
del param
param = lastNode.createSeparatorParam("CONVERSION", " (Fabrice Fernandez - 2018)")
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setPersistent(False)
param.setEvaluateOnChange(False)
lastNode.CONVERSION = param
del param
param = lastNode.createStringParam("sep109", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep109 = param
del param
param = lastNode.createStringParam("sep110", "")
param.setType(NatronEngine.StringParam.TypeEnum.eStringTypeLabel)
# Add the param to the page
lastNode.Credits.addParam(param)
# Set param properties
param.setHelp("")
param.setAddNewLine(True)
param.setEvaluateOnChange(False)
param.setAnimationEnabled(False)
lastNode.sep110 = param
del param
# Refresh the GUI with the newly created parameters
lastNode.setPagesOrder(['Controls', 'Credits', 'Node', 'Settings'])
lastNode.refreshUserParamsGUI()
del lastNode
# Start of node "Output2"
lastNode = app.createNode("fr.inria.built-in.Output", 1, group)
lastNode.setLabel("Output2")
lastNode.setPosition(4127, 4061)
lastNode.setSize(80, 32)
lastNode.setColor(0.7, 0.7, 0.7)
groupOutput2 = lastNode
del lastNode
# End of node "Output2"
# Start of node "Source"
lastNode = app.createNode("fr.inria.built-in.Input", 1, group)
lastNode.setScriptName("Source")
lastNode.setLabel("Source")
lastNode.setPosition(4127, 3799)
lastNode.setSize(80, 32)
lastNode.setColor(0.3, 0.5, 0.2)
groupSource = lastNode
del lastNode
# End of node "Source"
# Start of node "Shadertoy1"
lastNode = app.createNode("net.sf.openfx.Shadertoy", 1, group)
lastNode.setScriptName("Shadertoy1")
lastNode.setLabel("Shadertoy1")
lastNode.setPosition(4127, 3935)
lastNode.setSize(80, 32)
lastNode.setColor(0.3, 0.5, 0.2)
groupShadertoy1 = lastNode
param = lastNode.getParam("paramValueFloat0")
if param is not None:
param.setValue(1, 0)
del param
param = lastNode.getParam("paramValueFloat1")
if param is not None:
param.setValue(0.75, 0)
del param
param = lastNode.getParam("paramValueFloat2")
if param is not None:
param.setValue(0.005, 0)
del param
param = lastNode.getParam("paramValueFloat3")
if param is not None:
param.setValue(0.04, 0)
del param
param = lastNode.getParam("imageShaderFileName")
if param is not None:
param.setValue("/run/media/root/FABRICE/PERSO/NATRON/GIT_DEV/natron-plugins/Shadertoy/Ls_FXAA.frag.glsl")
del param
param = lastNode.getParam("imageShaderSource")
if param is not None:
param.setValue("//\n//\n// MMMMMMMMMMMMMMMMMMMMMMMMMMMM\n// MM. .MM\n// MM. .MMMMMMMMMMMMMMMMMMMMMM. .MM\n// MM. .MMMMMMMMMMMMMMMMMMMMMMMM. .MM\n// MM. .MMMM MMMMMMM MMM. .MM\n// MM. .MMM MMMMMM MMM. .MM\n// MM. .MmM MMMM MMM. .MM\n// MM. .MMM MM MMM. .MM\n// MM. .MMM M MMM. .MM\n// MM. .MMM MMM. .MM\n// MM. .MMM MMM. .MM\n// MM. .MMM M MMM. .MM\n// MM. .MMM MM MMM. .MM\n// MM. .MMM MMM MMM. .MM\n// MM. .MMM MMMM MMM. .MM\n// MM. .MMMMMMMMMMMMMMMMMMMMMMMM. .MM\n// MM. .MMMMMMMMMMMMMMMMMMMMMM. .MM\n// MM. .MM\n// MMMMMMMMMMMMMMMMMMMMMMMMMMMM\n//\n//\n//\n//\n// Adaptation pour Natron par F. Fernandez\n// Code original : Ls_FXAA Matchbox pour Autodesk Flame\n\n// Adapted to Natron by F.Fernandez\n// Original code : Ls_FXAA Matchbox for Autodesk Flame\n\n\n// FXAA 3.11, fast cheap antialiasing\n// I\'ve modified this to calculate luma on the fly instead of requiring a pre-pass\n// [email protected]\n\n#extension GL_EXT_gpu_shader4 : enable\n#define FXAA_GATHER4_ALPHA 0\n\n\n\nuniform float mixx = 1.0; // Mix : (mix), min=0.0, max=1.0\n\n// Choose the amount of sub-pixel aliasing removal.\n// This can effect sharpness.\n// 1.00 - upper limit (softer)\n// 0.75 - default amount of filtering\n// 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n// 0.25 - almost off\n// 0.00 - completely off\nuniform float fxaaQualitySubpix = 0.75; // Subpixel amount : (amount of sub-pixel aliasing removal, can affect sharpness), min=0, max=1\n\n// The minimum amount of local contrast required to apply algorithm.\n// 0.333 - too little (faster)\n// 0.250 - low quality\n// 0.166 - default\n// 0.125 - high quality \n// 0.063 - overkill (slower)\nuniform float fxaaQualityEdgeThreshold = 0.005; // Edge treshold (minimum amount of local contrast required to apply algorithm), min=0, max=1\n\n// Trims the algorithm from processing darks.\n// 0.0833 - upper limit (default, the start of visible unfiltered edges)\n// 0.0625 - high quality (faster)\n// 0.0312 - visible limit (slower)\nuniform float fxaaQualityEdgeThresholdMin = 0.04; // Dark treshold (tTrims the algorithm from processing darks), min=0.0, max=1.0\n\nconst float greenlumamix = 1.0;\n\n#define FXAA_PC 1\n#define FXAA_GLSL_120 1\n#define FXAA_QUALITY__PRESET 39\n#define FXAA_GREEN_AS_LUMA 0\n\n#ifndef FXAA_PS3\n #define FXAA_PS3 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_360\n #define FXAA_360 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_360_OPT\n #define FXAA_360_OPT 0\n#endif\n/*==========================================================================*/\n#ifndef FXAA_PC\n //\n // FXAA Quality\n // The high quality PC algorithm.\n //\n #define FXAA_PC 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_PC_CONSOLE\n //\n // The console algorithm for PC is included\n // for developers targeting really low spec machines.\n // Likely better to just run FXAA_PC, and use a really low preset.\n //\n #define FXAA_PC_CONSOLE 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_GLSL_120\n #define FXAA_GLSL_120 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_GLSL_130\n #define FXAA_GLSL_130 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_HLSL_3\n #define FXAA_HLSL_3 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_HLSL_4\n #define FXAA_HLSL_4 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_HLSL_5\n #define FXAA_HLSL_5 0\n#endif\n/*==========================================================================*/\n#ifndef FXAA_GREEN_AS_LUMA\n //\n // For those using non-linear color,\n // and either not able to get luma in alpha, or not wanting to,\n // this enables FXAA to run using green as a proxy for luma.\n // So with this enabled, no need to pack luma in alpha.\n //\n // This will turn off AA on anything which lacks some amount of green.\n // Pure red and blue or combination of only R and B, will get no AA.\n //\n // Might want to lower the settings for both,\n // fxaaConsoleEdgeThresholdMin\n // fxaaQualityEdgeThresholdMin\n // In order to insure AA does not get turned off on colors \n // which contain a minor amount of green.\n //\n // 1 = On.\n // 0 = Off.\n //\n #define FXAA_GREEN_AS_LUMA 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_EARLY_EXIT\n //\n // Controls algorithm\'s early exit path.\n // On PS3 turning this ON adds 2 cycles to the shader.\n // On 360 turning this OFF adds 10ths of a millisecond to the shader.\n // Turning this off on console will result in a more blurry image.\n // So this defaults to on.\n //\n // 1 = On.\n // 0 = Off.\n //\n #define FXAA_EARLY_EXIT 1\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_DISCARD\n //\n // Only valid for PC OpenGL currently.\n // Probably will not work when FXAA_GREEN_AS_LUMA = 1.\n //\n // 1 = Use discard on pixels which don\'t need AA.\n // For APIs which enable concurrent TEX+ROP from same surface.\n // 0 = Return unchanged color on pixels which don\'t need AA.\n //\n #define FXAA_DISCARD 0\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_FAST_PIXEL_OFFSET\n //\n // Used for GLSL 120 only.\n //\n // 1 = GL API supports fast pixel offsets\n // 0 = do not use fast pixel offsets\n //\n #ifdef GL_EXT_gpu_shader4\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_FAST_PIXEL_OFFSET 1\n #endif\n #ifndef FXAA_FAST_PIXEL_OFFSET\n #define FXAA_FAST_PIXEL_OFFSET 0\n #endif\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_GATHER4_ALPHA\n //\n // 1 = API supports gather4 on alpha channel.\n // 0 = API does not support gather4 on alpha channel.\n //\n #if (FXAA_HLSL_5 == 1)\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_ARB_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifdef GL_NV_gpu_shader5\n #define FXAA_GATHER4_ALPHA 1\n #endif\n #ifndef FXAA_GATHER4_ALPHA\n #define FXAA_GATHER4_ALPHA 0\n #endif\n#endif\n\n/*============================================================================\n FXAA CONSOLE PS3 - TUNING KNOBS\n============================================================================*/\n#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS\n //\n // Consoles the sharpness of edges on PS3 only.\n // Non-PS3 tuning is done with shader input.\n //\n // Due to the PS3 being ALU bound,\n // there are only two safe values here: 4 and 8.\n // These options use the shaders ability to a free *|/ by 2|4|8.\n //\n // 8.0 is sharper\n // 4.0 is softer\n // 2.0 is really soft (good for vector graphics inputs)\n //\n #if 1\n #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0\n #endif\n #if 0\n #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0\n #endif\n #if 0\n #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0\n #endif\n#endif\n/*--------------------------------------------------------------------------*/\n#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD\n //\n // Only effects PS3.\n // Non-PS3 tuning is done with shader input.\n //\n // The minimum amount of local contrast required to apply algorithm.\n // The console setting has a different mapping than the quality setting.\n //\n // This only applies when FXAA_EARLY_EXIT is 1.\n //\n // Due to the PS3 being ALU bound,\n // there are only two safe values here: 0.25 and 0.125.\n // These options use the shaders ability to a free *|/ by 2|4|8.\n //\n // 0.125 leaves less aliasing, but is softer\n // 0.25 leaves more aliasing, and is sharper\n //\n #if 1\n #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125\n #else\n #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25\n #endif\n#endif\n\n/*============================================================================\n FXAA QUALITY - TUNING KNOBS\n------------------------------------------------------------------------------\nNOTE the other tuning knobs are now in the shader function inputs!\n============================================================================*/\n#ifndef FXAA_QUALITY__PRESET\n //\n // Choose the quality preset.\n // This needs to be compiled into the shader as it effects code.\n // Best option to include multiple presets is to \n // in each shader define the preset, then include this file.\n // \n // OPTIONS\n // -----------------------------------------------------------------------\n // 10 to 15 - default medium dither (10=fastest, 15=highest quality)\n // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality)\n // 39 - no dither, very expensive \n //\n // NOTES\n // -----------------------------------------------------------------------\n // 12 = slightly faster then FXAA 3.9 and higher edge quality (default)\n // 13 = about same speed as FXAA 3.9 and better than 12\n // 23 = closest to FXAA 3.9 visually and performance wise\n // _ = the lowest digit is directly related to performance\n // _ = the highest digit is directly related to style\n // \n #define FXAA_QUALITY__PRESET 12\n#endif\n\n\n/*============================================================================\n\n FXAA QUALITY - PRESETS\n\n============================================================================*/\n\n/*============================================================================\n FXAA QUALITY - MEDIUM DITHER PRESETS\n============================================================================*/\n#if (FXAA_QUALITY__PRESET == 10)\n #define FXAA_QUALITY__PS 3\n #define FXAA_QUALITY__P0 1.5\n #define FXAA_QUALITY__P1 3.0\n #define FXAA_QUALITY__P2 12.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 11)\n #define FXAA_QUALITY__PS 4\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 3.0\n #define FXAA_QUALITY__P3 12.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 12)\n #define FXAA_QUALITY__PS 5\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 4.0\n #define FXAA_QUALITY__P4 12.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 13)\n #define FXAA_QUALITY__PS 6\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 4.0\n #define FXAA_QUALITY__P5 12.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 14)\n #define FXAA_QUALITY__PS 7\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 4.0\n #define FXAA_QUALITY__P6 12.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 15)\n #define FXAA_QUALITY__PS 8\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 2.0\n #define FXAA_QUALITY__P6 4.0\n #define FXAA_QUALITY__P7 12.0\n#endif\n\n/*============================================================================\n FXAA QUALITY - LOW DITHER PRESETS\n============================================================================*/\n#if (FXAA_QUALITY__PRESET == 20)\n #define FXAA_QUALITY__PS 3\n #define FXAA_QUALITY__P0 1.5\n #define FXAA_QUALITY__P1 2.0\n #define FXAA_QUALITY__P2 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 21)\n #define FXAA_QUALITY__PS 4\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 22)\n #define FXAA_QUALITY__PS 5\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 23)\n #define FXAA_QUALITY__PS 6\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 24)\n #define FXAA_QUALITY__PS 7\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 3.0\n #define FXAA_QUALITY__P6 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 25)\n #define FXAA_QUALITY__PS 8\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 2.0\n #define FXAA_QUALITY__P6 4.0\n #define FXAA_QUALITY__P7 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 26)\n #define FXAA_QUALITY__PS 9\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 2.0\n #define FXAA_QUALITY__P6 2.0\n #define FXAA_QUALITY__P7 4.0\n #define FXAA_QUALITY__P8 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 27)\n #define FXAA_QUALITY__PS 10\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 2.0\n #define FXAA_QUALITY__P6 2.0\n #define FXAA_QUALITY__P7 2.0\n #define FXAA_QUALITY__P8 4.0\n #define FXAA_QUALITY__P9 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 28)\n #define FXAA_QUALITY__PS 11\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 2.0\n #define FXAA_QUALITY__P6 2.0\n #define FXAA_QUALITY__P7 2.0\n #define FXAA_QUALITY__P8 2.0\n #define FXAA_QUALITY__P9 4.0\n #define FXAA_QUALITY__P10 8.0\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_QUALITY__PRESET == 29)\n #define FXAA_QUALITY__PS 12\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.5\n #define FXAA_QUALITY__P2 2.0\n #define FXAA_QUALITY__P3 2.0\n #define FXAA_QUALITY__P4 2.0\n #define FXAA_QUALITY__P5 2.0\n #define FXAA_QUALITY__P6 2.0\n #define FXAA_QUALITY__P7 2.0\n #define FXAA_QUALITY__P8 2.0\n #define FXAA_QUALITY__P9 2.0\n #define FXAA_QUALITY__P10 4.0\n #define FXAA_QUALITY__P11 8.0\n#endif\n\n/*============================================================================\n FXAA QUALITY - EXTREME QUALITY\n============================================================================*/\n#if (FXAA_QUALITY__PRESET == 39)\n #define FXAA_QUALITY__PS 12\n #define FXAA_QUALITY__P0 1.0\n #define FXAA_QUALITY__P1 1.0\n #define FXAA_QUALITY__P2 1.0\n #define FXAA_QUALITY__P3 1.0\n #define FXAA_QUALITY__P4 1.0\n #define FXAA_QUALITY__P5 1.5\n #define FXAA_QUALITY__P6 2.0\n #define FXAA_QUALITY__P7 2.0\n #define FXAA_QUALITY__P8 2.0\n #define FXAA_QUALITY__P9 2.0\n #define FXAA_QUALITY__P10 4.0\n #define FXAA_QUALITY__P11 8.0\n#endif\n\n\n\n/*============================================================================\n\n API PORTING\n\n============================================================================*/\n#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)\n #define FxaaBool bool\n #define FxaaDiscard discard\n #define FxaaFloat float\n #define FxaaFloat2 vec2\n #define FxaaFloat3 vec3\n #define FxaaFloat4 vec4\n #define FxaaHalf float\n #define FxaaHalf2 vec2\n #define FxaaHalf3 vec3\n #define FxaaHalf4 vec4\n #define FxaaInt2 ivec2\n #define FxaaSat(x) clamp(x, 0.0, 1.0)\n #define FxaaTex sampler2D\n#else\n #define FxaaBool bool\n #define FxaaDiscard clip(-1)\n #define FxaaFloat float\n #define FxaaFloat2 float2\n #define FxaaFloat3 float3\n #define FxaaFloat4 float4\n #define FxaaHalf half\n #define FxaaHalf2 half2\n #define FxaaHalf3 half3\n #define FxaaHalf4 half4\n #define FxaaSat(x) saturate(x)\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_GLSL_120 == 1)\n // Requires,\n // #version 120\n // And at least,\n // #extension GL_EXT_gpu_shader4 : enable\n // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)\n #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)\n #if (FXAA_FAST_PIXEL_OFFSET == 1)\n #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)\n #else\n #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)\n #endif\n #if (FXAA_GATHER4_ALPHA == 1)\n // use #extension GL_ARB_gpu_shader5 : enable\n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_GLSL_130 == 1)\n // Requires \"#version 130\" or better\n #define FxaaTexTop(t, p) textureLod(t, p, 0.0)\n #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)\n #if (FXAA_GATHER4_ALPHA == 1)\n // use #extension GL_ARB_gpu_shader5 : enable\n #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)\n #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)\n #define FxaaTexGreen4(t, p) textureGather(t, p, 1)\n #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)\n #endif\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1)\n #define FxaaInt2 float2\n #define FxaaTex sampler2D\n #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))\n #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_HLSL_4 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n#endif\n/*--------------------------------------------------------------------------*/\n#if (FXAA_HLSL_5 == 1)\n #define FxaaInt2 int2\n struct FxaaTex { SamplerState smpl; Texture2D tex; };\n #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)\n #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)\n #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)\n #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)\n #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)\n #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)\n#endif\n\n\n/*============================================================================\n GREEN AS LUMA OPTION SUPPORT FUNCTION\n============================================================================*/\n//#if (FXAA_GREEN_AS_LUMA == 0)\n // I changed this. Luma pre-pass seems like too much work for our non-realtime needs\n // [email protected]\n // FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722)); }\n//#else\n// FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; }\n//#endif \n\nFxaaFloat FxaaLuma(FxaaFloat4 rgba) {\n float green = rgba.g;\n float luma = dot(rgba.rgb, vec3(0.2126, 0.7152, 0.0722));\n return mix(green, luma, greenlumamix);\n}\n\n\n/*============================================================================\n\n FXAA3 QUALITY - PC\n\n============================================================================*/\n#if (FXAA_PC == 1)\n/*--------------------------------------------------------------------------*/\nFxaaFloat4 FxaaPixelShader(\n //\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy} = center of pixel\n FxaaFloat2 pos,\n //\n // Used only for FXAA Console, and not used on the 360 version.\n // Use noperspective interpolation here (turn off perspective interpolation).\n // {xy__} = upper left of pixel\n // {__zw} = lower right of pixel\n FxaaFloat4 fxaaConsolePosPos,\n //\n // Input color texture.\n // {rgb_} = color in linear or perceptual color space\n // if (FXAA_GREEN_AS_LUMA == 0)\n // {___a} = luma in perceptual color space (not linear)\n FxaaTex tex,\n //\n // Only used on the optimized 360 version of FXAA Console.\n // For everything but 360, just use the same input here as for \"tex\".\n // For 360, same texture, just alias with a 2nd sampler.\n // This sampler needs to have an exponent bias of -1.\n FxaaTex fxaaConsole360TexExpBiasNegOne,\n //\n // Only used on the optimized 360 version of FXAA Console.\n // For everything but 360, just use the same input here as for \"tex\".\n // For 360, same texture, just alias with a 3nd sampler.\n // This sampler needs to have an exponent bias of -2.\n FxaaTex fxaaConsole360TexExpBiasNegTwo,\n //\n // Only used on FXAA Quality.\n // This must be from a constant/uniform.\n // {x_} = 1.0/screenWidthInPixels\n // {_y} = 1.0/screenHeightInPixels\n FxaaFloat2 fxaaQualityRcpFrame,\n //\n // Only used on FXAA Console.\n // This must be from a constant/uniform.\n // This effects sub-pixel AA quality and inversely sharpness.\n // Where N ranges between,\n // N = 0.50 (default)\n // N = 0.33 (sharper)\n // {x___} = -N/screenWidthInPixels \n // {_y__} = -N/screenHeightInPixels\n // {__z_} = N/screenWidthInPixels \n // {___w} = N/screenHeightInPixels \n FxaaFloat4 fxaaConsoleRcpFrameOpt,\n //\n // Only used on FXAA Console.\n // Not used on 360, but used on PS3 and PC.\n // This must be from a constant/uniform.\n // {x___} = -2.0/screenWidthInPixels \n // {_y__} = -2.0/screenHeightInPixels\n // {__z_} = 2.0/screenWidthInPixels \n // {___w} = 2.0/screenHeightInPixels \n FxaaFloat4 fxaaConsoleRcpFrameOpt2,\n //\n // Only used on FXAA Console.\n // Only used on 360 in place of fxaaConsoleRcpFrameOpt2.\n // This must be from a constant/uniform.\n // {x___} = 8.0/screenWidthInPixels \n // {_y__} = 8.0/screenHeightInPixels\n // {__z_} = -4.0/screenWidthInPixels \n // {___w} = -4.0/screenHeightInPixels \n FxaaFloat4 fxaaConsole360RcpFrameOpt2,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY__SUBPIX define.\n // It is here now to allow easier tuning.\n // Choose the amount of sub-pixel aliasing removal.\n // This can effect sharpness.\n // 1.00 - upper limit (softer)\n // 0.75 - default amount of filtering\n // 0.50 - lower limit (sharper, less sub-pixel aliasing removal)\n // 0.25 - almost off\n // 0.00 - completely off\n FxaaFloat fxaaQualitySubpix,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // The minimum amount of local contrast required to apply algorithm.\n // 0.333 - too little (faster)\n // 0.250 - low quality\n // 0.166 - default\n // 0.125 - high quality \n // 0.063 - overkill (slower)\n FxaaFloat fxaaQualityEdgeThreshold,\n //\n // Only used on FXAA Quality.\n // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // 0.0833 - upper limit (default, the start of visible unfiltered edges)\n // 0.0625 - high quality (faster)\n // 0.0312 - visible limit (slower)\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaQualityEdgeThresholdMin,\n // \n // Only used on FXAA Console.\n // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define.\n // It is here now to allow easier tuning.\n // This does not effect PS3, as this needs to be compiled in.\n // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3.\n // Due to the PS3 being ALU bound,\n // there are only three safe values here: 2 and 4 and 8.\n // These options use the shaders ability to a free *|/ by 2|4|8.\n // For all other platforms can be a non-power of two.\n // 8.0 is sharper (default!!!)\n // 4.0 is softer\n // 2.0 is really soft (good only for vector graphics inputs)\n FxaaFloat fxaaConsoleEdgeSharpness,\n //\n // Only used on FXAA Console.\n // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define.\n // It is here now to allow easier tuning.\n // This does not effect PS3, as this needs to be compiled in.\n // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3.\n // Due to the PS3 being ALU bound,\n // there are only two safe values here: 1/4 and 1/8.\n // These options use the shaders ability to a free *|/ by 2|4|8.\n // The console setting has a different mapping than the quality setting.\n // Other platforms can use other values.\n // 0.125 leaves less aliasing, but is softer (default!!!)\n // 0.25 leaves more aliasing, and is sharper\n FxaaFloat fxaaConsoleEdgeThreshold,\n //\n // Only used on FXAA Console.\n // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define.\n // It is here now to allow easier tuning.\n // Trims the algorithm from processing darks.\n // The console setting has a different mapping than the quality setting.\n // This only applies when FXAA_EARLY_EXIT is 1.\n // This does not apply to PS3, \n // PS3 was simplified to avoid more shader instructions.\n // 0.06 - faster but more aliasing in darks\n // 0.05 - default\n // 0.04 - slower and less aliasing in darks\n // Special notes when using FXAA_GREEN_AS_LUMA,\n // Likely want to set this to zero.\n // As colors that are mostly not-green\n // will appear very dark in the green channel!\n // Tune by looking at mostly non-green content,\n // then start at zero and increase until aliasing is a problem.\n FxaaFloat fxaaConsoleEdgeThresholdMin,\n // \n // Extra constants for 360 FXAA Console only.\n // Use zeros or anything else for other platforms.\n // These must be in physical constant registers and NOT immedates.\n // Immedates will result in compiler un-optimizing.\n // {xyzw} = float4(1.0, -1.0, 0.25, -0.25)\n FxaaFloat4 fxaaConsole360ConstDir\n) {\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posM;\n posM.x = pos.x;\n posM.y = pos.y;\n #if (FXAA_GATHER4_ALPHA == 1)\n #if (FXAA_DISCARD == 0)\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n #if (FXAA_GREEN_AS_LUMA == 0)\n #define lumaM rgbyM.w\n #else\n #define lumaM rgbyM.y\n #endif\n #endif\n #if (FXAA_GREEN_AS_LUMA == 0)\n FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1));\n #else\n FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);\n FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));\n #endif\n #if (FXAA_DISCARD == 1)\n #define lumaM luma4A.w\n #endif\n #define lumaE luma4A.z\n #define lumaS luma4A.x\n #define lumaSE luma4A.y\n #define lumaNW luma4B.w\n #define lumaN luma4B.z\n #define lumaW luma4B.x\n #else\n FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);\n //#if (FXAA_GREEN_AS_LUMA == 0)\n // #define lumaM rgbyM.w\n //#else\n // #define lumaM rgbyM.y\n //#endif\n FxaaFloat lumaM = FxaaLuma(rgbyM);\n FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));\n #endif\n/*--------------------------------------------------------------------------*/\n FxaaFloat maxSM = max(lumaS, lumaM);\n FxaaFloat minSM = min(lumaS, lumaM);\n FxaaFloat maxESM = max(lumaE, maxSM);\n FxaaFloat minESM = min(lumaE, minSM);\n FxaaFloat maxWN = max(lumaN, lumaW);\n FxaaFloat minWN = min(lumaN, lumaW);\n FxaaFloat rangeMax = max(maxWN, maxESM);\n FxaaFloat rangeMin = min(minWN, minESM);\n FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;\n FxaaFloat range = rangeMax - rangeMin;\n FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);\n FxaaBool earlyExit = range < rangeMaxClamped;\n/*--------------------------------------------------------------------------*/\n if(earlyExit)\n #if (FXAA_DISCARD == 1)\n FxaaDiscard;\n #else\n return rgbyM;\n #endif\n/*--------------------------------------------------------------------------*/\n #if (FXAA_GATHER4_ALPHA == 0)\n FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #else\n FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));\n FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));\n #endif\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNS = lumaN + lumaS;\n FxaaFloat lumaWE = lumaW + lumaE;\n FxaaFloat subpixRcpRange = 1.0/range;\n FxaaFloat subpixNSWE = lumaNS + lumaWE;\n FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;\n FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNESE = lumaNE + lumaSE;\n FxaaFloat lumaNWNE = lumaNW + lumaNE;\n FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;\n FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;\n/*--------------------------------------------------------------------------*/\n FxaaFloat lumaNWSW = lumaNW + lumaSW;\n FxaaFloat lumaSWSE = lumaSW + lumaSE;\n FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);\n FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);\n FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;\n FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;\n FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;\n FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;\n/*--------------------------------------------------------------------------*/\n FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;\n FxaaFloat lengthSign = fxaaQualityRcpFrame.x;\n FxaaBool horzSpan = edgeHorz >= edgeVert;\n FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;\n/*--------------------------------------------------------------------------*/\n if(!horzSpan) lumaN = lumaW;\n if(!horzSpan) lumaS = lumaE;\n if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;\n FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;\n/*--------------------------------------------------------------------------*/\n FxaaFloat gradientN = lumaN - lumaM;\n FxaaFloat gradientS = lumaS - lumaM;\n FxaaFloat lumaNN = lumaN + lumaM;\n FxaaFloat lumaSS = lumaS + lumaM;\n FxaaBool pairN = abs(gradientN) >= abs(gradientS);\n FxaaFloat gradient = max(abs(gradientN), abs(gradientS));\n if(pairN) lengthSign = -lengthSign;\n FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posB;\n posB.x = posM.x;\n posB.y = posM.y;\n FxaaFloat2 offNP;\n offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;\n offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;\n if(!horzSpan) posB.x += lengthSign * 0.5;\n if( horzSpan) posB.y += lengthSign * 0.5;\n/*--------------------------------------------------------------------------*/\n FxaaFloat2 posN;\n posN.x = posB.x - offNP.x * FXAA_QUALITY__P0;\n posN.y = posB.y - offNP.y * FXAA_QUALITY__P0;\n FxaaFloat2 posP;\n posP.x = posB.x + offNP.x * FXAA_QUALITY__P0;\n posP.y = posB.y + offNP.y * FXAA_QUALITY__P0;\n FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;\n FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));\n FxaaFloat subpixE = subpixC * subpixC;\n FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));\n/*--------------------------------------------------------------------------*/\n if(!pairN) lumaNN = lumaSS;\n FxaaFloat gradientScaled = gradient * 1.0/4.0;\n FxaaFloat lumaMM = lumaM - lumaNN * 0.5;\n FxaaFloat subpixF = subpixD * subpixE;\n FxaaBool lumaMLTZero = lumaMM < 0.0;\n/*--------------------------------------------------------------------------*/\n lumaEndN -= lumaNN * 0.5;\n lumaEndP -= lumaNN * 0.5;\n FxaaBool doneN = abs(lumaEndN) >= gradientScaled;\n FxaaBool doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1;\n FxaaBool doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1;\n/*--------------------------------------------------------------------------*/\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 3)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 4)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 5)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 6)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 7)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 8)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 9)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 10)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 11)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11;\n/*--------------------------------------------------------------------------*/\n #if (FXAA_QUALITY__PS > 12)\n if(doneNP) {\n if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));\n if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));\n if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;\n if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;\n doneN = abs(lumaEndN) >= gradientScaled;\n doneP = abs(lumaEndP) >= gradientScaled;\n if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12;\n if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12;\n doneNP = (!doneN) || (!doneP);\n if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12;\n if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12;\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n #endif\n/*--------------------------------------------------------------------------*/\n }\n/*--------------------------------------------------------------------------*/\n FxaaFloat dstN = posM.x - posN.x;\n FxaaFloat dstP = posP.x - posM.x;\n if(!horzSpan) dstN = posM.y - posN.y;\n if(!horzSpan) dstP = posP.y - posM.y;\n/*--------------------------------------------------------------------------*/\n FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;\n FxaaFloat spanLength = (dstP + dstN);\n FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;\n FxaaFloat spanLengthRcp = 1.0/spanLength;\n/*--------------------------------------------------------------------------*/\n FxaaBool directionN = dstN < dstP;\n FxaaFloat dst = min(dstN, dstP);\n FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;\n FxaaFloat subpixG = subpixF * subpixF;\n FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;\n FxaaFloat subpixH = subpixG * fxaaQualitySubpix;\n/*--------------------------------------------------------------------------*/\n FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;\n FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);\n if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;\n if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;\n #if (FXAA_DISCARD == 1)\n return FxaaTexTop(tex, posM);\n #else\n return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);\n #endif\n}\n/*==========================================================================*/\n#endif\n\nvoid mainImage( out vec4 fragColor, in vec2 fragCoord )\n{\n vec2 res = vec2(iResolution.x, iResolution.y);\n vec2 coords = fragCoord.xy / res;\n vec4 orig = texture2D(iChannel0, coords);\n vec4 aa = FxaaPixelShader(coords, vec4(0.0), iChannel0, iChannel0, iChannel0,\n vec2(1.0/iResolution.x, 1.0/iResolution.y),\n vec4(0.0), vec4(0.0), vec4(0.0),\n fxaaQualitySubpix, fxaaQualityEdgeThreshold, fxaaQualityEdgeThresholdMin,\n 0.0, 0.0, 0.0, vec4(0.0));\n vec4 mixed = mix(orig, aa, mixx);\n fragColor = vec4(mixed);\n}\n\n/* Adapted from:\n============================================================================\n\n\n NVIDIA FXAA 3.11 by TIMOTHY LOTTES\n\n\n------------------------------------------------------------------------------\nCOPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.\n------------------------------------------------------------------------------\nTO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED\n*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS\nOR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA\nOR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR\nCONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR\nLOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,\nOR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE\nTHIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGES. */\n")
del param
param = lastNode.getParam("inputEnable1")
if param is not None:
param.setValue(False)
del param
param = lastNode.getParam("inputEnable2")
if param is not None:
param.setValue(False)
del param
param = lastNode.getParam("inputEnable3")
if param is not None:
param.setValue(False)
del param
param = lastNode.getParam("bbox")
if param is not None:
param.set("iChannel0")
del param
param = lastNode.getParam("NatronParamFormatChoice")
if param is not None:
param.set("PC_Video")
del param
param = lastNode.getParam("mouseParams")
if param is not None:
param.setValue(False)
del param
param = lastNode.getParam("paramCount")
if param is not None:
param.setValue(4, 0)
del param
param = lastNode.getParam("paramType0")
if param is not None:
param.set("float")
del param
param = lastNode.getParam("paramName0")
if param is not None:
param.setValue("mixx")
del param
param = lastNode.getParam("paramLabel0")
if param is not None:
param.setValue("Mix :")
del param
param = lastNode.getParam("paramHint0")
if param is not None:
param.setValue("mix")
del param
param = lastNode.getParam("paramDefaultFloat0")
if param is not None:
param.setValue(1, 0)
del param
param = lastNode.getParam("paramMinFloat0")
if param is not None:
param.setValue(0, 0)
del param
param = lastNode.getParam("paramMaxFloat0")
if param is not None:
param.setValue(1, 0)
del param
param = lastNode.getParam("paramType1")
if param is not None:
param.set("float")
del param
param = lastNode.getParam("paramName1")
if param is not None:
param.setValue("fxaaQualitySubpix")
del param
param = lastNode.getParam("paramLabel1")
if param is not None:
param.setValue("Subpixel amount :")
del param
param = lastNode.getParam("paramHint1")
if param is not None:
param.setValue("amount of sub-pixel aliasing removal, can affect sharpness")
del param
param = lastNode.getParam("paramDefaultFloat1")
if param is not None:
param.setValue(0.75, 0)
del param
param = lastNode.getParam("paramMinFloat1")
if param is not None:
param.setValue(0, 0)
del param
param = lastNode.getParam("paramMaxFloat1")
if param is not None:
param.setValue(1, 0)
del param
param = lastNode.getParam("paramType2")
if param is not None:
param.set("float")
del param
param = lastNode.getParam("paramName2")
if param is not None:
param.setValue("fxaaQualityEdgeThreshold")
del param
param = lastNode.getParam("paramLabel2")
if param is not None:
param.setValue("Edge treshold")
del param
param = lastNode.getParam("paramHint2")
if param is not None:
param.setValue("minimum amount of local contrast required to apply algorithm")
del param
param = lastNode.getParam("paramDefaultFloat2")
if param is not None:
param.setValue(0.005, 0)
del param
param = lastNode.getParam("paramMinFloat2")
if param is not None:
param.setValue(0, 0)
del param
param = lastNode.getParam("paramMaxFloat2")
if param is not None:
param.setValue(1, 0)
del param
param = lastNode.getParam("paramType3")
if param is not None:
param.set("float")
del param
param = lastNode.getParam("paramName3")
if param is not None:
param.setValue("fxaaQualityEdgeThresholdMin")
del param
param = lastNode.getParam("paramLabel3")
if param is not None:
param.setValue("Dark treshold")
del param
param = lastNode.getParam("paramHint3")
if param is not None:
param.setValue("tTrims the algorithm from processing darks")
del param
param = lastNode.getParam("paramDefaultFloat3")
if param is not None:
param.setValue(0.04, 0)
del param
param = lastNode.getParam("paramMinFloat3")
if param is not None:
param.setValue(0, 0)
del param
param = lastNode.getParam("paramMaxFloat3")
if param is not None:
param.setValue(1, 0)
del param
del lastNode
# End of node "Shadertoy1"
# Now that all nodes are created we can connect them together, restore expressions
groupOutput2.connectInput(0, groupShadertoy1)
groupShadertoy1.connectInput(0, groupSource)
param = groupShadertoy1.getParam("paramValueFloat0")
group.getParam("Shadertoy1paramValueFloat0").setAsAlias(param)
del param
param = groupShadertoy1.getParam("paramValueFloat1")
group.getParam("Shadertoy1paramValueFloat1").setAsAlias(param)
del param
param = groupShadertoy1.getParam("paramValueFloat2")
group.getParam("Shadertoy1paramValueFloat2").setAsAlias(param)
del param
param = groupShadertoy1.getParam("paramValueFloat3")
group.getParam("Shadertoy1paramValueFloat3").setAsAlias(param)
del param
try:
extModule = sys.modules["Ls_FXAA_GLExt"]
except KeyError:
extModule = None
if extModule is not None and hasattr(extModule ,"createInstanceExt") and hasattr(extModule.createInstanceExt,"__call__"):
extModule.createInstanceExt(app,group)