Dmitry Shin 9 years ago
commit
12c5864716
60 changed files with 14978 additions and 0 deletions
  1. 2 0
      .gitignore
  2. 224 0
      Data Folder/Ini/OblivionReloadedEsp.ini
  3. 226 0
      Data Folder/OBSE/plugins/OblivionReloaded.ini
  4. 21 0
      Data Folder/Shaders/OblivionReloaded/AmbientOcclusion/AmbientOcclusion.ini
  5. 17 0
      Data Folder/Shaders/OblivionReloaded/Coloring/Coloring.ini
  6. 35 0
      Data Folder/Shaders/OblivionReloaded/DepthOfField/DepthOfField.ini
  7. 10 0
      Data Folder/Shaders/OblivionReloaded/Grass/Grass.ini
  8. 119 0
      Data Folder/Shaders/OblivionReloaded/Water/Water.ini
  9. 86 0
      Game Folder/SweetFX/Game_compability.txt
  10. 64 0
      Game Folder/SweetFX/Making shaders.txt
  11. 173 0
      Game Folder/SweetFX/Presets/Battlefield 3_Derko1.txt
  12. 127 0
      Game Folder/SweetFX/Presets/Black_Mesa_CeeJay.txt
  13. 266 0
      Game Folder/SweetFX/Presets/Default_1.5_settings.txt
  14. 151 0
      Game Folder/SweetFX/Presets/Mount&Blade_Warband_TFL.txt
  15. 121 0
      Game Folder/SweetFX/Presets/Torchlight2_BetA.txt
  16. 122 0
      Game Folder/SweetFX/Presets/Torchlight2_TFL.txt
  17. 249 0
      Game Folder/SweetFX/Shaders/AdvancedCRT.h
  18. 54 0
      Game Folder/SweetFX/Shaders/Bloom.h
  19. 38 0
      Game Folder/SweetFX/Shaders/Border.h
  20. 24 0
      Game Folder/SweetFX/Shaders/Cartoon.h
  21. 223 0
      Game Folder/SweetFX/Shaders/Curves.h
  22. 23 0
      Game Folder/SweetFX/Shaders/Custom.h
  23. 74 0
      Game Folder/SweetFX/Shaders/DPX.h
  24. 193 0
      Game Folder/SweetFX/Shaders/Dither.h
  25. 23 0
      Game Folder/SweetFX/Shaders/Explosion.h
  26. 749 0
      Game Folder/SweetFX/Shaders/Fxaa3_11.h
  27. 47 0
      Game Folder/SweetFX/Shaders/HDR.h
  28. 24 0
      Game Folder/SweetFX/Shaders/Levels.h
  29. 29 0
      Game Folder/SweetFX/Shaders/LiftGammaGain.h
  30. 217 0
      Game Folder/SweetFX/Shaders/LumaSharpen.h
  31. 325 0
      Game Folder/SweetFX/Shaders/Main.h
  32. 17 0
      Game Folder/SweetFX/Shaders/Monochrome.h
  33. 1370 0
      Game Folder/SweetFX/Shaders/SMAA.h
  34. 31 0
      Game Folder/SweetFX/Shaders/Sepia.h
  35. 61 0
      Game Folder/SweetFX/Shaders/Splitscreen.h
  36. 20 0
      Game Folder/SweetFX/Shaders/SweetCRT.h
  37. 35 0
      Game Folder/SweetFX/Shaders/Technicolor.h
  38. 44 0
      Game Folder/SweetFX/Shaders/Tonemap.h
  39. 41 0
      Game Folder/SweetFX/Shaders/Vibrance.h
  40. 93 0
      Game Folder/SweetFX/Shaders/Vignette.h
  41. 10 0
      Game Folder/SweetFX/SweetFX_compatibility_settings.txt
  42. BIN
      Game Folder/SweetFX/dlls/SMAA dlls/dxgi.dll
  43. 2 0
      Game Folder/SweetFX_preset.txt
  44. 265 0
      Game Folder/SweetFX_settings.txt
  45. 376 0
      Game Folder/d3d9.fx
  46. BIN
      Game Folder/dxgi.dll
  47. 386 0
      Game Folder/dxgi.fx
  48. 918 0
      Game Folder/effect.txt
  49. 35 0
      Game Folder/effect.txt.ini
  50. 603 0
      Game Folder/enbbloom.fx
  51. 704 0
      Game Folder/enbeffect.fx
  52. 848 0
      Game Folder/enbeffectprepass.fx
  53. BIN
      Game Folder/enbpalette.bmp
  54. BIN
      Game Folder/enbraindrops.tga
  55. 201 0
      Game Folder/enbseries.ini
  56. 4804 0
      Game Folder/enbsunsprite.fx
  57. BIN
      Game Folder/enbsunsprite.tga
  58. 22 0
      Game Folder/injector.ini
  59. BIN
      Game Folder/sweetfx_d3d9.dll
  60. 36 0
      README.md

+ 2 - 0
.gitignore

@@ -0,0 +1,2 @@
+d3d9.dll
+/SS

+ 224 - 0
Data Folder/Ini/OblivionReloadedEsp.ini

@@ -0,0 +1,224 @@
+; Oblivion Reloaded configuration file for the esp (v5.0.0).
+; NOTE: This file manages only the esp's features (realized by the CSE scripting).
+; Use the OblivionReloaded.ini in the OBSE plugin folder to manage the plugin's options.
+
+; Hotkeys. Use the "Dec" value from the list below.
+; Hex  Dec  Button
+; 0x01     1  Escape
+; 0x02     2  1
+; 0x03     3  2
+; 0x04     4  3
+; 0x05     5  4
+; 0x06     6  5
+; 0x07     7  6
+; 0x08     8  7
+; 0x09     9  8
+; 0x0A    10  9
+; 0x0B    11  0
+; 0x0C    12  Minus
+; 0x0D    13  Equals
+; 0x0E    14  Backspace
+; 0x0F    15  Tab
+; 0x10    16  Q
+; 0x11    17  W
+; 0x12    18  E
+; 0x13    19  R
+; 0x14    20  T
+; 0x15    21  Y
+; 0x16    22  U
+; 0x17    23  I
+; 0x18    24  O
+; 0x19    25  P
+; 0x1A    26  Left Bracket
+; 0x1B    27  Right Bracket
+; 0x1C    28  Enter
+; 0x1D    29  Left Control
+; 0x1E    30  A
+; 0x1F    31  S
+; 0x20    32  D
+; 0x21    33  F
+; 0x22    34  G
+; 0x23    35  H
+; 0x24    36  J
+; 0x25    37  K
+; 0x26    38  L
+; 0x27    39  Semicolon
+; 0x28    40  Apostrophe
+; 0x29    41  ~ (Console)
+; 0x2A    42  Left Shift
+; 0x2B    43  Back Slash
+; 0x2C    44  Z
+; 0x2D    45  X
+; 0x2E    46  C
+; 0x2F    47  V
+; 0x30    48  B
+; 0x31    49  N
+; 0x32    50  M
+; 0x33    51  Comma
+; 0x34    52  Period
+; 0x35    53  Forward Slash  
+; 0x36    54  Right Shift
+; 0x37    55  NUM*
+; 0x38    56  Left Alt
+; 0x39    57  Spacebar
+; 0x3A    58  Caps Lock
+; 0x3B    59  F1
+; 0x3C    60  F2
+; 0x3D    61  F3
+; 0x3E    62  F4
+; 0x3F    63  F5
+; 0x40    64  F6
+; 0x41    65  F7
+; 0x42    66  F8
+; 0x43    67  F9
+; 0x44    68  F10
+; 0x45    69  Num Lock
+; 0x46    70  Scroll Lock
+; 0x47    71  NUM7
+; 0x48    72  NUM8
+; 0x49    73  NUM9
+; 0x4A    74  NUM-
+; 0x4B    75  NUM4
+; 0x4C    76  NUM5
+; 0x4D    77  NUM6
+; 0x4E    78  NUM+
+; 0x4F    79  NUM1
+; 0x50    80  NUM2
+; 0x51    81  NUM3
+; 0x52    82  NUM0
+; 0x53    83  NUM.
+; 0x57    87  F11
+; 0x58    88  F12
+; 0x9C   156  NUM Enter
+; 0x9D   157  Right Control
+; 0xB5   181  NUM/
+; 0xB8   184  Right Alt
+; 0xC7   199  Home
+; 0xC8   200  Up Arrow
+; 0xC9   201  PgUp
+; 0xCB   203  Left Arrow
+; 0xCD   205  Right Arrow
+; 0xCF   207  End
+; 0xD0   208  Down Arrow
+; 0xD1   209  PgDown
+; 0xD2   210  Insert
+; 0xD3   211  Delete
+; 0x100  256  Left Mouse Button
+; 0x101  257  Right Mouse Button
+; 0x102  258  Middle/Wheel Mouse Button
+; 0x103  259  Mouse Button 3
+; 0x104  260  Mouse Button 4
+; 0x105  261  Mouse Button 5
+; 0x106  262  Mouse Button 6
+; 0x107  263  Mouse Button 7
+; 0x108  264  Mouse Wheel Up
+; 0x109  265  Mouse Wheel Down
+
+; ------------------------------------------
+; --------- Loader configuration -----------
+; ------------------------------------------
+; Enables/disables the memory purger (cleans the memory from the garbage to avoid CTD for out of memory)
+set ORLoaderQuest.Purger to 0
+
+; Enables/disables the external camera (uses camera views that you can change by a custom key)
+set ORLoaderQuest.ExternalCamera to 0
+
+; Enables/disables the "stay on target" when combat (target is tracked from the first hit until the combat is finished or if you press the release key)
+set ORLoaderQuest.StayOnTarget to 0
+
+; Enables/disables the sound effects when the health and/or fatigue are low
+set ORLoaderQuest.LowHFSound to 1
+
+; Enables/disables the dual wielding combat (when enabled allow to equip the left weapon and attack also by the left weapon)
+; NOTE: EquipmentMode MUST be enabled in the plugin configuration to use this feature. 
+set ORLoaderQuest.DualWielding to 1
+
+; Enables/disables the auto-equipping/auto-unequipping when combat (the chosen equipment is equipped on entering combat and viceversa)
+set ORLoaderQuest.CombatEquipment to 0
+
+; Enables/disables the auto-equipping/auto-unequipping when swimming (the chosen equipment is equipped on swimming and viceversa)
+set ORLoaderQuest.SwimEquipment to 1
+
+; Enables/disables the auto-equipping/auto-unequipping when sleeping (the chosen equipment is equipped on sleeping/resting and viceversa)
+set ORLoaderQuest.SleepEquipment to 1
+
+; ------------------------------------------
+; ---------- Purger configuration ----------
+; ------------------------------------------
+; Sets the key to purge manually
+set ORPurgerQuest.PurgeKey to 88
+
+; Sets when purger runs. 0 = Disabled, any other positive value to run every PurgeTime (in seconds).
+set ORPurgerQuest.PurgeTime to 300
+
+; Purges the textures from the video memory. 0 = Disabled, 1 = Enabled.
+set ORPurgerQuest.PurgeTextures to 1
+
+; Purges the cells from the ram. 0 = Disabled, 1 = Enabled.
+set ORPurgerQuest.PurgeCells to 1
+
+; ------------------------------------------
+; ------ StayOnTarget configuration --------
+; ------------------------------------------
+
+; Sets the key to release the target
+set ORStayOnTargetQuest.ReleaseTargetKey to 57
+
+; ------------------------------------------
+; ------ Dual Wielding configuration -------
+; ------------------------------------------
+; Sets the key to switch between left and right attack mode when a left hand weapon is equipped
+set ORDualWieldingQuest.LeftAttackKey to 46
+
+; ------------------------------------------
+; ----- External camera configuration ------
+; ------------------------------------------
+; Sets the key to cycle the camera views
+set ORExternalCameraQuest.CameraKey to 34
+
+; Sets the key to restore the default view
+set ORExternalCameraQuest.CancelCameraKey to 35
+
+; This adds views.
+; PosX Right/left
+; PosY Forward/backward
+; PosZ Up/down
+; AngX Pitch
+; AngY Roll
+; AngZ Yaw
+
+; Back left
+set ORExternalCameraQuest.PosX to -60
+set ORExternalCameraQuest.PosY to -120
+set ORExternalCameraQuest.PosZ to 20
+set ORExternalCameraQuest.AngX to 0
+set ORExternalCameraQuest.AngY to 0
+set ORExternalCameraQuest.AngZ to 0
+SetStage ORExternalCameraQuest 10
+
+; Back right
+set ORExternalCameraQuest.PosX to 60
+set ORExternalCameraQuest.PosY to -120
+set ORExternalCameraQuest.PosZ to 20
+set ORExternalCameraQuest.AngX to 0
+set ORExternalCameraQuest.AngY to 0
+set ORExternalCameraQuest.AngZ to 0
+SetStage ORExternalCameraQuest 10
+
+; From right
+set ORExternalCameraQuest.PosX to 800
+set ORExternalCameraQuest.PosY to 0
+set ORExternalCameraQuest.PosZ to 100
+set ORExternalCameraQuest.AngX to 0
+set ORExternalCameraQuest.AngY to 0
+set ORExternalCameraQuest.AngZ to 60
+SetStage ORExternalCameraQuest 10
+
+; Panoramic view back right
+set ORExternalCameraQuest.PosX to 2400
+set ORExternalCameraQuest.PosY to -1400
+set ORExternalCameraQuest.PosZ to 1600
+set ORExternalCameraQuest.AngX to -10
+set ORExternalCameraQuest.AngY to 0
+set ORExternalCameraQuest.AngZ to 60
+SetStage ORExternalCameraQuest 10

+ 226 - 0
Data Folder/OBSE/plugins/OblivionReloaded.ini

@@ -0,0 +1,226 @@
+; Keycodes. Use the "Dec" value from the list below.
+; Hex    Dec  Button
+; 0x01     1  Escape
+; 0x02     2  1
+; 0x03     3  2
+; 0x04     4  3
+; 0x05     5  4
+; 0x06     6  5
+; 0x07     7  6
+; 0x08     8  7
+; 0x09     9  8
+; 0x0A    10  9
+; 0x0B    11  0
+; 0x0C    12  Minus
+; 0x0D    13  Equals
+; 0x0E    14  Backspace
+; 0x0F    15  Tab
+; 0x10    16  Q
+; 0x11    17  W
+; 0x12    18  E
+; 0x13    19  R
+; 0x14    20  T
+; 0x15    21  Y
+; 0x16    22  U
+; 0x17    23  I
+; 0x18    24  O
+; 0x19    25  P
+; 0x1A    26  Left Bracket
+; 0x1B    27  Right Bracket
+; 0x1C    28  Enter
+; 0x1D    29  Left Control
+; 0x1E    30  A
+; 0x1F    31  S
+; 0x20    32  D
+; 0x21    33  F
+; 0x22    34  G
+; 0x23    35  H
+; 0x24    36  J
+; 0x25    37  K
+; 0x26    38  L
+; 0x27    39  Semicolon
+; 0x28    40  Apostrophe
+; 0x29    41  ~ (Console)
+; 0x2A    42  Left Shift
+; 0x2B    43  Back Slash
+; 0x2C    44  Z
+; 0x2D    45  X
+; 0x2E    46  C
+; 0x2F    47  V
+; 0x30    48  B
+; 0x31    49  N
+; 0x32    50  M
+; 0x33    51  Comma
+; 0x34    52  Period
+; 0x35    53  Forward Slash  
+; 0x36    54  Right Shift
+; 0x37    55  NUM*
+; 0x38    56  Left Alt
+; 0x39    57  Spacebar
+; 0x3A    58  Caps Lock
+; 0x3B    59  F1
+; 0x3C    60  F2
+; 0x3D    61  F3
+; 0x3E    62  F4
+; 0x3F    63  F5
+; 0x40    64  F6
+; 0x41    65  F7
+; 0x42    66  F8
+; 0x43    67  F9
+; 0x44    68  F10
+; 0x45    69  Num Lock
+; 0x46    70  Scroll Lock
+; 0x47    71  NUM7
+; 0x48    72  NUM8
+; 0x49    73  NUM9
+; 0x4A    74  NUM-
+; 0x4B    75  NUM4
+; 0x4C    76  NUM5
+; 0x4D    77  NUM6
+; 0x4E    78  NUM+
+; 0x4F    79  NUM1
+; 0x50    80  NUM2
+; 0x51    81  NUM3
+; 0x52    82  NUM0
+; 0x53    83  NUM.
+; 0x57    87  F11
+; 0x58    88  F12
+; 0x9C   156  NUM Enter
+; 0x9D   157  Right Control
+; 0xB5   181  NUM/
+; 0xB8   184  Right Alt
+; 0xC7   199  Home
+; 0xC8   200  Up Arrow
+; 0xC9   201  PgUp
+; 0xCB   203  Left Arrow
+; 0xCD   205  Right Arrow
+; 0xCF   207  End
+; 0xD0   208  Down Arrow
+; 0xD1   209  PgDown
+; 0xD2   210  Insert
+; 0xD3   211  Delete
+; 0x100  256  Left Mouse Button
+; 0x101  257  Right Mouse Button
+; 0x102  258  Middle/Wheel Mouse Button
+; 0x103  259  Mouse Button 3
+; 0x104  260  Mouse Button 4
+; 0x105  261  Mouse Button 5
+; 0x106  262  Mouse Button 6
+; 0x107  263  Mouse Button 7
+; 0x108  264  Mouse Wheel Up
+; 0x109  265  Mouse Wheel Down
+
+[Main]
+WindowedMode             = 1
+FoV                      = 90
+WaterReflectionMapSize   = 512
+WaterManagement          = 1
+AnisotropicFilter        = 2
+FarPlaneDistance         = 283840.0
+ScreenshotPath           = \Screenshots
+ScreenshotType           = 1
+ScreenshotKey            = 87
+FPSOverlay               = 0
+ShaderProfile            = 7
+CustomEffects            = 0
+FrameRate                = 1
+SaveSettings             = 0
+CombatMode               = 0
+CameraMode               = 0
+EquipmentMode            = 0
+SleepingMode             = 0
+GrassMode                = 1
+
+[FrameRate]
+Average                  = 35
+Gap                      = 3
+Delay                    = 10
+FadeStep                 = 0.5
+FadeMinObjects           = 10
+FadeMinActors            = 15
+GridStep                 = 2
+GridMin                  = 4
+
+[CameraMode]
+HUDReticle               = 2
+ChasingFirst             = 0
+ChasingThird             = 0
+OffsetX                  = 0
+OffsetY                  = 15
+OffsetZ                  = 4
+NearDistanceFirst        = 2
+NearDistanceThird        = 10
+DialogFirst              = 1
+DialogThird              = 2
+DialogOffsetX            = 50.0
+DialogOffsetY            = -10.0
+DialogOffsetZ            = 10.0
+
+[SleepingMode]
+Rest                     = 0
+RestMessage              = You must be in a bed to rest.
+
+[Shaders]
+EnableWater              = 1
+EnableGrass              = 1
+EnablePrecipitations     = 1
+EnableHDR                = 0
+EnablePOM                = 0
+EnableSkin               = 0
+EnableTerrain            = 1
+EnableBlood              = 1
+EnableShadows            = 0
+
+[Effects]
+EnableUnderwater         = 1
+EnableWaterLens          = 1
+EnableGodRays            = 1
+EnableDepthOfField       = 1
+EnableAmbientOcclusion   = 1
+EnableColoring           = 1
+EnableCinema             = 0
+EnableBloom              = 0
+EnableSnowAccumulation   = 0
+EnableBloodLens          = 0
+EnableMotionBlur         = 0
+EnableLowHF              = 0
+EnableWetWorld           = 0
+EnableSharpening         = 0
+EnableSMAA               = 0
+
+[Menu]
+Font                     = Calibri
+TextColorNormal          = 180,180,180
+TextShadowColorNormal    = 50,50,50
+TextColorSelected        = 255,255,255
+TextShadowColorSelected  = 50,50,50
+TextColorEditing         = 255,100,50
+TextShadowColorEditing   = 50,50,50
+TextSize                 = 22
+TitleX                   = 60
+TitleY                   = 120
+TitleRect                = 800
+X                        = 80
+Y                        = 160
+Rect                     = 250
+ExtraRect                = 50
+RowSpace                 = 4
+RowsPerPage              = 30
+KeyEnable                = 210
+KeyUp                    = 200
+KeyDown                  = 208
+KeyLeft                  = 203
+KeyRight                 = 205
+KeyPageUp                = 201
+KeyPageDown              = 209
+KeyAdd                   = 78
+KeySubtract              = 74
+KeySave                  = 28
+KeyEditing               = 57
+StepValue                = 0.1
+Decimals                 = 3
+
+[Develop]
+CompileShaders           = 0
+CompileEffects           = 0
+TraceShaders             = 0

+ 21 - 0
Data Folder/Shaders/OblivionReloaded/AmbientOcclusion/AmbientOcclusion.ini

@@ -0,0 +1,21 @@
+[Exterior]
+Enabled              = 1
+RadiusMultiplier     = 16
+StrengthMultiplier   = 0.7
+ClampStrength        = 0.5
+AngleBias            = 15
+Range                = 100
+LumThreshold         = 0.18
+BlurDropThreshold    = 100
+BlurRadiusMultiplier = 1.0
+
+[Interior]
+Enabled              = 1
+RadiusMultiplier     = 16
+StrengthMultiplier   = 0.8
+ClampStrength        = 0.5
+AngleBias            = 15
+Range                = 100
+LumThreshold         = 0.1
+BlurDropThreshold    = 100
+BlurRadiusMultiplier = 1.0

+ 17 - 0
Data Folder/Shaders/OblivionReloaded/Coloring/Coloring.ini

@@ -0,0 +1,17 @@
+[Default]
+Strength      = 0.6
+BaseGamma     = 1.6
+Fade          = 0.0
+Contrast      = 1.0
+Saturation    = -0.3
+Bleach        = 0.1
+BleachLuma    = 0.0
+ColorCurve    = 1.2
+ColorCurveR   = 0.9
+ColorCurveG   = 1.0
+ColorCurveB   = 1.0
+EffectGamma   = 0.9
+EffectGammaR  = 1.0
+EffectGammaG  = 1.0
+EffectGammaB  = 1.0
+Linearization = 1.1

+ 35 - 0
Data Folder/Shaders/OblivionReloaded/DepthOfField/DepthOfField.ini

@@ -0,0 +1,35 @@
+[FirstPersonView]
+Enabled               = 1
+DialogMode            = 0
+DistantBlur           = 1
+DistantBlurStartRange = 50
+DistantBlurEndRange   = 400
+BaseBlurRadius        = 0.15
+BlurFallOff           = 2.0
+Radius                = 8.0
+DiameterRange         = 0.009
+NearBlurCutOff        = 0.8
+
+[ThirdPersonView]
+Enabled               = 1
+DialogMode            = 0
+DistantBlur           = 1
+DistantBlurStartRange = 50
+DistantBlurEndRange   = 400
+BaseBlurRadius        = 0.25
+BlurFallOff           = 2.5
+Radius                = 6.0
+DiameterRange         = 0.009
+NearBlurCutOff        = 0.8
+
+[VanityView]
+Enabled               = 1
+DialogMode            = 0
+DistantBlur           = 1
+DistantBlurStartRange = 50
+DistantBlurEndRange   = 400
+BaseBlurRadius        = 0.25
+BlurFallOff           = 2.5
+Radius                = 6.0
+DiameterRange         = 0.009
+NearBlurCutOff        = 0.8

+ 10 - 0
Data Folder/Shaders/OblivionReloaded/Grass/Grass.ini

@@ -0,0 +1,10 @@
+[Default]
+WindEnabled     = 1
+WindCoefficient = 100.0
+GrassDensity    = 6
+ScaleX          = 2.0
+ScaleY          = 2.0
+ScaleZ          = 1.0
+MinHeight       = 1.0
+MinDistance     = 9000.0
+MaxDistance     = 11000.0

+ 119 - 0
Data Folder/Shaders/OblivionReloaded/Water/Water.ini

@@ -0,0 +1,119 @@
+[Default]
+IceEnabled        = 1
+choppiness        = 0.8
+waveWidth         = 1.8
+waveSpeed         = 0.6
+reflectivity      = 1.2
+causticsStrength  = 0.5
+shoreFactor       = 1.5
+turbidity         = 0.6
+inScattCoeff      = 0.26
+inExtCoeff_R      = 0.4
+inExtCoeff_G      = 0.26
+inExtCoeff_B      = 0.26
+depthDarkness     = 0.1
+IceinExtCoeff_R   = 0.22
+IceinExtCoeff_G   = 0.18
+IceinExtCoeff_B   = 0.18
+Icechoppiness     = 0.2
+IcewaveWidth      = 3.6
+Icereflectivity   = 1.6
+IceshoreFactor    = 0.4
+Iceturbidity      = 1.4
+LODdistance       = 1
+MinLOD            = 0.1
+LensTimeMultA     = 0.1
+LensTimeMultB     = 0.2
+LensTime          = 180
+LensAmount        = 0.1
+LensViscosity     = 0.05
+
+[Blood]
+choppiness        = 0.8
+waveWidth         = 0.200001
+waveSpeed         = 0.3
+reflectivity      = 0.5
+causticsStrength  = 0.5
+shoreFactor       = 1
+turbidity         = 0.500005
+inScattCoeff      = -0.04
+inExtCoeff_R      = 0.35
+inExtCoeff_G      = 0.29
+inExtCoeff_B      = 0.34
+depthDarkness     = 0.1
+Icechoppiness= 0.2
+IceEnabled= 1
+IceinExtCoeff_B= 0.34
+IceinExtCoeff_G= 0.16
+IceinExtCoeff_R= 0.36
+Icereflectivity= 1.6
+IceshoreFactor= 0.4
+Iceturbidity= 1.4
+IcewaveWidth= 3.6
+LensAmount= 0.1
+LensTime= 180
+LensTimeMultA= 0.1
+LensTimeMultB= 0.2
+LensViscosity= 0.05
+LODdistance= 1
+MinLOD= 0.1
+
+[Lava]
+choppiness        = 0.4
+waveWidth         = 4
+waveSpeed         = 0.2
+reflectivity      = 0.4
+causticsStrength  = 0.1
+shoreFactor       = 0.5
+turbidity         = 8
+inScattCoeff      = 0.08
+inExtCoeff_R      = 0.05
+inExtCoeff_G      = 0.35
+inExtCoeff_B      = 0.9
+depthDarkness     = 0.4
+Icechoppiness= 0.2
+IceEnabled= 1
+IceinExtCoeff_B= 0.18
+IceinExtCoeff_G= 0.18
+IceinExtCoeff_R= 0.22
+Icereflectivity= 1.6
+IceshoreFactor= 0.4
+Iceturbidity= 1.4
+IcewaveWidth= 3.6
+LensAmount= 0.1
+LensTime= 180
+LensTimeMultA= 0.1
+LensTimeMultB= 0.2
+LensViscosity= 0.05
+LODdistance= 1
+MinLOD= 0.1
+
+[BravilWorld]
+choppiness        = 0.5
+waveWidth         = 1.8
+waveSpeed         = 0.3
+reflectivity      = 0.4
+causticsStrength  = 0.5
+shoreFactor       = 0.3
+turbidity         = 2.24
+inScattCoeff      = 0.12
+inExtCoeff_R      = 0.28
+inExtCoeff_G      = 0.32
+inExtCoeff_B      = 0.62
+depthDarkness     = 0.2
+Icechoppiness= 0.2
+IceEnabled= 1
+IceinExtCoeff_B= 0.18
+IceinExtCoeff_G= 0.18
+IceinExtCoeff_R= 0.22
+Icereflectivity= 1.6
+IceshoreFactor= 0.4
+Iceturbidity= 1.4
+IcewaveWidth= 3.6
+LensAmount= 0.1
+LensTime= 180
+LensTimeMultA= 0.1
+LensTimeMultB= 0.2
+LensViscosity= 0.05
+LODdistance= 1
+MinLOD= 0.1

+ 86 - 0
Game Folder/SweetFX/Game_compability.txt

@@ -0,0 +1,86 @@
+   /*-----------------------------------------------------------.   
+  /           Compability notes for specific games              /
+  '-----------------------------------------------------------*/
+
+Note : There are many more .. and probably better updated game notes in the SweetFX Settings Database at http://sfx.thelazy.net/games/
+
+ ** Crysis **
+Install SweetFX to the main Crysis folder, but move d3d9.dll , dxgi.dll and injector.ini to the bin32 folder.
+
+Then create an autoexec.cfg file in the main Crysis 2 folder and paste the following text into it.
+ 
+r_FSAA = 0
+r_UseEdgeAA = 0
+
+This disables all forms of ingame AA, allowing the injector to work.
+
+Run the game using the 32bit executable - Not the 64bit executable as SweetFX is not compatible with 64bit executables.
+
+ 
+ ** Crysis 2 **
+Install SweetFX to the main Crysis 2 folder, but move d3d9.dll , dxgi.dll and injector.ini to the bin32 folder.
+
+Then create an autoexec.cfg file in the main Crysis 2 folder and paste the following text into it.
+ 
+r_FSAA = 0
+r_UseEdgeAA = 0
+r_PostMSAA = 0
+
+This disables all forms of ingame AA, allowing the injector to work.
+
+
+** DOTA 2 beta** 
+(installs like most Source games)
+
+Install SweetFX to
+\Steam\steamapps\common\dota 2 beta\
+
+but put d3d9.dll and injector.ini in
+\Steam\steamapps\common\dota 2 beta\bin
+
+For source games dxgi.dll and dxgi.fx are not needed as it's a DirectX9 engine so you can delete them if you want or leave them be - it doesn't matter.
+
+
+ ** Gears of War **
+Gears of War specifically checks for modifications to either its own code or any of the components it uses.
+If you try to use SweetFX with Gears of War you get the error :
+"d3d9.dll: You cannot run the game with modified executable code. Please reinstall the game"
+
+There is no known workaround. Gears is War is not compatible with SweetFX.
+Uninstall SweetFX from the Gears of War directory to be able to play it again.
+
+
+ ** Guild Wars **
+Disable anti-aliasing in-game to allow SweetFX to work.
+
+
+ ** Psychonauts **
+Disable FSAA anti-aliasing in-game to allow SweetFX to work.
+
+
+** Source SDK 2007 based mods ** 
+(like Black Mesa)
+
+!! Just before the release of SweetFX 1.5, Valve changed many of the Source based games and the install paths changed as well.
+I have not had time to check if the install directories for Source mods is still the same, but if the ones below doesn't work,
+then try looking for a similar folder in the \Steam\steamapps\common\ folder
+
+Install SweetFX to
+\Steam\steamapps\YourName\source sdk base 2007\
+
+but put d3d9.dll and injector.ini in
+\Steam\steamapps\YourName\source sdk base 2007\bin
+
+For source games dxgi.dll and dxgi.fx are not needed as it's a DirectX9 engine so you can delete them if you want or leave them be - it doesn't matter.
+
+
+ ** Stalker: Clear Sky and Stalker: Call of Pripyat **
+Install SweetFX to the main Stalker folder but move the dlls and injector.ini to the bin folder
+
+
+ ** World of Warcraft **
+Install SweetFX to the main World of Warcraft directory (the is the normal way to install SweetFX).
+Run the 32bit client. (or use Boulotaur 64bit SweetFX version, with the 64bit client of WoW)
+Set Multisampling to 1x to disable in-game MSAA anti-aliasing if it interferes with SweetFX.
+
+DX9 or DX11 is up to you - SweetFX works with both. It should run faster using DX11 but the only way to be sure is to benchmark it.

+ 64 - 0
Game Folder/SweetFX/Making shaders.txt

@@ -0,0 +1,64 @@
+I was asked in a PM by Nexus user "CassyCade" how one made new shaders for SweetFX.
+I thought I'd share my reply with you guys too as there might be someone here that wanted to try their hand at making a shader.
+
+Quote:
+The way SweetFX work is the dlls each call their own .fx file which sets up code specific to them , then the main.h file is called which loads each shader if it has been enabled in the settings, and then later in the file calls it if it's been enabled.
+
+I suggest that you start by going into the SweetFX/Shaders/ folder and make a copy of another shader .h file like splitscreen.h and name your copy what you will.
+Then go to the main.h file and copy the code that loads splitscreen.h and paste it in again and change the USE_SPLITSCREEN to USE_YOURSHADERNAME and point it to your shader file.
+Next find the section that runs the splitscreen pass and change it to run your shader.
+Code:
+
+	// Splitscreen
+	#if (USE_CADERSHADER == 1)
+		FinalColor = CaderShaderPass(FinalColor,tex);
+	#endif
+
+Then open the SweetFX_settings.txt file and create a new option to enable or disable your shader at the top and create a new section later in the file to set it's settings (you can copy the section for another shader again - just make sure you don't use the same #define constant names.
+
+You now have a copy of the splitscreen shader.
+
+Now edit the new shader so the function name matches the name you called earlier in main.h and remove the body of the shader function and write your own code here.
+Code:
+
+   /*-----------------------------------------------------------.   
+  /                      CaderShader                           /
+  '-----------------------------------------------------------*/
+/*
+Awesome shader by cassycade
+
+- Does this and a little bit of that.
+*/
+
+float4 CaderShaderPass( float4 colorInput, float2 tex )
+{
+//your code here
+
+
+
+//return something; //must be a float4
+
+//I usually do :
+//colorInput.rgb = my_awesome_output;
+
+//return colorInput;
+}
+
+You can write hlsl shaders in whatever editor you like.
+I use Notepad2, but Notepad++ is also a good text editor.
+
+I also use GPU ShaderAnalyzer to profile the shaders and get a better insight into how the hlsl code translates into assembler.
+I also test using a dx9 demo by Humus to profile the speed of the shader in a real environment rather than just guess based on how many assembler instructions it compiles to.
+You can use any dx9, dx10 or dx11 program, but I suggest a simple one that runs at a great frame rate and displays the fps so you can easily tell how much your shader affects performance.
+
+Other useful tools are :
+Graphtoy to visualize graphs in a shader language - do note that Graphtoy uses glsl which is very similar but not identical to hlsl.
+And WolframAlpha to help you reduce or plot (both reduce and plot are wolframalpha keywords .. try them) your algoritms and to doublecheck your math. Simply entering in your formula (in a syntax that wolframalpha understands) can yield you hints on how you can rephrase your algorithm, which may or may not get it to run faster - remember to benchmark your code changes .. never assume that it runs better/faster - check.
+
+The log.log file and GPU ShaderAnalyzer will both give you hints when something goes wrong and it won't compile right.
+I often forget an ; or forget to close a ( with a )
+
+The official list of HLSL intrinsic functions is also an important reference. Remember than for the most part you can ignore intrinsics for shader model 4 and 5 since DX 9 only supports up to shader model 3.
+
+Also if you find yourself needing the tex2D function (very likely) then I've written a alias function called myTex2D that calls the correct function for dx9 when using that and call the correct function for dx10/11 when using that.
+I suggest you use it.

+ 173 - 0
Game Folder/SweetFX/Presets/Battlefield 3_Derko1.txt

@@ -0,0 +1,173 @@
+   /*-----------------------------------------------------------.   
+  /                       Description                           /
+  '------------------------------------------------------------/
+
+Game: Battlefield 3
+SweetFX version: 1.3
+Author: Derko1
+Description: "SMAA, Luma Sharpening, DPX, Curves, Tone Mapping, Vibrance and Dither"
+Showcase: http://www.overclock.net/t/1296721/how-to-anti-aliasing-injection-fxaa-smaa-and-sweetfx/350#post_18575757
+
+   /*-----------------------------------------------------------.
+  /                      Choose effects                         /
+  '-----------------------------------------------------------*/
+
+// Set to 1 for ON or 0 for OFF
+#define USE_SMAA_ANTIALIASING  1            // [0 or 1] SMAA Anti-aliasing : Smoothens jagged lines.
+#define USE_LUMASHARPEN        1            // [0 or 1] LumaSharpen : Also sharpens the antialiased edges which makes them less smooth - I'm working on fixing that.
+#define USE_BLOOM              0            // [0 or 1] Bloom : Makes bright lights bleed their light into their surroundings (relatively high performance cost)
+#define USE_HDR                0            // [0 or 1] HDR : Not actual HDR - It just tries to mimic an HDR look (relatively high performance cost)
+#define USE_TECHNICOLOR        0            // [0 or 1] TECHNICOLOR : Attempts to mimic the look of an old movie using the Technicolor three-strip color process (Techicolor Process 4)
+#define USE_DPX                1            // [0 or 1] Cineon DPX : Should make the image look like it's been converted to DXP Cineon - basically it's another movie-like look similar to technicolor.
+#define USE_LIFTGAMMAGAIN      0            // [0 or 1] Lift Gamma Gain : Adjust brightness and color of shadows, midtones and highlights (avoids clipping)
+#define USE_TONEMAP            1            // [0 or 1] Tonemap : Adjust gamma, exposure, saturation, bleach and defog. (may cause clipping)
+#define USE_VIBRANCE           1            // [0 or 1] Vibrance : Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define USE_CURVES             1            // [0 or 1] Curves : Contrast adjustments using S-curves.
+#define USE_SEPIA              0            // [0 or 1] Sepia : Sepia tones the image.
+#define USE_VIGNETTE           0            // [0 or 1] Vignette : Darkens the edges of the image to make it look more like it was shot with a camera lens. May cause banding artifacts.
+#define USE_DITHER             1            // [0 or 1] Dither : Applies dithering to simulate more colors than your monitor can display. This lessens banding artifacts (mostly caused by Vignette)
+#define USE_SPLITSCREEN        0            // [0 or 1] Splitscreen : Enables the before-and-after splitscreen comparison mode.
+
+
+   /*-----------------------------------------------------------.
+  /                  SMAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+
+#define SMAA_THRESHOLD         0.10         // [0.05 to 0.20] Edge detection threshold
+#define SMAA_MAX_SEARCH_STEPS  16           // [0 to 98] Determines the radius SMAA will search for aliased edges
+#define SMAA_MAX_SEARCH_STEPS_DIAG 6            // [0 to 16] Determines the radius SMAA will search for diagonal aliased edges
+#define SMAA_CORNER_ROUNDING   0            // [0 to 100] Determines the percent of antialiasing to apply to corners.
+
+// -- Advanced SMAA settings --
+#define COLOR_EDGE_DETECTION   1            // [0 or 1] 1 Enables color edge detection (slower but slightly more acurate) - 0 uses luma edge detection (faster)
+#define SMAA_DIRECTX9_LINEAR_BLEND 0            // [0 or 1] Using DX9 HARDWARE? (software version doesn't matter) if so this needs to be 1 - If not, leave it at 0.
+
+
+   /*-----------------------------------------------------------.
+  /                       LumaSharpen settings                  /
+  '-----------------------------------------------------------*/
+// -- Sharpening --
+#define sharp_strength         1.5          // [0.10 to 3.00] Strength of the sharpening
+#define sharp_clamp            0.035        // [0.000 to 1.000] Limits maximum amount of sharpening a pixel recieves - Default is 0.035
+
+// -- Advanced sharpening settings --
+#define pattern                2            // [1|2|3|4] Choose a sample pattern. 1 = Fast, 2 = Normal, 3 = Wider, 4 = Pyramid shaped.
+#define offset_bias            1.0          // [0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
+                                            // I designed the pattern for offset_bias 1.0, but feel free to experiment.
+                           
+// -- Debug sharpening settings --
+#define show_sharpen           0            // [0 or 1] Visualize the strength of the sharpen (multiplied by 4 to see it better)
+
+
+   /*-----------------------------------------------------------.
+  /                       Bloom settings                        /
+  '-----------------------------------------------------------*/
+#define BloomThreshold         20.25        // [0.00 to 50.00] Threshold for what is a bright light (that causes bloom) and what isn't.
+#define BloomPower             1.446        // [0.0000 to 8.0000] Strength of the bloom
+#define BloomWidth             0.0142       // [0.0000 to 1.0000] Width of the bloom
+
+
+   /*-----------------------------------------------------------.
+  /                        HDR settings                         /
+  '-----------------------------------------------------------*/
+#define HDRPower               1.30         // [0.0 to 8.0] Strangely lowering this makes the image brighter
+#define radius2                0.87         // [0.0 to 8.0] Raising this seems to make the effect stronger and also brighter
+
+
+   /*-----------------------------------------------------------.
+  /                      TECHNICOLOR settings                   /
+  '-----------------------------------------------------------*/
+#define TechniAmount           0.11         // [0.0 to 1.0] 
+#define TechniPower            2.8          // [0.0 to 8.0] 
+#define redNegativeAmount      0.88         // [0.0 to 1.0] 
+#define greenNegativeAmount    0.88         // [0.0 to 1.0] 
+#define blueNegativeAmount     0.88         // [0.0 to 1.0] 
+
+
+   /*-----------------------------------------------------------.
+  /                      Cineon DPX settings                    /
+  '-----------------------------------------------------------*/
+#define Red                    8.0          // [1.0 to 15.0] 
+#define Green                  8.0          // [1.0 to 15.0] 
+#define Blue                   8.0          // [1.0 to 15.0] 
+
+#define ColorGamma             2.5          // [0.1 to 2.5] Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral.
+#define DPXSaturation          3.0          // [0.0 to 8.0] Adjust saturation of the effect. 1.0 is neutral.
+
+#define RedC                   0.36         // [0.6 to 0.2] 
+#define GreenC                 0.36         // [0.6 to 0.2] 
+#define BlueC                  0.34         // [0.6 to 0.2] 
+
+#define Blend                  0.2          // [0.0 to 0.1] How strong the effect should be.
+
+
+   /*-----------------------------------------------------------.
+  /                      Lift Gamma Gain settings               /
+  '-----------------------------------------------------------*/
+#define RGB_Lift               float3(1.000, 1.000, 1.000) // [0.000 to 2.000] Adjust shadows for Red, Green and Blue
+#define RGB_Gamma              float3(1.000, 1.000, 1.000) // [0.000 to 2.000] Adjust midtones for Red, Green and Blue
+#define RGB_Gain               float3(1.000, 1.000, 1.000) // [0.000 to 2.000] Adjust highlights for Red, Green and Blue
+
+
+   /*-----------------------------------------------------------.
+  /                        Tonemap settings                     /
+  '-----------------------------------------------------------*/
+#define Gamma                  1.02         // [0.00 to 2.00] Adjust midtones
+
+#define Exposure               0.00         // [-1.00 to 1.00] Adjust exposure
+
+#define Saturation             0.20         // [-1.00 to 1.00] Adjust saturation
+
+#define Bleach                 0.00         // [0.00 to 1.00] Brightens the shadows and fades the colors
+
+#define Defog                  0.012        // [0.00 to 1.00] How much of the color tint to remove
+#define FogColor               float3(0.00, 0.00, 2.55) // [0.00 to 1.00, 0.00 to 1.00, 0.00 to 1.00] What color to remove - default is blue
+
+
+   /*-----------------------------------------------------------.
+  /                       Vibrance settings                     /
+  '-----------------------------------------------------------*/
+#define Vibrance               0.20         // [-1.0 to 1.0] Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+
+
+   /*-----------------------------------------------------------.
+  /                        Curves settings                      /
+  '-----------------------------------------------------------*/
+#define Curves_contrast        0.30         // [-1.0 to 1.0] The amount of contrast you want
+
+// -- Advanced curve settings --
+#define Curves_formula         3            // [1|2|3|4|5|6|7] The constrast s-curve you want to use. 
+
+
+   /*-----------------------------------------------------------.
+  /                         Sepia settings                      /
+  '-----------------------------------------------------------*/
+#define ColorTone              float3(1.40, 1.10, 0.90) // [0.00 to 1.00, 0.00 to 1.00, 0.00 to 1.00] What color to tint the image
+#define GreyPower              0.11         // [0.0 to 1.0] How much desaturate the image before tinting it
+#define SepiaPower             0.58         // [0.0 to 1.0] How much to tint the image
+
+
+
+   /*-----------------------------------------------------------.
+  /                       Vignette settings                     /
+  '-----------------------------------------------------------*/
+#define VignetteRadius         1.00         // [-1.00 to 3.00] lower values = stronger radial effect from center
+#define VignetteAmount         -1.00        // [-2.00 to 1.00] Strength of black. -2.00 = Max Black, 1.00 = Max White.
+#define VignetteSlope          8            // [1 to 16] How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
+#define VignetteCenter         float2(0.500, 0.500) // [0.00 to 1.00] Center of effect.
+
+
+   /*-----------------------------------------------------------.
+  /                        Dither settings                      /
+  '-----------------------------------------------------------*/
+//No settings yet, beyond switching it on or off in the top section.
+
+//Note that the checkerboard pattern used by Dither, makes an image harder to compress.
+//This can make your screenshots and video recordings take up more space.
+
+
+   /*-----------------------------------------------------------.
+  /                     Splitscreen settings                    /
+  '-----------------------------------------------------------*/
+#define splitscreen_mode 3  // [1|2|3|4|5] 1 = Vertical 50/50 split, 2 = Vertical 25/50/25 split, 3 = Vertical 50/50 angled split, 4 = Horizontal 50/50 split, 5 = Horizontal 25/50/25 split
+

+ 127 - 0
Game Folder/SweetFX/Presets/Black_Mesa_CeeJay.txt

@@ -0,0 +1,127 @@
+   /*-----------------------------------------------------------.   
+  /                       Description                           /
+  '------------------------------------------------------------/
+
+Game: Black Mesa
+SweetFX version: 1.2
+Author: CeeJay.dk
+Description: 
+
+These are the settings I'm currently using for Black Mesa.
+I've lowered the SMAA_THRESHOLD to 0.08 to catch some edges that
+went undetected and I'm using very conservative sharpening,
+vibrance and vignette and using dither to make the vignette
+look smoother.
+
+
+   /*-----------------------------------------------------------.   
+  /                      Choose effects                         /
+  '-----------------------------------------------------------*/
+
+// Set to 1 for ON or 0 for OFF
+#define USE_SMAA_ANTIALIASING 1
+#define USE_LUMASHARPEN 1 // Also sharpens the antialiased edges which makes them less smooth - I'm working on fixing that.
+#define USE_BLOOM 0       // Bloom makes bright lights bleed their light into their surroundings (relatively high performance cost)
+#define USE_HDR 0         // Not actual HDR - It just tries to mimic an HDR look (relatively high performance cost)
+#define USE_TECHNICOLOR 0
+#define USE_TONEMAP 0
+#define USE_VIBRANCE 1    // Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define USE_SEPIA 0
+#define USE_VIGNETTE 1    // Darkens the edges of the image to make it more look like it was shot with a camera lens. May cause banding artifacts.
+#define USE_DITHER 1      // Applies dithering to simulate more colors than your monitor can display. This lessens banding artifacts.
+
+
+   /*-----------------------------------------------------------.   
+  /                  SMAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+
+#define SMAA_THRESHOLD 0.08           // (0.08-0.20) Edge detection threshold
+#define SMAA_MAX_SEARCH_STEPS 16      // [0-98] Determines the radius SMAA will search for aliased edges
+#define SMAA_MAX_SEARCH_STEPS_DIAG 6  // [0-16] Determines the radius SMAA will search for diagonal aliased edges
+#define SMAA_CORNER_ROUNDING 0        // [0-100] Determines the percent of antialiasing to apply to corners.
+
+// -- Advanced SMAA settings --
+#define COLOR_EDGE_DETECTION 1        // 1 Enables color edge detection (slower but more acurate) - 0 uses luma edge detection (faster)
+#define SMAA_DIRECTX9_LINEAR_BLEND 0  // Using DX9 HARDWARE? (software version doesn't matter) if so this needs to be 1 - If not, leave it at 0.
+
+
+   /*-----------------------------------------------------------.   
+  /                       LumaSharpen settings                  /
+  '-----------------------------------------------------------*/
+// -- Sharpening --
+#define sharp_strength 0.55 // (0.2-2.0)Strength of the sharpening
+#define sharp_clamp 0.035  // [0.0-1.0]Limits maximum amount of sharpening a pixel recieves
+
+// -- Advanced sharpening settings --
+#define pattern 4          // Choose a sample pattern [ 1, 2, 3 or 4 ] - I suggest 2
+#define offset_bias 1.0    // [0.0-6.0](1.0) Offset bias adjusts the radius of the sampling pattern.
+                           // I designed the pattern for offset_bias 1.0, but feel free to experiment.
+                           
+// -- Debug settings --
+#define splitscreen 0      // Enables the before-and-after splitscreen comparison mode. Left side is before.
+#define show_sharpen 0     // Visualize the strength of the sharpen (multiplied by 4 to see it better)
+
+
+   /*-----------------------------------------------------------.   
+  /                       Bloom settings                        /
+  '-----------------------------------------------------------*/
+#define BloomThreshold 20.25
+#define BloomPower 1.446
+#define BloomWidth 0.0142
+
+   /*-----------------------------------------------------------.   
+  /                        HDR settings                         /
+  '-----------------------------------------------------------*/
+#define HDRPower 1.40  // Strangely lowering this makes the image brighter
+#define radius2 0.95   // Raising this seems to make the effect stronger and also brighter
+
+
+   /*-----------------------------------------------------------.   
+  /                      TECHNICOLOR settings                   /
+  '-----------------------------------------------------------*/
+#define TechniAmount 0.11
+#define TechniPower 2.8
+#define redNegativeAmount 0.88
+#define greenNegativeAmount 0.88
+#define blueNegativeAmount 0.88
+
+
+   /*-----------------------------------------------------------.   
+  /                        Tonemap settings                     /
+  '-----------------------------------------------------------*/
+#define Gamma 1.0
+#define Exposure -0.1
+#define Saturation 0
+#define Bleach 0
+#define Defog 0.01
+#define FogColor float4(2.55, 2.55, 0, 0)
+
+
+   /*-----------------------------------------------------------.   
+  /                       Vibrance settings                     /
+  '-----------------------------------------------------------*/
+#define Vibrance 0.10  //Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+
+
+   /*-----------------------------------------------------------.   
+  /                         Sepia settings                      /
+  '-----------------------------------------------------------*/
+#define ColorTone float3(1.12, 0.66, 0.20)
+#define SepiaPower 0.11
+#define GreyPower 0.88
+
+
+   /*-----------------------------------------------------------.   
+  /                       Vignette settings                     /
+  '-----------------------------------------------------------*/
+#define VignetteRadius 1.10  // lower values = stronger radial effect from center
+#define VignetteAmount -1.00  // Strength of black. -2.00 = Max Black, 1.00 = Max White.
+#define VignetteSlope 8      // How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
+#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
+
+
+   /*-----------------------------------------------------------.   
+  /                        Dither settings                      /
+  '-----------------------------------------------------------*/
+//No settings yet, beyond switching it on or off in the top section.
+

+ 266 - 0
Game Folder/SweetFX/Presets/Default_1.5_settings.txt

@@ -0,0 +1,266 @@
+   /*-----------------------------------------------------------.
+  /                       Description                           /
+  '------------------------------------------------------------/
+
+Game:
+Author:
+SweetFX version: 1.5
+Description:
+
+Please note when tweaking settings that higher numbers does not always equal better (nor does lower).
+Finding the best settings for your game and your taste is about finding just the right amount to apply.
+
+If you made a good setttings preset please share it with your friends, on forums and websites,
+and/or submit it to the SweetFX Settings Database : http://sfx.thelazy.net/games/
+
+This description field and the above Game and Author fields are here so you can fill in your own details for the presets you create.
+Just delete this description and fill in your own and then share it with the world.
+
+Hope you enjoy my mod.
+ - CeeJay.dk
+
+   /*-----------------------------------------------------------.
+  /                      Choose effects                         /
+  '-----------------------------------------------------------*/
+
+// Set to 1 for ON or 0 for OFF
+#define USE_SMAA_ANTIALIASING 1 //[0 or 1] SMAA Anti-aliasing : Smoothens jagged lines using the SMAA technique.
+#define USE_FXAA_ANTIALIASING 0 //[0 or 1] FXAA Anti-aliasing : Smoothens jagged lines using the FXAA technique. WIP - Currently only works in DX9 and you need to use the FXAA injector dlls.
+#define USE_EXPLOSION     0 //[0 or 1] Explosion : Scatters the pixels, making the image look fuzzy.
+#define USE_CARTOON       0 //[0 or 1] Cartoon : "Toon"s the image. (Interferes with SMAA, CRT, Bloom, HDR and Lumasharpen)
+#define USE_ADVANCED_CRT  0 //[0 or 1] Advanced CRT : Simulates an old CRT TV display. (Interferes with SMAA, Cartoon, Bloom, HDR and Lumasharpen, and it has a very high performance cost)
+#define USE_BLOOM         0 //[0 or 1] Bloom : Makes bright lights bleed their light into their surroundings (relatively high performance cost)
+#define USE_HDR           0 //[0 or 1] HDR : Not actual HDR - It just tries to mimic an HDR look (relatively high performance cost)
+#define USE_LUMASHARPEN   1 //[0 or 1] LumaSharpen : Also sharpens the antialiased edges which makes them less smooth - I'm working on fixing that.
+#define USE_LEVELS        0 //[0 or 1] Levels : Sets a new black and white point. This increases contrast but causes clipping. Use Curves instead if you want to avoid that.
+#define USE_TECHNICOLOR   0 //[0 or 1] TECHNICOLOR : Attempts to mimic the look of an old movie using the Technicolor three-strip color process (Techicolor Process 4)
+#define USE_DPX           0 //[0 or 1] Cineon DPX : Should make the image look like it's been converted to DXP Cineon - basically it's another movie-like look similar to technicolor.
+#define USE_MONOCHROME    0 //[0 or 1] Monochrome : Monochrome makes the colors disappear.
+#define USE_LIFTGAMMAGAIN 0 //[0 or 1] Lift Gamma Gain : Adjust brightness and color of shadows, midtones and highlights
+#define USE_TONEMAP       0 //[0 or 1] Tonemap : Adjust gamma, exposure, saturation, bleach and defog. (may cause clipping)
+#define USE_VIBRANCE      1 //[0 or 1] Vibrance : Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define USE_CURVES        0 //[0 or 1] Curves : Contrast adjustments using S-curves.
+#define USE_SEPIA         0 //[0 or 1] Sepia : Sepia tones the image.
+#define USE_VIGNETTE      0 //[0 or 1] Vignette : Darkens the edges of the image to make it look more like it was shot with a camera lens. May cause banding artifacts.
+#define USE_DITHER        0 //[0 or 1] Dither : Applies dithering to simulate more colors than your monitor can display. This lessens banding artifacts (mostly caused by Vignette)
+#define USE_BORDER        0 //[0 or 1] Border : Makes the screenedge black as a workaround for the bright edge that forcing some AA modes sometimes causes.
+#define USE_SPLITSCREEN   0 //[0 or 1] Splitscreen : Enables the before-and-after splitscreen comparison mode.
+
+#define USE_CUSTOM        0 //[0 or 1] Custom : Write your own shader by editing custom.h, and then enable it here.
+
+   /*-----------------------------------------------------------.
+  /                  SMAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+
+#define SMAA_THRESHOLD             0.10  //[0.05 to 0.20] Edge detection threshold. If SMAA misses some edges try lowering this slightly. I prefer between 0.08 and 0.12.
+#define SMAA_MAX_SEARCH_STEPS        16  //[0 to 98] Determines the radius SMAA will search for aliased edges
+#define SMAA_MAX_SEARCH_STEPS_DIAG    6  //[0 to 16] Determines the radius SMAA will search for diagonal aliased edges
+#define SMAA_CORNER_ROUNDING          0  //[0 to 100] Determines the percent of antialiasing to apply to corners. 0 seems to affect fine text the least so it's the default.
+
+// -- Advanced SMAA settings --
+#define COLOR_EDGE_DETECTION          1  //[0 or 1] 1 Enables color edge detection (slower but slightly more acurate) - 0 uses luma edge detection (faster)
+#define SMAA_DIRECTX9_LINEAR_BLEND    0  //[0 or 1] Using DX9 HARDWARE? (software version doesn't matter) if so this needs to be 1 - If not, leave it at 0.
+                                         //Enable this only if you use a Geforce 7xxx series or older card, or a Radeon X1xxx series or older card.
+
+   /*-----------------------------------------------------------.
+  /                  FXAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+#define FXAA_QUALITY__PRESET          9  //[1 to 9] Choose the quality preset. 9 is the highest quality.
+#define fxaa_Subpix               0.400  //[0.000 to 1.000] Choose the amount of sub-pixel aliasing removal.
+#define fxaa_EdgeThreshold        0.250  //[0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm.
+#define fxaa_EdgeThresholdMin     0.060  //[0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks.
+
+   /*-----------------------------------------------------------.
+  /                     Explosion settings                      /
+  '-----------------------------------------------------------*/
+#define Explosion_Radius    2.5     //[0.2 to 100.0] Amount of effect you want.
+
+
+   /*-----------------------------------------------------------.
+  /                      Cartoon settings                       /
+  '-----------------------------------------------------------*/
+#define CartoonPower         1.5     //[0.1 to 10.0] Amount of effect you want.
+#define CartoonEdgeSlope     1.5     //[0.1 to 8.0] Raise this to filter out fainter edges. You might need to increase the power to compensate. Whole numbers are faster.
+
+
+   /*----------------------------------------------------------.
+  /                    Advanced CRT settings                   /
+  '----------------------------------------------------------*/
+#define CRTAmount            1.00    //[0.00 to 1.00]  Amount of CRT effect you want
+
+#define CRTResolution        2.0     //[1.0 to 8.0]    Input size coefficent (low values gives the "low-res retro look"). Default is 1.2
+#define CRTgamma             2.2     //[0.0 to 4.0]    Gamma of simulated CRT (default 2.2)
+#define CRTmonitorgamma      2.4     //[0.0 to 4.0]    Gamma of display monitor (typically 2.2 is correct)
+#define CRTBrightness        1.2     //[1.0 to 3.0]    Used to boost brightness a little. Default is 1.0
+#define CRTScanlineIntensity 2.0     //[2.0 to 4.0]    Scanlines intensity (use integer values preferably). Default is 2.0
+#define CRTScanlineGaussian  1       //[0 or 1]        Use the "new nongaussian scanlines bloom effect". Default is on
+
+#define CRTCurvature         1       //[[0 or 1]          "Barrel effect" enabled (1) or off (0)
+#define CRTCurvatureRadius   2.0     //[0.0 to 2.0]       Curvature Radius (only effective when Curvature is enabled). Default is 1.5
+#define CRTCornerSize        0.0100  //[0.0000 to 0.0020] Higher values, more rounded corner. Default is 0.001
+#define CRTDistance          2.00    //[0.00 to 4.00]     Simulated distance from viewer to monitor. Default is 2.00
+#define CRTAngleX            0.00    //[-0.20 to 0.20]    Tilt angle in radians (X coordinates)
+#define CRTAngleY           -0.15   //[-0.20 to 0.20]    Tilt angle in radians (Y coordinates). (Value of -0.15 gives the 'arcade tilt' look)
+#define CRTOverScan          1.00    //[1.00 to 1.10]     Overscan (e.g. 1.02 for 2% overscan). Default is 1.01
+#define CRTOversample        0       //[0 or 1]           Enable 3x oversampling of the beam profile (warning : performance hit)
+
+   /*-----------------------------------------------------------.
+  /                       Bloom settings                        /
+  '-----------------------------------------------------------*/
+#define BloomThreshold 20.25 //[0.00 to 50.00] Threshold for what is a bright light (that causes bloom) and what isn't.
+#define BloomPower 1.446     //[0.000 to 8.000] Strength of the bloom
+#define BloomWidth 0.0142    //[0.0000 to 1.0000] Width of the bloom
+
+   /*-----------------------------------------------------------.
+  /                        HDR settings                         /
+  '-----------------------------------------------------------*/
+#define HDRPower 1.30  //[0.00 to 8.00] Strangely lowering this makes the image brighter
+#define radius2  0.87  //[0.00 to 8.00] Raising this seems to make the effect stronger and also brighter
+
+   /*-----------------------------------------------------------.
+  /                     LumaSharpen settings                    /
+  '-----------------------------------------------------------*/
+// -- Sharpening --
+#define sharp_strength 0.65   //[0.10 to 3.00] Strength of the sharpening
+#define sharp_clamp    0.035  //[0.000 to 1.000] Limits maximum amount of sharpening a pixel recieves - Default is 0.035
+
+// -- Advanced sharpening settings --
+#define pattern 2        //[1|2|3|4] Choose a sample pattern. 1 = Fast, 2 = Normal, 3 = Wider, 4 = Pyramid shaped.
+#define offset_bias 1.0  //[0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
+                         //I designed the pattern for offset_bias 1.0, but feel free to experiment.
+
+// -- Debug sharpening settings --
+#define show_sharpen 0   //[0 or 1] Visualize the strength of the sharpen (multiplied by 4 to see it better)
+
+   /*----------------------------------------------------------.
+  /                       Levels settings                      /
+  '----------------------------------------------------------*/
+
+#define Levels_black_point 16    //[0 to 255] The black point is the new black - literally. Everything darker than this will become completely black. Default is 16.0
+#define Levels_white_point 235   //[0 to 255] The new white point. Everything brighter than this becomes completely white. Default is 235.0
+
+//Colors between the two points will stretched, which increases contrast, but details above and below the points are lost (this is called clipping).
+
+
+   /*-----------------------------------------------------------.
+  /                      TECHNICOLOR settings                   /
+  '-----------------------------------------------------------*/
+#define TechniAmount 0.4         //[0.00 to 1.00]
+#define TechniPower  4.0         //[0.00 to 8.00]
+#define redNegativeAmount   0.88 //[0.00 to 1.00]
+#define greenNegativeAmount 0.88 //[0.00 to 1.00]
+#define blueNegativeAmount  0.88 //[0.00 to 1.00]
+
+
+   /*-----------------------------------------------------------.
+  /                      Cineon DPX settings                    /
+  '-----------------------------------------------------------*/
+#define Red   8.0  //[1.0 to 15.0]
+#define Green 8.0  //[1.0 to 15.0]
+#define Blue  8.0  //[1.0 to 15.0]
+
+#define ColorGamma    2.5  //[0.1 to 2.5] Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral.
+#define DPXSaturation 3.0  //[0.0 to 8.0] Adjust saturation of the effect. 1.0 is neutral.
+
+#define RedC   0.36  //[0.60 to 0.20]
+#define GreenC 0.36  //[0.60 to 0.20]
+#define BlueC  0.34  //[0.60 to 0.20]
+
+#define Blend 0.2    //[0.00 to 1.00] How strong the effect should be.
+
+
+   /*-----------------------------------------------------------.
+  /                      Monochrome settings                    /
+  '-----------------------------------------------------------*/
+#define Monochrome_conversion_values float3(0.18,0.41,0.41) //[0.00 to 1.00] Percentage of RGB to include (should sum up to 1.00)
+
+
+   /*-----------------------------------------------------------.
+  /                      Lift Gamma Gain settings               /
+  '-----------------------------------------------------------*/
+#define RGB_Lift  float3(1.000, 1.000, 1.000)  //[0.000 to 2.000] Adjust shadows for Red, Green and Blue.
+#define RGB_Gamma float3(1.000, 1.100, 1.000)  //[0.000 to 2.000] Adjust midtones for Red, Green and Blue
+#define RGB_Gain  float3(1.000, 1.000, 1.000)  //[0.000 to 2.000] Adjust highlights for Red, Green and Blue
+
+//Note that a value of 1.000 is a neutral setting that leave the color unchanged.
+
+   /*-----------------------------------------------------------.
+  /                        Tonemap settings                     /
+  '-----------------------------------------------------------*/
+#define Gamma       1.000  //[0.000 to 2.000] Adjust midtones. 1.000 is neutral. This setting does exactly the same as the one in Lift Gamma Gain, only with less control.
+
+#define Exposure    0.000  //[-1.000 to 1.000] Adjust exposure
+
+#define Saturation  0.000  //[-1.000 to 1.000] Adjust saturation
+
+#define Bleach      0.000  //[0.000 to 1.000] Brightens the shadows and fades the colors
+
+#define Defog       0.000  //[0.000 to 1.000] How much of the color tint to remove
+#define FogColor float3(0.00, 0.00, 2.55) //[0.00 to 2.55, 0.00 to 2.55, 0.00 to 2.55] What color to remove - default is blue
+
+
+   /*-----------------------------------------------------------.
+  /                       Vibrance settings                     /
+  '-----------------------------------------------------------*/
+#define Vibrance     0.15  //[-1.00 to 1.00] Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define Vibrance_RGB_balance float3(1.00, 1.00, 1.00) //[-10.00 to 10.00,-10.00 to 10.00,-10.00 to 10.00] A per channel multiplier to the Vibrance strength so you can give more boost to certain colors over others
+
+
+   /*-----------------------------------------------------------.
+  /                        Curves settings                      /
+  '-----------------------------------------------------------*/
+#define Curves_mode        0 //[0|1|2] Choose what to apply contrast to. 0 = Luma, 1 = Chroma, 2 = both Luma and Chroma. Default is 0 (Luma)
+#define Curves_contrast 0.15 //[-1.00 to 1.00] The amount of contrast you want
+
+// -- Advanced curve settings --
+#define Curves_formula     2 //[1|2|3|4|5|6|7|8|9|10] The contrast s-curve you want to use.
+                             //1 = Sine, 2 = Abs split, 3 = Smoothstep, 4 = Exp formula, 5 = Simplified Catmull-Rom (0,0,1,1), 6 = Perlins Smootherstep
+                             //7 = Abs add, 8 = Techicolor Cinestyle, 9 = Parabola, 10 = Half-circles.
+                             //Note that Technicolor Cinestyle is practically identical to Sine, but runs slower. In fact I think the difference might only be due to rounding errors.
+                             //I prefer 2 myself, but 3 is a nice alternative with a little more effect (but harsher on the highlight and shadows) and it's the fastest formula.
+
+   /*-----------------------------------------------------------.
+  /                         Sepia settings                      /
+  '-----------------------------------------------------------*/
+#define ColorTone float3(1.40, 1.10, 0.90) //[0.00 to 2.55, 0.00 to 2.55, 0.00 to 2.55] What color to tint the image
+#define GreyPower  0.11                    //[0.00 to 1.00] How much desaturate the image before tinting it
+#define SepiaPower 0.58                    //[0.00 to 1.00] How much to tint the image
+
+
+   /*-----------------------------------------------------------.
+  /                       Vignette settings                     /
+  '-----------------------------------------------------------*/
+#define VignetteType       1  //[1|2|3] 1 = Original, 2 = New, 3 = TV style
+#define VignetteRatio   1.00  //[0.15 to 6.00]  Sets a width to height ratio. 1.00 (1/1) is perfectly round, while 1.60 (16/10) is 60 % wider than it's high.
+#define VignetteRadius  1.00  //[-1.00 to 3.00] lower values = stronger radial effect from center
+#define VignetteAmount -1.00  //[-2.00 to 1.00] Strength of black. -2.00 = Max Black, 1.00 = Max White.
+#define VignetteSlope      8  //[2 to 16] How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
+#define VignetteCenter float2(0.500, 0.500)  //[0.000 to 1.000, 0.000 to 1.000] Center of effect for VignetteType 1. 2 and 3 do not obey this setting.
+
+
+   /*-----------------------------------------------------------.
+  /                        Dither settings                      /
+  '-----------------------------------------------------------*/
+#define dither_method      1  //[1 or 2] 1 = Ordered dithering (very good and very fast), 2 = Random dithering (different dithering but not as fast)
+
+//Note that the patterns used by Dither, makes an image harder to compress.
+//This can make your screenshots and video recordings take up more space.
+
+
+   /*-----------------------------------------------------------.
+  /                        Border settings                      /
+  '-----------------------------------------------------------*/
+#define border_width float2(1,20)     //[0 to 2048, 0 to 2048] (X,Y)-width of the border. Measured in pixels.
+#define border_color float3(0, 0, 0) //[0 to 255, 0 to 255, 0 to 255] What color the border should be. In integer RGB colors, meaning 0,0,0 is black and 255,255,255 is full white.
+
+
+   /*-----------------------------------------------------------.
+  /                     Splitscreen settings                    /
+  '-----------------------------------------------------------*/
+#define splitscreen_mode   1  //[1|2|3|4|5|6]  1 = Vertical 50/50 split, 2 = Vertical 25/50/25 split, 3 = Vertical 50/50 angled split, 
+                              // 4 = Horizontal 50/50 split, 5 = Horizontal 25/50/25 split, 6 = Curvy vertical 50/50 split
+
+   /*-----------------------------------------------------------.
+  /                       Custom settings                       /
+  '-----------------------------------------------------------*/
+//You can write your own effect by editing custom.h and then put settings for it here

+ 151 - 0
Game Folder/SweetFX/Presets/Mount&Blade_Warband_TFL.txt

@@ -0,0 +1,151 @@
+   /*-----------------------------------------------------------.   
+  /                       Description                           /
+  '------------------------------------------------------------/
+
+Game: Mount & Blade Warband
+SweetFX version: 1.2 (updated for 1.3 by CeeJay.dk)
+Author: TFL Replica
+Description: "Breathes some life into game, better contrast, more natural colors"
+Showcase: http://www.overclock.net/t/1296721/how-to-anti-aliasing-injection-methods/250#post_18387567
+
+
+   /*-----------------------------------------------------------.
+  /                      Choose effects                         /
+  '-----------------------------------------------------------*/
+
+// Set to 1 for ON or 0 for OFF
+#define USE_SMAA_ANTIALIASING 1
+#define USE_LUMASHARPEN 1 //Also sharpens the antialiased edges which makes them less smooth - I'm working on fixing that.
+#define USE_BLOOM 0       // Bloom makes bright lights bleed their light into their surroundings (relatively high performance cost)
+#define USE_HDR 1         // Not actual HDR - It just tries to mimic an HDR look (relatively high performance cost)
+#define USE_TECHNICOLOR 0 // Attempts to mimic the look of an old movie using the Technicolor three-strip color process (Techicolor Process 4)
+#define USE_TONEMAP 0
+#define USE_VIBRANCE 1    //Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define USE_SEPIA 1
+#define USE_VIGNETTE 0    //Darkens the edges of the image to make it more look like it was shot with a camera lens. May cause banding artifacts.
+#define USE_DITHER 0      //Applies dithering to simulate more colors than your monitor can display. This lessens banding artifacts (mostly caused by vignette)
+
+#define USE_DPX 1         //Unfinished - Should make the image look like it's been converted to DXP Cineon - basically it's another movie-like look similar to technicolor
+                          //I think the shader itself works, but the default settings need a lot of work. Maybe you can find some good settings?
+
+   /*-----------------------------------------------------------.
+  /                  SMAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+
+#define SMAA_THRESHOLD 0.05           // (0.08-0.20) Edge detection threshold
+#define SMAA_MAX_SEARCH_STEPS 64      // [0-98] Determines the radius SMAA will search for aliased edges
+#define SMAA_MAX_SEARCH_STEPS_DIAG 16  // [0-16] Determines the radius SMAA will search for diagonal aliased edges
+#define SMAA_CORNER_ROUNDING 0        // [0-100] Determines the percent of antialiasing to apply to corners.
+
+// -- Advanced SMAA settings --
+#define COLOR_EDGE_DETECTION 1        // 1 Enables color edge detection (slower but more acurate) - 0 uses luma edge detection (faster)
+#define SMAA_DIRECTX9_LINEAR_BLEND 0  // Using DX9 HARDWARE? (software version doesn't matter) if so this needs to be 1 - If not, leave it at 0.
+
+
+   /*-----------------------------------------------------------.
+  /                       LumaSharpen settings                  /
+  '-----------------------------------------------------------*/
+// -- Sharpening --
+#define sharp_strength 0.5 // (0.2-2.0)Strength of the sharpening
+#define sharp_clamp 0.030  // [0.0-1.0]Limits maximum amount of sharpening a pixel recieves - Default is 0.035
+
+// -- Advanced sharpening settings --
+#define pattern 2          // Choose a sample pattern [ 1, 2, 3 or 4 ] - 1 = Fast, 2 = Normal, 3 = Wider, 4 = Pyramid shaped.
+#define offset_bias 1.0    // [0.0-6.0](1.0) Offset bias adjusts the radius of the sampling pattern.
+                           // I designed the pattern for offset_bias 1.0, but feel free to experiment.
+                           
+// -- Debug settings --
+#define splitscreen 0      // Enables the before-and-after splitscreen comparison mode. Left side is before.
+#define show_sharpen 0     // Visualize the strength of the sharpen (multiplied by 4 to see it better)
+
+
+   /*-----------------------------------------------------------.
+  /                       Bloom settings                        /
+  '-----------------------------------------------------------*/
+#define BloomThreshold 20.25
+#define BloomPower 1.446
+#define BloomWidth 0.0142
+
+   /*-----------------------------------------------------------.
+  /                        HDR settings                         /
+  '-----------------------------------------------------------*/
+#define HDRPower 1.20  //Strangely lowering this makes the image brighter
+#define radius2 0.80   //Raising this seems to make the effect stronger and also brighter
+
+
+   /*-----------------------------------------------------------.
+  /                      TECHNICOLOR settings                   /
+  '-----------------------------------------------------------*/
+#define TechniAmount 0.11
+#define TechniPower 2.8
+#define redNegativeAmount 0.88
+#define greenNegativeAmount 0.88
+#define blueNegativeAmount 0.88
+
+
+   /*-----------------------------------------------------------.
+  /                        Tonemap settings                     /
+  '-----------------------------------------------------------*/
+#define Gamma 1.0
+
+#define Exposure 0.0
+
+#define Saturation 0.0
+
+#define Bleach 0.0
+
+#define Defog 0.010  //How much of the color tint to remove
+#define FogColor float3(0.00, 0.00, 2.55) //what color to remove - default is blue
+
+
+   /*-----------------------------------------------------------.
+  /                       Vibrance settings                     /
+  '-----------------------------------------------------------*/
+#define Vibrance -0.1  //Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+
+
+   /*-----------------------------------------------------------.
+  /                         Sepia settings                      /
+  '-----------------------------------------------------------*/
+#define ColorTone float3(1.40, 1.20, 0.90)
+#define SepiaPower 0.20
+#define GreyPower 0.07  
+
+   /*-----------------------------------------------------------.
+  /                       Vignette settings                     /
+  '-----------------------------------------------------------*/
+#define VignetteRadius 1.00  // lower values = stronger radial effect from center
+#define VignetteAmount -1.00 // Strength of black. -2.00 = Max Black, 1.00 = Max White.
+#define VignetteSlope 8      // How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
+#define VignetteCenter float2(0.500, 0.500) // Center of effect.
+
+
+   /*-----------------------------------------------------------.
+  /                        Dither settings                      /
+  '-----------------------------------------------------------*/
+//No settings yet, beyond switching it on or off in the top section.
+
+//Note that checkerboard pattern used by Dither, makes an image harder to compress.
+//This can make your screenshots and videos take up more space.
+
+
+/////////////////////////////////////////////////////////////////
+///////////////////////// Work in Progress //////////////////////
+/////////////////////////////////////////////////////////////////
+
+   /*-----------------------------------------------------------.
+  /                      Cineon DPX settings                    /
+  '-----------------------------------------------------------*/
+//I have yet to find good default settings for this .. maybe you can?
+float Red = 8.0;   //[1.0 - 15.0]
+float Green = 8.0; //[1.0 - 15.0]
+float Blue = 8.0;  //[1.0 - 15.0]
+
+float ColorGamma = 2.5f;    //[0.1 - 2.5]
+float DPXSaturation = 3.0f; //[0.0 - 8.0]
+
+float RedC = 0.36;    //[0.6 - 0.2]
+float GreenC  = 0.36; //[0.6 - 0.2]
+float BlueC = 0.34;   //[0.6 - 0.2]
+
+float Blend = 0.2; //[1.0 - 0.0] How strong the effect should be

+ 121 - 0
Game Folder/SweetFX/Presets/Torchlight2_BetA.txt

@@ -0,0 +1,121 @@
+   /*-----------------------------------------------------------.   
+  /                       Description                           /
+  '------------------------------------------------------------/
+
+Game: Torchlight 2
+SweetFX version: 1.1.1
+Author: BetA
+Description: "Reduces that Foggy screen almost completely, adds a little more color, sharpen and an HDR effect"
+Showcase: http://forums.guru3d.com/showpost.php?p=4420578&postcount=106
+
+
+ /*-----------------------------------------------------------.
+/                       Choose effects                        /
+'-----------------------------------------------------------*/
+
+// Set to 1 for ON or 0 for OFF
+#define USE_SMAA_ANTIALIASING 1
+#define USE_LUMASHARPEN 1 //Also sharpens the antialiased edges which makes them less smooth - I'm working on fixing that.
+#define USE_BLOOM 0 // Bloom makes bright lights bleed their light into their surroundings (relatively high performance cost)
+#define USE_HDR 1 // Not actual HDR - It just tries to mimic an HDR look (relatively high performance cost)
+#define USE_TECHNICOLOR 0
+#define USE_TONEMAP 0
+#define USE_VIBRANCE 0 //Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define USE_SEPIA 0
+#define USE_VIGNETTE 0 //Darkens the edges of the image to make it more look like it was shot with a camera lens. May cause banding artifacts.
+#define USE_DITHER 1 //Applies dithering to simulate more colors than your monitor can display. This lessens banding artifacts.
+
+
+ /*-----------------------------------------------------------.
+/                SMAA Anti-aliasing settings                  /
+'-----------------------------------------------------------*/
+
+#define SMAA_THRESHOLD 0.12 // (0.08-0.20) Edge detection threshold
+#define SMAA_MAX_SEARCH_STEPS 32 // [0-98] Determines the radius SMAA will search for aliased edges
+#define SMAA_MAX_SEARCH_STEPS_DIAG 16 // [0-16] Determines the radius SMAA will search for diagonal aliased edges
+#define SMAA_CORNER_ROUNDING 0 // [0-100] Determines the percent of antialiasing to apply to corners.
+
+// -- Advanced SMAA settings --
+#define COLOR_EDGE_DETECTION 1 // 1 Enables color edge detection (slower but more acurate) - 0 uses luma edge detection (faster)
+#define SMAA_DIRECTX9_LINEAR_BLEND 0 // Using DX9 HARDWARE? (software version doesn't matter) if so this needs to be 1 - If not, leave it at 0.
+
+
+ /*-----------------------------------------------------------.
+/                    LumaSharpen settings                     /
+'-----------------------------------------------------------*/
+// -- Sharpening --
+#define sharp_strength 0.6 // (0.2-2.0)Strength of the sharpening
+#define sharp_clamp 0.040 // [0.0-1.0]Limits maximum amount of sharpening a pixel recieves - Default is 0.050
+
+// -- Advanced sharpening settings --
+#define pattern 2 // Choose a sample pattern [ 1, 2, 3 or 4 ] - I suggest 2
+#define offset_bias 1.0 // [0.0-6.0](1.0) Offset bias adjusts the radius of the sampling pattern.
+// I designed the pattern for offset_bias 1.0, but feel free to experiment.
+
+// -- Debug settings --
+#define splitscreen 0 // Enables the before-and-after splitscreen comparison mode. Left side is before.
+#define show_sharpen 0 // Visualize the strength of the sharpen (multiplied by 4 to see it better)
+
+
+ /*-----------------------------------------------------------.
+/                       Bloom settings                        /
+'-----------------------------------------------------------*/
+#define BloomThreshold 20.25
+#define BloomPower 1.446
+#define BloomWidth 0.0142
+
+ /*-----------------------------------------------------------.
+/                        HDR settings                         /
+'-----------------------------------------------------------*/
+#define HDRPower 1.20 //Strangely lowering this makes the image brighter
+#define radius2 0.87 //Raising this seems to make the effect stronger and also brighter
+
+
+ /*-----------------------------------------------------------.
+/                    TECHNICOLOR settings                     /
+'-----------------------------------------------------------*/
+#define TechniAmount 0.11
+#define TechniPower 2.8
+#define redNegativeAmount 0.88
+#define greenNegativeAmount 0.88
+#define blueNegativeAmount 0.88
+
+
+ /*-----------------------------------------------------------.
+/                     Tonemap settings                        /
+'-----------------------------------------------------------*/
+#define Gamma 1.0
+#define Exposure -0.1
+#define Saturation 0
+#define Bleach 0
+#define Defog 0.01
+#define FogColor float4(2.55, 2.55, 0, 0)
+
+
+ /*-----------------------------------------------------------.
+/                       Vibrance settings                     /
+'-----------------------------------------------------------*/
+#define Vibrance 0.1 //Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+
+
+ /*-----------------------------------------------------------.
+/                         Sepia settings                      /
+'-----------------------------------------------------------*/
+#define ColorTone float3(1.12, 0.66, 0.20)
+#define SepiaPower 0.11
+#define GreyPower 0.88
+
+
+ /*-----------------------------------------------------------.
+/                       Vignette settings                     /
+'-----------------------------------------------------------*/
+#define VignetteRadius 1.05 // lower values = stronger radial effect from center
+#define VignetteAmount -1.0 // Strength of black. -2.00 = Max Black, 1.00 = Max White.
+#define VignetteSlope 8 // How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
+#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
+
+
+ /*-----------------------------------------------------------.
+/                        Dither settings                      /
+'-----------------------------------------------------------*/
+//No settings yet, beyond switching it on or off in the top section.

+ 122 - 0
Game Folder/SweetFX/Presets/Torchlight2_TFL.txt

@@ -0,0 +1,122 @@
+   /*-----------------------------------------------------------.   
+  /                       Description                           /
+  '------------------------------------------------------------/
+
+Game: Torchlight 2
+SweetFX version: 1.1.1
+Author: TFL Replica
+Description: "..aim was to make the game slightly grittier/darker"
+Showcase: http://www.overclock.net/t/1296721/how-to-anti-aliasing-injection-methods/150#post_18235528
+
+
+   /*-----------------------------------------------------------.   
+  /                      Choose effects                         /
+  '-----------------------------------------------------------*/
+
+// Set to 1 for ON or 0 for OFF
+#define USE_SMAA_ANTIALIASING 1
+#define USE_LUMASHARPEN 0 //Also sharpens the antialiased edges which makes them less smooth - I'm working on fixing that.
+#define USE_BLOOM 0       // Bloom makes bright lights bleed their light into their surroundings (relatively high performance cost)
+#define USE_HDR 1         // Not actual HDR - It just tries to mimic an HDR look (relatively high performance cost)
+#define USE_TECHNICOLOR 1
+#define USE_TONEMAP 1
+#define USE_VIBRANCE 1    //Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define USE_SEPIA 1
+#define USE_VIGNETTE 0    //Darkens the edges of the image to make it more look like it was shot with a camera lens. May cause banding artifacts.
+#define USE_DITHER 0      //Applies dithering to simulate more colors than your monitor can display. This lessens banding artifacts.
+
+
+   /*-----------------------------------------------------------.   
+  /                  SMAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+
+#define SMAA_THRESHOLD 0.05           // (0.08-0.20) Edge detection threshold
+#define SMAA_MAX_SEARCH_STEPS 64      // [0-98] Determines the radius SMAA will search for aliased edges
+#define SMAA_MAX_SEARCH_STEPS_DIAG 16  // [0-16] Determines the radius SMAA will search for diagonal aliased edges
+#define SMAA_CORNER_ROUNDING 25       // [0-100] Determines the percent of antialiasing to apply to corners.
+
+// -- Advanced SMAA settings --
+#define COLOR_EDGE_DETECTION 1        // 1 Enables color edge detection (slower but more acurate) - 0 uses luma edge detection (faster)
+#define SMAA_DIRECTX9_LINEAR_BLEND 0  // Using DX9 HARDWARE? (software version doesn't matter) if so this needs to be 1 - If not, leave it at 0.
+
+
+   /*-----------------------------------------------------------.   
+  /                       LumaSharpen settings                  /
+  '-----------------------------------------------------------*/
+// -- Sharpening --
+#define sharp_strength 0.6 // (0.2-2.0)Strength of the sharpening
+#define sharp_clamp 0.050  // [0.0-1.0]Limits maximum amount of sharpening a pixel recieves - Default is 0.050
+
+// -- Advanced sharpening settings --
+#define pattern 2          // Choose a sample pattern [ 1, 2, 3 or 4 ] - I suggest 2
+#define offset_bias 1.0    // [0.0-6.0](1.0) Offset bias adjusts the radius of the sampling pattern.
+                           // I designed the pattern for offset_bias 1.0, but feel free to experiment.
+                           
+// -- Debug settings --
+#define splitscreen 0      // Enables the before-and-after splitscreen comparison mode. Left side is before.
+#define show_sharpen 0     // Visualize the strength of the sharpen (multiplied by 4 to see it better)
+
+
+   /*-----------------------------------------------------------.   
+  /                       Bloom settings                        /
+  '-----------------------------------------------------------*/
+#define BloomThreshold 20.25
+#define BloomPower 1.446
+#define BloomWidth 0.0142
+
+   /*-----------------------------------------------------------.   
+  /                        HDR settings                         /
+  '-----------------------------------------------------------*/
+#define HDRPower 1.20  //Strangely lowering this makes the image brighter
+#define radius2 0.85   //Raising this seems to make the effect stronger and also brighter
+
+
+   /*-----------------------------------------------------------.   
+  /                      TECHNICOLOR settings                   /
+  '-----------------------------------------------------------*/
+#define TechniAmount 0.11
+#define TechniPower 2.8
+#define redNegativeAmount 0.88
+#define greenNegativeAmount 0.88
+#define blueNegativeAmount 0.88
+
+
+   /*-----------------------------------------------------------.   
+  /                        Tonemap settings                     /
+  '-----------------------------------------------------------*/
+#define Gamma 1.0
+#define Exposure -0.3
+#define Saturation -0.55
+#define Bleach 0
+#define Defog 0.00
+#define FogColor float4(0, 0, 0, 0)
+
+
+   /*-----------------------------------------------------------.   
+  /                       Vibrance settings                     /
+  '-----------------------------------------------------------*/
+#define Vibrance 0.4  //Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+
+
+   /*-----------------------------------------------------------.   
+  /                         Sepia settings                      /
+  '-----------------------------------------------------------*/
+#define ColorTone float3(1.40, 1.10, 0.90)
+#define SepiaPower 0.58
+#define GreyPower 0.11
+
+
+   /*-----------------------------------------------------------.   
+  /                       Vignette settings                     /
+  '-----------------------------------------------------------*/
+#define VignetteRadius 1.05  // lower values = stronger radial effect from center
+#define VignetteAmount -1.0  // Strength of black. -2.00 = Max Black, 1.00 = Max White.
+#define VignetteSlope 8      // How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
+#define VignetteCenter float2(0.500, 0.500) // Center of screen for effect.
+
+
+   /*-----------------------------------------------------------.   
+  /                        Dither settings                      /
+  '-----------------------------------------------------------*/
+//No settings yet, beyond switching it on or off in the top section.
+

+ 249 - 0
Game Folder/SweetFX/Shaders/AdvancedCRT.h

@@ -0,0 +1,249 @@
+// CRT shader
+// 
+// Copyright (C) 2010-2012 cgwg, Themaister and DOLLS
+// 
+// This program is free software; you can redistribute it and/or modify it
+// under the terms of the GNU General Public License as published by the Free
+// Software Foundation; either version 2 of the License, or (at your option)
+// any later version.
+
+#define d CRTDistance
+#define R CRTCurvatureRadius
+
+// Comment the next line to disable interpolation in linear gamma (and gain speed).
+//#define LINEAR_PROCESSING
+
+// aspect ratio
+#define aspect float2(1.0, 0.75)
+
+// Precalculate a bunch of useful values we'll need in the fragment
+// shader.
+#define sinangle sin(float2(CRTAngleX, CRTAngleY))
+#define cosangle cos(float2(CRTAngleX, CRTAngleY))
+#define stretch maxscale()
+
+// Macros.
+#define FIX(c) max(abs(c), 1e-5);
+
+float PI = acos(-1); //#define PI 3.141592653589
+
+// The size of one texel, in texture-coordinates.
+#define coone 1.0 / rubyTextureSize
+
+#define mod_factor tex.x * rubyTextureSize.x * rubyOutputSize.x / rubyInputSize.x
+
+#ifdef LINEAR_PROCESSING
+#       define TEX2D(c) pow(myTex2D(s0, (c)), CRTgamma)
+#else
+#       define TEX2D(c) myTex2D(s0, (c))
+#endif
+
+float intersect(float2 xy)
+{
+  float A = dot(xy,xy) + (d * d);
+  float B = 2.0 * (R * (dot(xy, sinangle) - d * cosangle.x * cosangle.y) - d * d);
+  float C = d * d + 2.0 * R * d * cosangle.x * cosangle.y; //all constants
+  return (-B - sqrt(B * B -4.0 * A * C)) / (2.0 * A);
+}
+
+
+float2 bkwtrans(float2 xy)
+{
+  float c = intersect(xy);
+  float2 _point = float2(c, c) * xy;
+  _point -= float2(-R, -R) * sinangle;
+  _point /= float2(R, R);
+  float2 tang = sinangle / cosangle;
+  float2 poc = _point / cosangle;
+  float A = dot(tang, tang) + 1.0;
+  float B = -2.0 * dot(poc, tang);
+  float C = dot(poc, poc) - 1.0;
+  float a = (-B + sqrt(B * B -4.0 * A * C)) / (2.0 * A);
+  float2 uv = (_point - a * sinangle) / cosangle;
+  float r = R * acos(a);
+  return uv * r / sin(r / R);
+}
+
+float2 fwtrans(float2 uv)
+{
+  float r = FIX(sqrt(dot(uv, uv)));
+  uv *= sin(r / R) / r;
+  float x = 1.0 - cos(r / R);
+  float D = d / R + x * cosangle.x * cosangle.y + dot(uv, sinangle);
+  return d * (uv * cosangle - x * sinangle) / D;
+}
+
+float3 maxscale()
+{
+  float2 c = bkwtrans(-R * sinangle / (1.0 + R / d * cosangle.x * cosangle.y));
+  float2 a = float2(0.5, 0.5) * aspect;
+  float2 lo = float2(fwtrans(float2(-a.x, c.y)).x,
+		             fwtrans(float2(c.x,-a.y)).y) / aspect;
+  float2 hi = float2(fwtrans(float2(+a.x, c.y)).x,
+		             fwtrans(float2(c.x, +a.y)).y) / aspect;
+  return float3((hi + lo) * aspect * 0.5, max(hi.x - lo.x, hi.y - lo.y));
+}
+
+float2 transform(float2 coord, float2 textureSize, float2 inputSize)
+{
+  coord *= textureSize / inputSize;
+  coord = (coord - 0.5) * aspect * stretch.z + stretch.xy;
+  return (bkwtrans(coord) / float2(CRTOverScan, CRTOverScan) / aspect + 0.5) * inputSize / textureSize;
+}
+
+float corner(float2 coord, float2 textureSize, float2 inputSize)
+{
+  coord *= textureSize / inputSize;
+  coord = (coord - 0.5) * float2(CRTOverScan, CRTOverScan) + 0.5;
+  coord = min(coord, 1.0 - coord) * aspect;
+  float2 cdist = float2(CRTCornerSize, CRTCornerSize);
+  coord = (cdist - min(coord, cdist));
+  float dist = sqrt(dot(coord, coord));
+  return clamp((cdist.x-dist) * 1000.0, 0.0, 1.0);
+}
+
+// Calculate the influence of a scanline on the current pixel.
+//
+// 'distance' is the distance in texture coordinates from the current
+// pixel to the scanline in question.
+// 'color' is the colour of the scanline at the horizontal location of
+// the current pixel.
+float4 scanlineWeights(float distance, float4 color)
+{
+  // "wid" controls the width of the scanline beam, for each RGB channel
+  // The "weights" lines basically specify the formula that gives
+  // you the profile of the beam, i.e. the intensity as
+  // a function of distance from the vertical center of the
+  // scanline. In this case, it is gaussian if width=2, and
+  // becomes nongaussian for larger widths. Ideally this should
+  // be normalized so that the integral across the beam is
+  // independent of its width. That is, for a narrower beam
+  // "weights" should have a higher peak at the center of the
+  // scanline than for a wider beam.
+#if CRTScanlineGaussian == 0
+	float4 wid = 0.3 + 0.1 * pow(color, 3.0);
+	float4 weights = float4(distance / wid);
+	return 0.4 * exp(-weights * weights) / wid;
+#else
+    float4 wid = 2.0 + 2.0 * pow(color, 4.0);
+	float calcdistance = distance / 0.3; // Optimization  ?
+    //float4 weights = float4(distance / 0.3, distance / 0.3, distance / 0.3, distance / 0.3);
+    float4 weights = float4(calcdistance, calcdistance, calcdistance, calcdistance);
+    return 1.4 * exp(-pow(weights * rsqrt(0.5 * wid), wid)) / (0.6 + 0.2 * wid);
+#endif
+}
+
+float4 AdvancedCRTPass( float4 colorInput, float2 tex )
+{
+	// Here's a helpful diagram to keep in mind while trying to
+	// understand the code:
+	//
+	//  |      |      |      |      |
+	// -------------------------------
+	//  |      |      |      |      |
+	//  |  01  |  11  |  21  |  31  | <-- current scanline
+	//  |      | @    |      |      |
+	// -------------------------------
+	//  |      |      |      |      |
+	//  |  02  |  12  |  22  |  32  | <-- next scanline
+	//  |      |      |      |      |
+	// -------------------------------
+	//  |      |      |      |      |
+	//
+	// Each character-cell represents a pixel on the output
+	// surface, "@" represents the current pixel (always somewhere
+	// in the bottom half of the current scan-line, or the top-half
+	// of the next scanline). The grid of lines represents the
+	// edges of the texels of the underlying texture.
+
+	float  Input_ratio = ceil(256 * CRTResolution);
+	float2 Resolution = float2(Input_ratio, Input_ratio);
+	float2 rubyTextureSize = Resolution;
+	float2 rubyInputSize = Resolution;
+	float2 rubyOutputSize = screen_size;
+	
+#if CRTCurvature == 1
+    float2 xy = transform(tex, rubyTextureSize, rubyInputSize);
+#else
+    float2 xy = tex;
+#endif
+	float cval = corner(xy, rubyTextureSize, rubyInputSize);
+  	
+    // Of all the pixels that are mapped onto the texel we are
+    // currently rendering, which pixel are we currently rendering?
+    float2 ratio_scale = xy * rubyTextureSize - 0.5;
+	
+#if CRTOversample == 1
+	float filter = fwidth(ratio_scale.y);
+#endif	
+	float2 uv_ratio = frac(ratio_scale);
+
+    // Snap to the center of the underlying texel.
+    xy = (floor(ratio_scale) + 0.5) / rubyTextureSize;
+
+	// Calculate Lanczos scaling coefficients describing the effect
+	// of various neighbour texels in a scanline on the current
+	// pixel.
+	float4 coeffs = PI * float4(1.0 + uv_ratio.x, uv_ratio.x, 1.0 - uv_ratio.x, 2.0 - uv_ratio.x);
+
+	// Prevent division by zero.
+	coeffs = FIX(coeffs);
+
+	// Lanczos2 kernel.
+	coeffs = 2.0 * sin(coeffs) * sin(coeffs / 2.0) / (coeffs * coeffs);
+
+	// Normalize.
+	coeffs /= dot(coeffs, 1.0);
+	
+	// Calculate the effective colour of the current and next
+	// scanlines at the horizontal location of the current pixel,
+	// using the Lanczos coefficients above.
+	float4 col  = clamp(mul(coeffs, float4x4(
+			TEX2D(xy + float2(-coone.x, 0.0)),
+			TEX2D(xy),
+			TEX2D(xy + float2(coone.x, 0.0)),
+			TEX2D(xy + float2(2.0 * coone.x, 0.0)))),
+			0.0, 1.0);
+	float4 col2 = clamp(mul(coeffs, float4x4(
+			TEX2D(xy + float2(-coone.x, coone.y)),
+			TEX2D(xy + float2(0.0, coone.y)),
+			TEX2D(xy + coone),
+			TEX2D(xy + float2(2.0 * coone.x, coone.y)))),
+			0.0, 1.0);
+
+#ifndef LINEAR_PROCESSING
+    col  = pow(col , CRTgamma);
+    col2 = pow(col2, CRTgamma);
+#endif
+
+	// Calculate the influence of the current and next scanlines on
+	// the current pixel.
+	float4 weights  = scanlineWeights(uv_ratio.y, col);
+	float4 weights2 = scanlineWeights(1.0 - uv_ratio.y, col2);
+	
+#if CRTOversample == 1
+    uv_ratio.y = uv_ratio.y + 1.0 / 3.0 * filter;
+    weights = (weights + scanlineWeights(uv_ratio.y, col)) / 3.0;
+    weights2 = (weights2 + scanlineWeights(abs(1.0 - uv_ratio.y), col2)) / 3.0;
+    uv_ratio.y = uv_ratio.y - 2.0 / 3.0 * filter;
+    weights = weights + scanlineWeights(abs(uv_ratio.y), col) / 3.0;
+    weights2 = weights2 + scanlineWeights(abs(1.0 - uv_ratio.y), col2) / 3.0;
+#endif
+	
+	float3 mul_res  = (col * weights + col2 * weights2).rgb * float3(cval, cval, cval);
+
+	// dot-mask emulation:
+	// Output pixels are alternately tinted green and magenta.
+	float3 dotMaskWeights = lerp(float3(1.0, 0.7, 1.0), 
+                                 float3(0.7, 1.0, 0.7), 
+                                 floor(mod_factor % CRTScanlineIntensity));
+
+	mul_res *= dotMaskWeights * float3(0.83, 0.83, 1.0) * CRTBrightness;
+
+	// Convert the image gamma for display on our output device.
+	mul_res = pow(mul_res, 1.0 / CRTmonitorgamma);
+
+	//return saturate(lerp(colorInput, float4(mul_res, 1.0), CRTAmount));
+	colorInput.rgb = lerp(colorInput.rgb, mul_res, CRTAmount);
+	return saturate(colorInput);
+}

+ 54 - 0
Game Folder/SweetFX/Shaders/Bloom.h

@@ -0,0 +1,54 @@
+/*------------------------------------------------------------------------------
+						BLOOM
+------------------------------------------------------------------------------*/
+
+float4 BloomPass( float4 ColorInput2,float2 Tex  )
+{
+	float3 BlurColor2 = 0;
+	float3 Blurtemp = 0;
+	//float MaxDistance = sqrt(8*BloomWidth);
+	float MaxDistance = 8*BloomWidth; //removed sqrt
+	float CurDistance = 0;
+	
+	//float Samplecount = 0;
+	float Samplecount = 25.0;
+	
+	float2 blurtempvalue = Tex * pixel * BloomWidth;
+	
+	//float distancetemp = 1.0 - ((MaxDistance - CurDistance) / MaxDistance);
+	
+	float2 BloomSample = float2(2.5,-2.5);
+	float2 BloomSampleValue;// = BloomSample;
+	
+	for(BloomSample.x = (2.5); BloomSample.x > -2.0; BloomSample.x = BloomSample.x - 1.0) // runs 5 times
+	{
+        BloomSampleValue.x = BloomSample.x * blurtempvalue.x;
+        float2 distancetemp = BloomSample.x * BloomSample.x * BloomWidth;
+        
+		for(BloomSample.y = (- 2.5); BloomSample.y < 2.0; BloomSample.y = BloomSample.y + 1.0) // runs 5 ( * 5) times
+		{
+            distancetemp.y = BloomSample.y * BloomSample.y;
+			//CurDistance = sqrt(dot(BloomSample,BloomSample)*BloomWidth); //dot() attempt - same result , same speed. //move x part up ?
+			//CurDistance = sqrt( (distancetemp.y * BloomWidth) + distancetemp.x); //dot() attempt - same result , same speed. //move x part up ?
+			CurDistance = (distancetemp.y * BloomWidth) + distancetemp.x; //removed sqrt
+			
+			//Blurtemp.rgb = myTex2D(s0, float2(Tex + (BloomSample*blurtempvalue))); //same result - same speed.
+			BloomSampleValue.y = BloomSample.y * blurtempvalue.y;
+			Blurtemp.rgb = myTex2D(s0, float2(Tex + BloomSampleValue)).rgb; //same result - same speed.
+			
+			//BlurColor2.rgb += lerp(Blurtemp.rgb,ColorInput2.rgb, 1 - ((MaxDistance - CurDistance)/MaxDistance)); //convert float4 to float3 and check if it's possible to use a MAD
+			//BlurColor2.rgb += lerp(Blurtemp.rgb,ColorInput2.rgb, 1.0 - ((MaxDistance - CurDistance) / MaxDistance)); //convert float4 to float3 and check if it's possible to use a MAD
+			BlurColor2.rgb += lerp(Blurtemp.rgb,ColorInput2.rgb, sqrt(CurDistance / MaxDistance)); //reduced number of sqrts needed
+
+			
+			//Samplecount = Samplecount + 1; //take out of loop and replace with constant if it helps (check with compiler)
+		}
+	}
+	BlurColor2.rgb = (BlurColor2.rgb / (Samplecount - (BloomPower - BloomThreshold*5))); //check if using MAD
+	float Bloomamount = (dot(ColorInput2.rgb,float3(0.299f, 0.587f, 0.114f))) ; //try BT 709
+	float3 BlurColor = BlurColor2.rgb * (BloomPower + 4.0); //check if calculated offline and combine with line 24 (the blurcolor2 calculation)
+
+	ColorInput2.rgb = lerp(ColorInput2.rgb,BlurColor.rgb, Bloomamount);	
+
+	return saturate(ColorInput2);
+}

+ 38 - 0
Game Folder/SweetFX/Shaders/Border.h

@@ -0,0 +1,38 @@
+  /*-----------------------------------------------------------.
+ /                          Border                            /
+'-----------------------------------------------------------*/
+// Version 1.2
+
+/*
+Version 1.0 by Oomek
+- Fixes light, one pixel thick border in some games when forcing MSAA like i.e. Dishonored
+
+Version 1.1 by CeeJay.dk
+- Optimized the shader. It still does the same but now it runs faster.
+
+Version 1.2 by CeeJay.dk
+- Added border_width and border_color features
+
+Version 1.3 by CeeJay.dk
+- Optimized the performance further
+*/
+
+#ifndef border_width
+  #define border_width float2(1,0)
+#endif
+#ifndef border_color
+  #define border_color float3(0, 0, 0)
+#endif
+
+float4 BorderPass( float4 colorInput, float2 tex )
+{
+float3 border_color_float = border_color / 255.0;
+
+float2 border = (pixel * border_width); //Translate integer pixel width to floating point
+float2 within_border = saturate((-tex * tex + tex) - (-border * border + border)); //becomes positive when inside the border and 0 when outside
+
+colorInput.rgb = all(within_border) ?  colorInput.rgb : border_color_float ; //
+
+return colorInput; //return the pixel
+
+} 

+ 24 - 0
Game Folder/SweetFX/Shaders/Cartoon.h

@@ -0,0 +1,24 @@
+/*------------------------------------------------------------------------------
+						Cartoon
+------------------------------------------------------------------------------*/
+
+#ifndef CartoonEdgeSlope //for backwards compatiblity with settings preset from earlier versions of SweetFX
+  #define CartoonEdgeSlope 1.5 
+#endif
+
+float4 CartoonPass( float4 colorInput, float2 Tex )
+{
+  float3 CoefLuma2 = float3(0.2126, 0.7152, 0.0722);  //Values to calculate luma with
+  
+  float diff1 = dot(CoefLuma2,myTex2D(s0, Tex + pixel).rgb);
+  diff1 = dot(float4(CoefLuma2,-1.0),float4(myTex2D(s0, Tex - pixel).rgb , diff1));
+  
+  float diff2 = dot(CoefLuma2,myTex2D(s0, Tex +float2(pixel.x,-pixel.y)).rgb);
+  diff2 = dot(float4(CoefLuma2,-1.0),float4(myTex2D(s0, Tex +float2(-pixel.x,pixel.y)).rgb , diff2));
+    
+  float edge = dot(float2(diff1,diff2),float2(diff1,diff2));
+  
+  colorInput.rgb =  pow(edge,CartoonEdgeSlope) * -CartoonPower + colorInput.rgb;
+	
+  return saturate(colorInput);
+}

+ 223 - 0
Game Folder/SweetFX/Shaders/Curves.h

@@ -0,0 +1,223 @@
+   /*-----------------------------------------------------------.
+  /                          Curves                             /
+  '-----------------------------------------------------------*/
+/*
+  by Christian Cann Schuldt Jensen ~ CeeJay.dk
+
+  Curves, uses S-curves to increase contrast, without clipping highlights and shadows.
+*/
+
+float4 CurvesPass( float4 colorInput )
+{
+  float3 lumCoeff = float3(0.2126, 0.7152, 0.0722);  //Values to calculate luma with
+  float Curves_contrast_blend = Curves_contrast;
+  float PI = acos(-1); //3.1415926589
+
+   /*-----------------------------------------------------------.
+  /               Separation of Luma and Chroma                 /
+  '-----------------------------------------------------------*/
+
+  // -- Calculate Luma and Chroma if needed --
+  #if Curves_mode != 2
+
+    //calculate luma (grey)
+    float luma = dot(lumCoeff, colorInput.rgb);
+
+    //calculate chroma
+	  float3 chroma = colorInput.rgb - luma;
+  #endif
+
+  // -- Which value to put through the contrast formula? --
+  // I name it x because makes it easier to copy-paste to Graphtoy or Wolfram Alpha or another graphing program
+  #if Curves_mode == 2
+	  float3 x = colorInput.rgb; //if the curve should be applied to both Luma and Chroma
+	#elif Curves_mode == 1
+	  float3 x = chroma; //if the curve should be applied to Chroma
+	  x = x * 0.5 + 0.5; //adjust range of Chroma from -1 -> 1 to 0 -> 1
+  #else // Curves_mode == 0
+    float x = luma; //if the curve should be applied to Luma
+  #endif
+
+   /*-----------------------------------------------------------.
+  /                     Contrast formulas                       /
+  '-----------------------------------------------------------*/
+
+  // -- Curve 1 --
+  #if Curves_formula == 1
+    x = sin(PI * 0.5 * x); // Sin - 721 amd fps, +vign 536 nv
+    x *= x;
+    
+    //x = 0.5 - 0.5*cos(PI*x);
+    //x = 0.5 * -sin(PI * -x + (PI*0.5)) + 0.5;
+  #endif
+
+  // -- Curve 2 --
+  #if Curves_formula == 2
+    x = x - 0.5;  
+    x = ( x / (0.5 + abs(x)) ) + 0.5;
+    
+    //x = ( (x - 0.5) / (0.5 + abs(x-0.5)) ) + 0.5;
+  #endif
+
+  // -- Curve 3 --
+  #if Curves_formula == 3
+    //x = smoothstep(0.0,1.0,x); //smoothstep
+    x = x*x*(3.0-2.0*x); //faster smoothstep alternative - 776 amd fps, +vign 536 nv
+    //x = x - 2.0 * (x - 1.0) * x* (x- 0.5);  //2.0 is contrast. Range is 0.0 to 2.0
+  #endif
+
+  // -- Curve 4 --
+  #if Curves_formula == 4
+    x = (1.0524 * exp(6.0 * x) - 1.05248) / (20.0855 + exp(6.0 * x)); //exp formula
+  #endif
+
+  // -- Curve 5 --
+  #if Curves_formula == 5
+    //x = 0.5 * (x + 3.0 * x * x - 2.0 * x * x * x); //a simplified catmull-rom (0,0,1,1) - btw smoothstep can also be expressed as a simplified catmull-rom using (1,0,1,0)
+    //x = (0.5 * x) + (1.5 -x) * x*x; //estrin form - faster version
+    x = x * (x * (1.5-x) + 0.5); //horner form - fastest version
+
+    Curves_contrast_blend = Curves_contrast * 2.0; //I multiply by two to give it a strength closer to the other curves.
+  #endif
+
+ 	// -- Curve 6 --
+  #if Curves_formula == 6
+    x = x*x*x*(x*(x*6.0 - 15.0) + 10.0); //Perlins smootherstep
+	#endif
+
+	// -- Curve 7 --
+  #if Curves_formula == 7
+    //x = ((x-0.5) / ((0.5/(4.0/3.0)) + abs((x-0.5)*1.25))) + 0.5;
+	x = x - 0.5;
+	x = x / ((abs(x)*1.25) + 0.375 ) + 0.5;
+	//x = ( (x-0.5) / ((abs(x-0.5)*1.25) + (0.5/(4.0/3.0))) ) + 0.5;
+  #endif
+
+  // -- Curve 8 --
+  #if Curves_formula == 8
+    x = (x * (x * (x * (x * (x * (x * (1.6 * x - 7.2) + 10.8) - 4.2) - 3.6) + 2.7) - 1.8) + 2.7) * x * x; //Techicolor Cinestyle - almost identical to curve 1
+  #endif
+
+  // -- Curve 9 --
+  #if Curves_formula == 9
+    x =  -0.5 * (x*2.0-1.0) * (abs(x*2.0-1.0)-2.0) + 0.5; //parabola
+  #endif
+
+  // -- Curve 10 --
+  #if Curves_formula == 10 //Half-circles
+
+    #if Curves_mode == 0
+      float xstep = step(x,0.5);
+	    float xstep_shift = (xstep - 0.5);
+	    float shifted_x = x + xstep_shift;
+    #else
+      float3 xstep = step(x,0.5);
+	    float3 xstep_shift = (xstep - 0.5);
+	    float3 shifted_x = x + xstep_shift;
+    #endif
+
+	x = abs(xstep - sqrt(-shifted_x * shifted_x + shifted_x) ) - xstep_shift;
+
+  //x = abs(step(x,0.5)-sqrt(-(x+step(x,0.5)-0.5)*(x+step(x,0.5)-0.5)+(x+step(x,0.5)-0.5)))-(step(x,0.5)-0.5); //single line version of the above
+    
+  //x = 0.5 + (sign(x-0.5)) * sqrt(0.25-(x-trunc(x*2))*(x-trunc(x*2))); //worse
+  
+  /* // if/else - even worse
+  if (x-0.5)
+  x = 0.5-sqrt(0.25-x*x);
+  else
+  x = 0.5+sqrt(0.25-(x-1)*(x-1));
+	*/
+
+  //x = (abs(step(0.5,x)-clamp( 1-sqrt(1-abs(step(0.5,x)- frac(x*2%1)) * abs(step(0.5,x)- frac(x*2%1))),0 ,1))+ step(0.5,x) )*0.5; //worst so far
+	
+	//TODO: Check if I could use an abs split instead of step. It might be more efficient
+	
+	Curves_contrast_blend = Curves_contrast * 0.5; //I divide by two to give it a strength closer to the other curves.
+  #endif
+
+  // -- Curve 11 --
+  #if Curves_formula == 11 //Cubic catmull
+    float a = 1.00; //control point 1
+    float b = 0.00; //start point
+    float c = 1.00; //endpoint
+    float d = 0.20; //control point 2
+    x = 0.5 * ((-a + 3*b -3*c + d)*x*x*x + (2*a -5*b + 4*c - d)*x*x + (-a+c)*x + 2*b); //A customizable cubic catmull-rom spline
+  #endif
+
+  // -- Curve 12 --
+  #if Curves_formula == 12 //Cubic Bezier spline
+    float a = 0.00; //start point
+    float b = 0.00; //control point 1
+    float c = 1.00; //control point 2
+    float d = 1.00; //endpoint
+
+    float r  = (1-x);
+	float r2 = r*r;
+	float r3 = r2 * r;
+	float x2 = x*x;
+	float x3 = x2*x;
+	//x = dot(float4(a,b,c,d),float4(r3,3*r2*x,3*r*x2,x3));
+
+	//x = a * r*r*r + r * (3 * b * r * x + 3 * c * x*x) + d * x*x*x;
+	//x = a*(1-x)*(1-x)*(1-x) +(1-x) * (3*b * (1-x) * x + 3 * c * x*x) + d * x*x*x;
+	x = a*(1-x)*(1-x)*(1-x) + 3*b*(1-x)*(1-x)*x + 3*c*(1-x)*x*x + d*x*x*x;
+  #endif
+
+  // -- Curve 13 --
+  #if Curves_formula == 13 //Cubic Bezier spline - alternative implementation.
+    float3 a = float3(0.00,0.00,0.00); //start point
+    float3 b = float3(0.25,0.15,0.85); //control point 1
+    float3 c = float3(0.75,0.85,0.15); //control point 2
+    float3 d = float3(1.00,1.00,1.00); //endpoint
+
+    float3 ab = lerp(a,b,x);           // point between a and b
+    float3 bc = lerp(b,c,x);           // point between b and c
+    float3 cd = lerp(c,d,x);           // point between c and d
+    float3 abbc = lerp(ab,bc,x);       // point between ab and bc
+    float3 bccd = lerp(bc,cd,x);       // point between bc and cd
+    float3 dest = lerp(abbc,bccd,x);   // point on the bezier-curve
+    x = dest;
+  #endif
+
+  // -- Curve 14 --
+  #if Curves_formula == 14
+    x = 1.0 / (1.0 + exp(-(x * 10.0 - 5.0))); //alternative exp formula
+  #endif
+
+   /*-----------------------------------------------------------.
+  /                 Joining of Luma and Chroma                  /
+  '-----------------------------------------------------------*/
+
+  #if Curves_mode == 2 //Both Luma and Chroma
+	float3 color = x;  //if the curve should be applied to both Luma and Chroma
+	colorInput.rgb = lerp(colorInput.rgb, color, Curves_contrast_blend); //Blend by Curves_contrast
+
+  #elif Curves_mode == 1 //Only Chroma
+	x = x * 2.0 - 1.0; //adjust the Chroma range back to -1 -> 1
+	float3 color = luma + x; //Luma + Chroma
+	colorInput.rgb = lerp(colorInput.rgb, color, Curves_contrast_blend); //Blend by Curves_contrast
+
+  #else // Curves_mode == 0 //Only Luma
+    x = lerp(luma, x, Curves_contrast_blend); //Blend by Curves_contrast
+    colorInput.rgb = x + chroma; //Luma + Chroma
+
+  #endif
+
+  //Return the result
+  return colorInput;
+}
+
+  /*
+  //Working on a proper catmull-rom spline
+  float catmullrom(float t, float p0, float p1, float p2, float p3)
+  {
+    0.5 * ( (2 * p1) + (-p0 + p2) * x + (2 * p0 - 5 * p1 + 4 * p2 - p3) * t * t + (-p0 + 3 * p1 - 3 * p2 + p3) * x * x * x );
+  }
+
+  //0.5 *(  (2 * b) + (-a + c) * x + (2*a - 5*b + 4*c - d) * x*x +(-a + 3*b- 3*c + d) * x*x*x)
+
+  //y = 1/2 *(x (-a *(x-1)^2+c *(-3 * x^2+4 * x+1)+d * x *(x-1))+b (3 * x^3-5 * x^2+2)) //reduce
+  //a * x * (x * (1 - 0.5 * x) - 0.5) + b * ((1.5 * x - 2.5) * x*x + 1) + x * (x * (x * (0.5 * d - 1.5 * c) + 2 * c - 0.5 * d) + 0.5 * c) //horner
+
+  */

+ 23 - 0
Game Folder/SweetFX/Shaders/Custom.h

@@ -0,0 +1,23 @@
+   /*-----------------------------------------------------------.
+  /                           Custom                            /
+  '-----------------------------------------------------------*/
+/*
+
+*/
+
+#define CustomLuma float3(0.2126, 0.7152, 0.0722)
+
+float4 CustomPass( float4 colorInput, float2 tex )
+{
+
+  //just some example code. 
+  float luma = dot(colorInput.rgb,CustomLuma); //Calculate luma
+  float3 chroma = colorInput.rgb - luma; //Calculate chroma
+  float3 color = 1.0 - luma; //invert the luma
+  
+  color = color + chroma; //add the chroma back in
+  
+  colorInput.rgb = lerp(colorInput.rgb, color, custom_strength); //Adjust the strength of the effect
+
+  return saturate(colorInput);
+}

+ 74 - 0
Game Folder/SweetFX/Shaders/DPX.h

@@ -0,0 +1,74 @@
+/*
+DPX/Cineon shader by Loadus ( http://www.loadusfx.net/virtualdub/DPX.fx )
+
+Version 1.0
+Ported to SweetFX by CeeJay.dk
+
+Version 1.1
+Improved performance
+
+*/
+
+static float3x3 RGB =
+{
+2.67147117265996,-1.26723605786241,-0.410995602172227,
+-1.02510702934664,1.98409116241089,0.0439502493584124,
+0.0610009456429445,-0.223670750812863,1.15902104167061
+};
+
+static float3x3 XYZ =
+{
+0.500303383543316,0.338097573222739,0.164589779545857,
+0.257968894274758,0.676195259144706,0.0658358459823868,
+0.0234517888692628,0.1126992737203,0.866839673124201
+};
+
+float4 DPXPass(float4 InputColor){
+
+	float DPXContrast = 0.1;
+
+	float DPXGamma = 1.0;
+
+	float RedCurve = Red;
+	float GreenCurve = Green;
+	float BlueCurve = Blue;
+	
+	float3 RGB_Curve = float3(Red,Green,Blue);
+	float3 RGB_C = float3(RedC,GreenC,BlueC);
+
+	float3 B = InputColor.rgb;
+	//float3 Bn = B; // I used InputColor.rgb instead.
+
+	B = pow(B, 1.0/DPXGamma);
+
+  B = B * (1.0 - DPXContrast) + (0.5 * DPXContrast);
+
+
+    //B = (1.0 /(1.0 + exp(- RGB_Curve * (B - RGB_C))) - (1.0 / (1.0 + exp(RGB_Curve / 2.0))))/(1.0 - 2.0 * (1.0 / (1.0 + exp(RGB_Curve / 2.0))));
+	
+    float3 Btemp = (1.0 / (1.0 + exp(RGB_Curve / 2.0)));	  
+	  B = ((1.0 / (1.0 + exp(-RGB_Curve * (B - RGB_C)))) / (-2.0 * Btemp + 1.0)) + (-Btemp / (-2.0 * Btemp + 1.0));
+
+
+     //TODO use faster code for conversion between RGB/HSV  -  see http://www.chilliant.com/rgb2hsv.html
+	   float value = max(max(B.r, B.g), B.b);
+	   float3 color = B / value;
+	
+	   color = pow(color, 1.0/ColorGamma);
+	
+	   float3 c0 = color * value;
+
+	   c0 = mul(XYZ, c0);
+
+	   float luma = dot(c0, float3(0.30, 0.59, 0.11)); //Use BT 709 instead?
+
+ 	   //float3 chroma = c0 - luma;
+	   //c0 = chroma * DPXSaturation + luma;
+	   c0 = (1.0 - DPXSaturation) * luma + DPXSaturation * c0;
+	   
+	   c0 = mul(RGB, c0);
+	
+	InputColor.rgb = lerp(InputColor.rgb, c0, Blend);
+
+	return InputColor;
+}

+ 193 - 0
Game Folder/SweetFX/Shaders/Dither.h

@@ -0,0 +1,193 @@
+  /*-------------.
+  | :: Dither :: |
+  '-------------*/
+/*
+  Dither version 1.3.0
+  by Christian Cann Schuldt Jensen ~ CeeJay.dk
+
+  Does dithering of the greather than 8-bit per channel precision used in shaders.
+  Note that the input from the framebuffer is 8-bit and cannot be dithered down to 8-bit.
+  Dithering therefore only works on the effects that SweetFX applies afterwards.
+*/
+
+#ifndef dither_method
+  #define dither_method 1
+#endif
+
+float4 DitherPass( float4 colorInput, float2 tex )
+{
+   float3 color = colorInput.rgb;
+
+   float dither_bit  = 8.0;  //Number of bits per channel. Should be 8 for most monitors.
+   
+   //color = (tex.x*0.3+0.1); //draw a gradient for testing.
+   //#define dither_method 2 //override method for testing purposes
+
+  /*------------------------.
+  | :: Ordered Dithering :: |
+  '------------------------*/
+   #if dither_method == 1 // Ordered dithering
+     //Calculate grid position
+     float grid_position = frac( dot(tex, (screen_size * float2(1.0/16.0,10.0/36.0)  )+(0.25) ) );
+
+     //Calculate how big the shift should be
+     float dither_shift = (0.25) * (1.0 / (pow(2,dither_bit) - 1.0));
+
+     //Shift the individual colors differently, thus making it even harder to see the dithering pattern
+     float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift); //subpixel dithering
+
+     //modify shift acording to grid position.
+     dither_shift_RGB = lerp(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position); //shift acording to grid position.
+
+     //shift the color by dither_shift
+     color.rgb += dither_shift_RGB;
+
+
+  /*-----------------------.
+  | :: Random Dithering :: |
+  '-----------------------*/
+   #elif dither_method == 2 //Random dithering
+
+     //Pseudo Random Number Generator
+     // -- PRNG 1 - Reference --
+     float seed = dot(tex, float2(12.9898,78.233)); //I could add more salt here if I wanted to
+     float sine = sin(seed); //cos also works well. Sincos too if you want 2D noise.
+     float noise = frac(sine * 43758.5453 + tex.x); //tex.x is just some additional salt - it can be taken out.
+
+     //Calculate how big the shift should be
+     float dither_shift = (1.0 / (pow(2,dither_bit) - 1.0)); // Using noise to determine shift. Will be 1/255 if set to 8-bit.
+     float dither_shift_half = (dither_shift * 0.5); // The noise should vary between +- 0.5
+     dither_shift = dither_shift * noise - dither_shift_half; // MAD
+
+     //shift the color by dither_shift
+     color.rgb += float3(-dither_shift, dither_shift, -dither_shift); //subpixel dithering
+
+  /*--------------------.
+  | :: New Dithering :: |
+  '--------------------*/
+  //#define dither_method 3
+   #elif dither_method == 3 // New Ordered dithering
+
+     //Calculate grid position
+     float grid_position = frac(dot(tex,(screen_size) * float2(0.75,0.5) /*+ (0.00025)*/)); //(0.6,0.8) is good too - TODO : experiment with values
+
+     //Calculate how big the shift should be
+     float dither_shift = (0.25) * (1.0 / (pow(2,dither_bit) - 1.0)); // 0.25 seems good both when using math and when eyeballing it. So does 0.75 btw.
+     dither_shift = lerp(2.0 * dither_shift, -2.0 * dither_shift, grid_position); //shift acording to grid position.
+
+     //shift the color by dither_shift
+     color.rgb += float3(dither_shift, -dither_shift, dither_shift); //subpixel dithering
+
+  /*-------------------------.
+  | :: A Dither Dithering :: |
+  '-------------------------*/
+  //#define dither_method 4
+  #elif dither_method == 4 // New Ordered dithering
+
+  #define dither_pattern 11
+  #define dither_levels 254
+
+  float x=tex.x * screen_size.x;// * 1.31;
+  float y=tex.y * screen_size.y;// * 1.31;
+
+  //Calculate grid position
+  float c = frac(dot(tex,(screen_size) * float2(1.0/4.0,3.0/4.0) + (0.00025) )); //the + (0.00025) part is to avoid errors with the floating point math
+
+  float mask;
+
+  #if dither_pattern == 1
+    mask = ((x ^ y * 149) * 1234 & 511)/511.0; //requires bitwise XOR - doesn't work
+  #elif dither_pattern == 2
+    mask = (((x+c*17) ^ y * 149) * 1234 & 511)/511.0; //requires bitwise XOR - doesn't work
+  #elif dither_pattern == 3
+    mask = 256.0 * frac(((x + y * 237) * 119)/ 256.0 ) / 255.0 ;//1.00392 * frac(0.464844 * (x + 237.0 * y)); //256.0 * frac(((x + y * 237) * 119)/ 256.0 ) / 255.0
+  #elif dither_pattern == 4
+    mask = (256.0 * frac((((x+c*67.0) + y * 236.0) * 119.0) / 256.0)) / 255.0; //& 255 = 256 * frac(x / 256)
+  #elif dither_pattern == 5
+    mask = 0.5;
+  #elif dither_pattern == 6
+    mask = frac( dot(tex, float2(12.9898,78.233)) * 927.5453 );
+  #elif dither_pattern == 7
+    mask = frac( dot(tex, (screen_size * float2(1.0/7.0,9.0/17.0))+(0.00025) ) );
+  #elif dither_pattern == 8
+    mask = frac( dot(tex, (screen_size * float2(5.0/7.0,3.0/17.0))+(0.00025) ) );
+  #elif dither_pattern == 9
+    mask = frac( dot(tex, (screen_size * float2(1.0/4.0,3.0/5.0))+(0.000025) ) );
+  #elif dither_pattern == 10
+    mask = frac( dot(tex, (screen_size * float2(1.0/87.0,1.0/289.0))+(0.000025) ) ); //stylish pattern - but bad for dithering
+  #elif dither_pattern == 11
+    //mask = frac( dot(tex, (screen_size * float2(1.0/(floor(tex.y*10.0)/100.+16.0),87.0/289.0))+(0.000025) ) ); //
+	//mask = frac( dot(float4(tex,tex), float4((screen_size * float2(0.666/16.0,6.66/36.)),(screen_size * float2(0.3344/16.0,3.34/36.)) ) ) ); //
+      mask = frac( dot(tex, (screen_size * float2(1.0/16.0,10.0/36.0)  )+(0.25) ) ); //
+//(floor(tex.y*10.0)/100.0 + 3.0)
+  #else
+    //return input;
+  #endif
+
+  color.rgb = floor(dither_levels * color.rgb + mask) / dither_levels;
+  color.rgb = mask.xxx;
+
+  /*---------------------------------------.
+  | :: New Dithering - grid experiments :: |
+  '---------------------------------------*/
+  //#define dither_method 5
+   #elif dither_method == 5 // New Ordered dithering
+
+     //Calculate grid position
+     float grid_position = frac(dot(tex,floor(screen_size * float2(-0.5,-0.9) ) /*- (0.00025)*/ )); //(0.6,0.8) is good too - TODO : experiment with values
+
+     //Calculate grid position
+     grid_position = frac(dot(tex,floor(screen_size * float2(0.4,0.70)) /*+ grid_position*/ /*+ (0.00025)*/ )); //
+
+     //Calculate how big the shift should be
+     float dither_shift = (0.25) * (1.0 / (pow(2,dither_bit) - 1.0)); // 0.25 seems good both when using math and when eyeballing it. So does 0.75 btw.
+     dither_shift = lerp(2.0 * dither_shift, -2.0 * dither_shift, grid_position); //shift acording to grid position.
+
+     //dither_shift = (2.0 * dither_shift) * grid_position + (2.0 * dither_shift) * grid_position;
+     //dither_shift = 4.0 * dither_shift * grid_position;
+
+     //shift the color by dither_shift
+     //color.rgb += lerp(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position); //shift acording to grid position.
+
+     color.rgb += float3(dither_shift, -dither_shift, dither_shift); //subpixel dithering
+
+  /*-------------------.
+  | :: Checkerboard :: |
+  '-------------------*/
+   #elif dither_method == 6 // Checkerboard Ordered dithering
+     //Calculate grid position
+     float grid_position = frac(dot(tex, screen_size * 0.5) + 0.25); //returns 0.25 and 0.75
+
+     //Calculate how big the shift should be
+     float dither_shift = (0.25) * (1.0 / (pow(2,dither_bit) - 1.0)); // 0.25 seems good both when using math and when eyeballing it. So does 0.75 btw.
+
+     //Shift the individual colors differently, thus making it even harder to see the dithering pattern
+     float3 dither_shift_RGB = float3(dither_shift, -dither_shift, dither_shift); //subpixel dithering
+
+     //modify shift acording to grid position.
+     dither_shift_RGB = lerp(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position); //shift acording to grid position.
+
+     //shift the color by dither_shift
+     //color.rgb += lerp(2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position); //shift acording to grid position.
+     color.rgb += dither_shift_RGB;
+
+   #endif
+
+  /*-------------------------.
+  | :: Debugging features :: |
+  '-------------------------*/
+   //color.rgb = (dither_shift_RGB * 2.0 * (pow(2,dither_bit) - 1.0) ) + 0.5; //visualize the RGB shift
+   //color.rgb = grid_position; //visualize the grid
+   //color.rgb = noise; //visualize the noise
+   //color.rgb = c;
+
+  /*---------------------------.
+  | :: Returning the output :: |
+  '---------------------------*/
+
+   //color = (tex.x / 2.0); //draw a undithered gradient for testing.
+
+   colorInput.rgb = color.rgb;
+
+   return colorInput;
+}

+ 23 - 0
Game Folder/SweetFX/Shaders/Explosion.h

@@ -0,0 +1,23 @@
+   /*-----------------------------------------------------------.   
+  /                         Explosion                           /
+  '-----------------------------------------------------------*/
+/* 
+
+*/
+
+float4 ExplosionPass( float4 colorInput, float2 tex )
+{
+
+  // -- pseudo random number generator --
+  float2 sine_cosine;
+  sincos(dot(tex, float2(12.9898,78.233)),sine_cosine.x,sine_cosine.y);
+  sine_cosine = sine_cosine * 43758.5453 + tex;
+  float2 noise = frac(sine_cosine);
+
+  tex = (-Explosion_Radius * pixel) + tex; //Slightly faster this way because it can be calculated while we calculate noise.
+  
+  colorInput.rgb = myTex2D(s0, (2.0 * Explosion_Radius * pixel) * noise + tex).rgb;
+  
+ 
+  return colorInput;
+}

+ 749 - 0
Game Folder/SweetFX/Shaders/Fxaa3_11.h

@@ -0,0 +1,749 @@
+/*============================================================================
+
+
+                    NVIDIA FXAA 3.11 by TIMOTHY LOTTES
+					
+					FXAA POST PROCESS INJECTION MODIFIED VERSION
+
+------------------------------------------------------------------------------
+COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED.
+------------------------------------------------------------------------------
+TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED
+*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA
+OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR
+CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR
+LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION,
+OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE
+THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+------------------------------------------------------------------------------
+                           INTEGRATION CHECKLIST
+------------------------------------------------------------------------------
+(1.)
+In the shader source, setup defines for the desired configuration.
+When providing multiple shaders (for different presets),
+simply setup the defines differently in multiple files.
+Example,
+
+	#define FXAA_HLSL_3 1
+Or,
+	#define FXAA_HLSL_4 1
+Or,
+	#define FXAA_HLSL_5 1
+Or,
+	FXAA_GLSL_120
+Or,
+	FXAA_GLSL_130
+	
+(2.)
+Then include this file,
+
+  #include "Fxaa3_11.h"
+
+(3.)
+Then call the FXAA pixel shader from within your desired shader.
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+As for FXAA 3.11 all inputs for all shaders are the same 
+to enable easy porting between platforms.
+
+  return FxaaPixelShader(...);
+
+(4.)
+Insure pass prior to FXAA outputs RGBL (see next section).
+
+(5.)
+Setup engine to provide the following constants
+which are used in the FxaaPixelShader() inputs,
+
+  FxaaFloat2 fxaaQualityRcpFrame,
+  FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+  FxaaFloat fxaaQualitySubpix,
+  FxaaFloat fxaaQualityEdgeThreshold,
+  FxaaFloat fxaaQualityEdgeThresholdMin
+
+Look at the FXAA Quality FxaaPixelShader() for docs on inputs.
+
+(6.)
+Have FXAA vertex shader run as a full screen triangle,
+and output "pos"
+
+  // {xy} = center of pixel
+  FxaaFloat2 pos,
+
+(7.)
+Insure the texture sampler(s) used by FXAA are set to bilinear filtering.
+
+============================================================================*/
+
+/*============================================================================
+
+                             INTEGRATION KNOBS
+
+============================================================================*/
+#ifndef FXAA_GLSL_120
+    #define FXAA_GLSL_120 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GLSL_130
+    #define FXAA_GLSL_130 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_3
+    #define FXAA_HLSL_3 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_4
+    #define FXAA_HLSL_4 0
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_HLSL_5
+    #define FXAA_HLSL_5 0
+#endif
+/*==========================================================================*/
+#ifndef FXAA_FAST_PIXEL_OFFSET
+    //
+    // Used for GLSL 120 only.
+    //
+    // 1 = GL API supports fast pixel offsets
+    // 0 = do not use fast pixel offsets
+    //
+    #ifdef GL_EXT_gpu_shader4
+        #define FXAA_FAST_PIXEL_OFFSET 1
+    #endif
+    #ifdef GL_NV_gpu_shader5
+        #define FXAA_FAST_PIXEL_OFFSET 1
+    #endif
+    #ifdef GL_ARB_gpu_shader5
+        #define FXAA_FAST_PIXEL_OFFSET 1
+    #endif
+    #ifndef FXAA_FAST_PIXEL_OFFSET
+        #define FXAA_FAST_PIXEL_OFFSET 0
+    #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#ifndef FXAA_GATHER4_ALPHA
+    //
+    // 1 = API supports gather4 on alpha channel.
+    // 0 = API does not support gather4 on alpha channel.
+    //
+    #if (FXAA_HLSL_5 == 1)
+        #define FXAA_GATHER4_ALPHA 1
+    #endif
+    #ifdef GL_ARB_gpu_shader5
+        #define FXAA_GATHER4_ALPHA 1
+    #endif
+    #ifdef GL_NV_gpu_shader5
+        #define FXAA_GATHER4_ALPHA 1
+    #endif
+    #ifndef FXAA_GATHER4_ALPHA
+        #define FXAA_GATHER4_ALPHA 0
+    #endif
+#endif
+/*============================================================================
+                        FXAA QUALITY - TUNING KNOBS
+------------------------------------------------------------------------------
+NOTE the other tuning knobs are now in the shader function inputs!
+============================================================================*/
+#ifndef FXAA_QUALITY__PRESET
+    // Choose the quality preset.
+    // This needs to be compiled into the shader as it effects code.
+    // Best option to include multiple presets is to 
+    // in each shader define the preset, then include this file.
+    // 
+    // OPTIONS
+    // -----------------------------------------------------------------------
+    // 2 to 3 - default medium dither (10=fastest, 15=highest quality)
+    // 4 to 5 - less dither, more expensive (20=fastest, 29=highest quality)
+    // 6       - no dither, very expensive 
+    // 7 = slightly faster then FXAA 3.9 and higher edge quality (default)
+    // 8 = about same speed as FXAA 3.9 and better than 12
+    // 9 = closest to FXAA 3.9 visually and performance wise
+    #define FXAA_QUALITY__PRESET 9
+#endif
+/*============================================================================
+
+                           FXAA QUALITY - PRESETS
+
+============================================================================*/
+
+/*============================================================================
+                     FXAA QUALITY - MEDIUM DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 1)
+    #define FXAA_QUALITY__PS 3
+    #define FXAA_QUALITY__P0 1.5
+    #define FXAA_QUALITY__P1 3.0
+    #define FXAA_QUALITY__P2 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 2)
+    #define FXAA_QUALITY__PS 5
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 4.0
+    #define FXAA_QUALITY__P4 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 3)
+    #define FXAA_QUALITY__PS 6
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 4.0
+    #define FXAA_QUALITY__P5 12.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 4)
+    #define FXAA_QUALITY__PS 8
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 4.0
+    #define FXAA_QUALITY__P7 12.0
+#endif
+/*============================================================================
+                     FXAA QUALITY - LOW DITHER PRESETS
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 5)
+    #define FXAA_QUALITY__PS 3
+    #define FXAA_QUALITY__P0 1.5
+    #define FXAA_QUALITY__P1 2.0
+    #define FXAA_QUALITY__P2 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 6)
+    #define FXAA_QUALITY__PS 6
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 7)
+    #define FXAA_QUALITY__PS 11
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 2.0
+    #define FXAA_QUALITY__P8 2.0
+    #define FXAA_QUALITY__P9 4.0
+    #define FXAA_QUALITY__P10 8.0
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_QUALITY__PRESET == 8)
+    #define FXAA_QUALITY__PS 12
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.5
+    #define FXAA_QUALITY__P2 2.0
+    #define FXAA_QUALITY__P3 2.0
+    #define FXAA_QUALITY__P4 2.0
+    #define FXAA_QUALITY__P5 2.0
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 2.0
+    #define FXAA_QUALITY__P8 2.0
+    #define FXAA_QUALITY__P9 2.0
+    #define FXAA_QUALITY__P10 4.0
+    #define FXAA_QUALITY__P11 8.0
+#endif
+/*============================================================================
+                     FXAA QUALITY - EXTREME QUALITY
+============================================================================*/
+#if (FXAA_QUALITY__PRESET == 9)
+    #define FXAA_QUALITY__PS 12
+    #define FXAA_QUALITY__P0 1.0
+    #define FXAA_QUALITY__P1 1.0
+    #define FXAA_QUALITY__P2 1.0
+    #define FXAA_QUALITY__P3 1.0
+    #define FXAA_QUALITY__P4 1.0
+    #define FXAA_QUALITY__P5 1.5
+    #define FXAA_QUALITY__P6 2.0
+    #define FXAA_QUALITY__P7 2.0
+    #define FXAA_QUALITY__P8 2.0
+    #define FXAA_QUALITY__P9 2.0
+    #define FXAA_QUALITY__P10 4.0
+    #define FXAA_QUALITY__P11 8.0
+#endif
+/*============================================================================
+
+                                API PORTING
+
+============================================================================*/
+#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1)
+    #define FxaaBool bool
+    #define FxaaDiscard discard
+    #define FxaaFloat float
+    #define FxaaFloat2 vec2
+    #define FxaaFloat3 vec3
+    #define FxaaFloat4 vec4
+    #define FxaaHalf float
+    #define FxaaHalf2 vec2
+    #define FxaaHalf3 vec3
+    #define FxaaHalf4 vec4
+    #define FxaaInt2 ivec2
+    #define FxaaSat(x) clamp(x, 0.0, 1.0)
+    #define FxaaTex sampler2D
+#else
+    #define FxaaBool bool
+    #define FxaaDiscard clip(-1)
+    #define FxaaFloat float
+    #define FxaaFloat2 float2
+    #define FxaaFloat3 float3
+    #define FxaaFloat4 float4
+    #define FxaaHalf half
+    #define FxaaHalf2 half2
+    #define FxaaHalf3 half3
+    #define FxaaHalf4 half4
+    #define FxaaSat(x) saturate(x)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_120 == 1)
+    // Requires,
+    //  #version 120
+    // And at least,
+    //  #extension GL_EXT_gpu_shader4 : enable
+    //  (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9)
+    #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0)
+    #if (FXAA_FAST_PIXEL_OFFSET == 1)
+        #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)
+    #else
+        #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0)
+    #endif
+    #if (FXAA_GATHER4_ALPHA == 1)
+        // use #extension GL_ARB_gpu_shader5 : enable
+        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+    #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_GLSL_130 == 1)
+    // Requires "#version 130" or better
+    #define FxaaTexTop(t, p) textureLod(t, p, 0.0)
+    #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o)
+    #if (FXAA_GATHER4_ALPHA == 1)
+        // use #extension GL_ARB_gpu_shader5 : enable
+        #define FxaaTexAlpha4(t, p) textureGather(t, p, 3)
+        #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3)
+        #define FxaaTexGreen4(t, p) textureGather(t, p, 1)
+        #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1)
+    #endif
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1)
+    #define FxaaInt2 float2
+    #define FxaaTex sampler2D
+    #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0))
+    #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0))
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_4 == 1)
+    #define FxaaInt2 int2
+    struct FxaaTex { SamplerState smpl; Texture2D tex; };
+    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+#endif
+/*--------------------------------------------------------------------------*/
+#if (FXAA_HLSL_5 == 1)
+    #define FxaaInt2 int2
+    struct FxaaTex { SamplerState smpl; Texture2D tex; };
+    #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0)
+    #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o)
+    #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p)
+    #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o)
+    #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p)
+    #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o)
+#endif
+/*============================================================================
+                   GREEN AS LUMA OPTION SUPPORT FUNCTION
+============================================================================*/
+FxaaFloat FxaaLuma(FxaaFloat4 rgba) { 
+rgba.w = dot(rgba.rgb, FxaaFloat3(0.299, 0.587, 0.114));
+return	rgba.w; }
+/*============================================================================
+
+                             FXAA3 QUALITY - PC
+
+============================================================================*/
+FxaaFloat4 FxaaPixelShader(
+    //
+    // Use noperspective interpolation here (turn off perspective interpolation).
+    // {xy} = center of pixel
+    FxaaFloat2 pos,
+    //
+    // Input color texture.
+    // {rgb_} = color in linear or perceptual color space
+    FxaaTex tex,
+    //
+    // This must be from a constant/uniform.
+    // {x_} = 1.0/screenWidthInPixels
+    // {_y} = 1.0/screenHeightInPixels
+    FxaaFloat2 fxaaQualityRcpFrame,
+    //
+    // This must be from a constant/uniform.
+    // {x___} = -2.0/screenWidthInPixels  
+    // {_y__} = -2.0/screenHeightInPixels
+    // {__z_} =  2.0/screenWidthInPixels  
+    // {___w} =  2.0/screenHeightInPixels 
+    FxaaFloat4 fxaaConsoleRcpFrameOpt2,
+    //
+    // FXAA_QUALITY__SUBPIX
+    // Choose the amount of sub-pixel aliasing removal.
+    // This can effect sharpness.
+    //   1.00 - upper limit (softer)
+    //   0.75 - default amount of filtering
+    //   0.50 - lower limit (sharper, less sub-pixel aliasing removal)
+    //   0.25 - almost off
+    //   0.00 - completely off
+    FxaaFloat fxaaQualitySubpix,
+    //
+    // FXAA_QUALITY__EDGE_THRESHOLD
+    // The minimum amount of local contrast required to apply algorithm.
+    //   0.333 - too little (faster)
+    //   0.250 - low quality
+    //   0.166 - default
+    //   0.125 - high quality 
+    //   0.063 - overkill (slower)
+    FxaaFloat fxaaQualityEdgeThreshold,
+    //
+    // FXAA_QUALITY__EDGE_THRESHOLD_MIN
+    // Trims the algorithm from processing darks.
+    //   0.0833 - upper limit (default, the start of visible unfiltered edges)
+    //   0.0625 - high quality (faster)
+    //   0.0312 - visible limit (slower)
+    FxaaFloat fxaaQualityEdgeThresholdMin
+) {
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 posM;
+    posM.x = pos.x;
+    posM.y = pos.y;
+    #if (FXAA_GATHER4_ALPHA == 1)
+		FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM);
+        FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1));
+		#define lumaE luma4A.z
+        #define lumaS luma4A.x
+        #define lumaSE luma4A.y
+        #define lumaNW luma4B.w
+        #define lumaN luma4B.z
+        #define lumaW luma4B.x
+    #else
+        FxaaFloat4 rgbyM = FxaaTexTop(tex, posM);
+        #define lumaM rgbyM.y
+        FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy));
+    #endif
+/*--------------------------------------------------------------------------*/
+    FxaaFloat maxSM = max(lumaS, lumaM);
+    FxaaFloat minSM = min(lumaS, lumaM);
+    FxaaFloat maxESM = max(lumaE, maxSM);
+    FxaaFloat minESM = min(lumaE, minSM);
+    FxaaFloat maxWN = max(lumaN, lumaW);
+    FxaaFloat minWN = min(lumaN, lumaW);
+    FxaaFloat rangeMax = max(maxWN, maxESM);
+    FxaaFloat rangeMin = min(minWN, minESM);
+    FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold;
+    FxaaFloat range = rangeMax - rangeMin;
+    FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
+    FxaaBool earlyExit = range < rangeMaxClamped;
+    if(earlyExit)
+            return rgbyM;
+/*--------------------------------------------------------------------------*/
+    #if (FXAA_GATHER4_ALPHA == 0)
+        FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+    #else
+        FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy));
+        FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy));
+    #endif
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaNS = lumaN + lumaS;
+    FxaaFloat lumaWE = lumaW + lumaE;
+    FxaaFloat subpixRcpRange = 1.0/range;
+    FxaaFloat subpixNSWE = lumaNS + lumaWE;
+    FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS;
+    FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaNESE = lumaNE + lumaSE;
+    FxaaFloat lumaNWNE = lumaNW + lumaNE;
+    FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE;
+    FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat lumaNWSW = lumaNW + lumaSW;
+    FxaaFloat lumaSWSE = lumaSW + lumaSE;
+    FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2);
+    FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2);
+    FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW;
+    FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE;
+    FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4;
+    FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE;
+    FxaaFloat lengthSign = fxaaQualityRcpFrame.x;
+    FxaaBool horzSpan = edgeHorz >= edgeVert;
+    FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE;
+/*--------------------------------------------------------------------------*/
+    if(!horzSpan) lumaN = lumaW;
+    if(!horzSpan) lumaS = lumaE;
+    if(horzSpan) lengthSign = fxaaQualityRcpFrame.y;
+    FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat gradientN = lumaN - lumaM;
+    FxaaFloat gradientS = lumaS - lumaM;
+    FxaaFloat lumaNN = lumaN + lumaM;
+    FxaaFloat lumaSS = lumaS + lumaM;
+    FxaaBool pairN = abs(gradientN) >= abs(gradientS);
+    FxaaFloat gradient = max(abs(gradientN), abs(gradientS));
+    if(pairN) lengthSign = -lengthSign;
+    FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange);
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 posB;
+    posB.x = posM.x;
+    posB.y = posM.y;
+    FxaaFloat2 offNP;
+    offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x;
+    offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y;
+    if(!horzSpan) posB.x += lengthSign * 0.5;
+    if( horzSpan) posB.y += lengthSign * 0.5;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat2 posN;
+    posN.x = posB.x - offNP.x * FXAA_QUALITY__P0;
+    posN.y = posB.y - offNP.y * FXAA_QUALITY__P0;
+    FxaaFloat2 posP;
+    posP.x = posB.x + offNP.x * FXAA_QUALITY__P0;
+    posP.y = posB.y + offNP.y * FXAA_QUALITY__P0;
+    FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0;
+    FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN));
+    FxaaFloat subpixE = subpixC * subpixC;
+    FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP));
+/*--------------------------------------------------------------------------*/
+    if(!pairN) lumaNN = lumaSS;
+    FxaaFloat gradientScaled = gradient * 1.0/4.0;
+    FxaaFloat lumaMM = lumaM - lumaNN * 0.5;
+    FxaaFloat subpixF = subpixD * subpixE;
+    FxaaBool lumaMLTZero = lumaMM < 0.0;
+/*--------------------------------------------------------------------------*/
+    lumaEndN -= lumaNN * 0.5;
+    lumaEndP -= lumaNN * 0.5;
+    FxaaBool doneN = abs(lumaEndN) >= gradientScaled;
+    FxaaBool doneP = abs(lumaEndP) >= gradientScaled;
+    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1;
+    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1;
+    FxaaBool doneNP = (!doneN) || (!doneP);
+    if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1;
+    if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1;
+/*--------------------------------------------------------------------------*/
+    if(doneNP) {
+        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+        doneN = abs(lumaEndN) >= gradientScaled;
+        doneP = abs(lumaEndP) >= gradientScaled;
+        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2;
+        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2;
+        doneNP = (!doneN) || (!doneP);
+        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2;
+        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2;
+/*--------------------------------------------------------------------------*/
+        #if (FXAA_QUALITY__PS > 3)
+        if(doneNP) {
+            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+            doneN = abs(lumaEndN) >= gradientScaled;
+            doneP = abs(lumaEndP) >= gradientScaled;
+            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3;
+            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3;
+            doneNP = (!doneN) || (!doneP);
+            if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3;
+            if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3;
+/*--------------------------------------------------------------------------*/
+            #if (FXAA_QUALITY__PS > 4)
+            if(doneNP) {
+                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                doneN = abs(lumaEndN) >= gradientScaled;
+                doneP = abs(lumaEndP) >= gradientScaled;
+                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4;
+                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4;
+                doneNP = (!doneN) || (!doneP);
+                if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4;
+                if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4;
+/*--------------------------------------------------------------------------*/
+                #if (FXAA_QUALITY__PS > 5)
+                if(doneNP) {
+                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                    doneN = abs(lumaEndN) >= gradientScaled;
+                    doneP = abs(lumaEndP) >= gradientScaled;
+                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5;
+                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5;
+                    doneNP = (!doneN) || (!doneP);
+                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5;
+                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5;
+/*--------------------------------------------------------------------------*/
+                    #if (FXAA_QUALITY__PS > 6)
+                    if(doneNP) {
+                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                        doneN = abs(lumaEndN) >= gradientScaled;
+                        doneP = abs(lumaEndP) >= gradientScaled;
+                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6;
+                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6;
+                        doneNP = (!doneN) || (!doneP);
+                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6;
+                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6;
+/*--------------------------------------------------------------------------*/
+                        #if (FXAA_QUALITY__PS > 7)
+                        if(doneNP) {
+                            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                            doneN = abs(lumaEndN) >= gradientScaled;
+                            doneP = abs(lumaEndP) >= gradientScaled;
+                            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7;
+                            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7;
+                            doneNP = (!doneN) || (!doneP);
+                            if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7;
+                            if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7;
+/*--------------------------------------------------------------------------*/
+    #if (FXAA_QUALITY__PS > 8)
+    if(doneNP) {
+        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+        doneN = abs(lumaEndN) >= gradientScaled;
+        doneP = abs(lumaEndP) >= gradientScaled;
+        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8;
+        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8;
+        doneNP = (!doneN) || (!doneP);
+        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8;
+        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8;
+/*--------------------------------------------------------------------------*/
+        #if (FXAA_QUALITY__PS > 9)
+        if(doneNP) {
+            if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+            if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+            if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+            if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+            doneN = abs(lumaEndN) >= gradientScaled;
+            doneP = abs(lumaEndP) >= gradientScaled;
+            if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9;
+            if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9;
+            doneNP = (!doneN) || (!doneP);
+            if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9;
+            if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9;
+/*--------------------------------------------------------------------------*/
+            #if (FXAA_QUALITY__PS > 10)
+            if(doneNP) {
+                if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                doneN = abs(lumaEndN) >= gradientScaled;
+                doneP = abs(lumaEndP) >= gradientScaled;
+                if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10;
+                if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10;
+                doneNP = (!doneN) || (!doneP);
+                if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10;
+                if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10;
+/*--------------------------------------------------------------------------*/
+                #if (FXAA_QUALITY__PS > 11)
+                if(doneNP) {
+                    if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                    if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                    if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                    if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                    doneN = abs(lumaEndN) >= gradientScaled;
+                    doneP = abs(lumaEndP) >= gradientScaled;
+                    if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11;
+                    if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11;
+                    doneNP = (!doneN) || (!doneP);
+                    if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11;
+                    if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11;
+/*--------------------------------------------------------------------------*/
+                    #if (FXAA_QUALITY__PS > 12)
+                    if(doneNP) {
+                        if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy));
+                        if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy));
+                        if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5;
+                        if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5;
+                        doneN = abs(lumaEndN) >= gradientScaled;
+                        doneP = abs(lumaEndP) >= gradientScaled;
+                        if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12;
+                        if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12;
+                        doneNP = (!doneN) || (!doneP);
+                        if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12;
+                        if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12;
+                    }
+                    #endif
+                }
+                #endif
+            }
+            #endif
+        }
+        #endif
+    }
+    #endif
+                        }
+                        #endif
+                    }
+                    #endif
+                }
+                #endif
+            }
+            #endif
+        }
+        #endif
+    }
+    FxaaFloat dstN = posM.x - posN.x;
+    FxaaFloat dstP = posP.x - posM.x;
+    if(!horzSpan) dstN = posM.y - posN.y;
+    if(!horzSpan) dstP = posP.y - posM.y;
+/*--------------------------------------------------------------------------*/
+    FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero;
+    FxaaFloat spanLength = (dstP + dstN);
+    FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero;
+    FxaaFloat spanLengthRcp = 1.0/spanLength;
+/*--------------------------------------------------------------------------*/
+    FxaaBool directionN = dstN < dstP;
+    FxaaFloat dst = min(dstN, dstP);
+    FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP;
+    FxaaFloat subpixG = subpixF * subpixF;
+    FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5;
+    FxaaFloat subpixH = subpixG * fxaaQualitySubpix;
+/*--------------------------------------------------------------------------*/
+    FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0;
+    FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH);
+    if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign;
+    if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign;
+    return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM);
+}
+/*==========================================================================*/

+ 47 - 0
Game Folder/SweetFX/Shaders/HDR.h

@@ -0,0 +1,47 @@
+/*------------------------------------------------------------------------------
+						HDR
+------------------------------------------------------------------------------*/
+
+float4 HDRPass( float4 colorInput, float2 Tex )
+{
+	float3 c_center = myTex2D(s0, Tex).rgb; //reuse SMAA center sample or lumasharpen center sample?
+	//float3 c_center = colorInput.rgb; //or just the input?
+	
+	//float3 bloom_sum1 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that
+	//float3 bloom_sum2 = float3(0.0, 0.0, 0.0); //don't initialize to 0 - use the first tex2D to do that
+	//Tex += float2(0, 0); // +0 ? .. oh riiiight - that will surely do something useful
+	
+	float radius1 = 0.793;
+	float3 bloom_sum1 = myTex2D(s0, Tex + float2(1.5, -1.5) * radius1).rgb;
+	bloom_sum1 += myTex2D(s0, Tex + float2(-1.5, -1.5) * radius1).rgb; //rearrange sample order to minimize ALU and maximize cache usage
+	bloom_sum1 += myTex2D(s0, Tex + float2(1.5, 1.5) * radius1).rgb;
+	bloom_sum1 += myTex2D(s0, Tex + float2(-1.5, 1.5) * radius1).rgb;
+	
+	bloom_sum1 += myTex2D(s0, Tex + float2(0, -2.5) * radius1).rgb;
+	bloom_sum1 += myTex2D(s0, Tex + float2(0, 2.5) * radius1).rgb;
+	bloom_sum1 += myTex2D(s0, Tex + float2(-2.5, 0) * radius1).rgb;
+	bloom_sum1 += myTex2D(s0, Tex + float2(2.5, 0) * radius1).rgb;
+	
+	bloom_sum1 *= 0.005;
+	
+	float3 bloom_sum2 = myTex2D(s0, Tex + float2(1.5, -1.5) * radius2).rgb;
+	bloom_sum2 += myTex2D(s0, Tex + float2(-1.5, -1.5) * radius2).rgb;
+	bloom_sum2 += myTex2D(s0, Tex + float2(1.5, 1.5) * radius2).rgb;
+	bloom_sum2 += myTex2D(s0, Tex + float2(-1.5, 1.5) * radius2).rgb;
+
+
+	bloom_sum2 += myTex2D(s0, Tex + float2(0, -2.5) * radius2).rgb;	
+	bloom_sum2 += myTex2D(s0, Tex + float2(0, 2.5) * radius2).rgb;
+	bloom_sum2 += myTex2D(s0, Tex + float2(-2.5, 0) * radius2).rgb;
+	bloom_sum2 += myTex2D(s0, Tex + float2(2.5, 0) * radius2).rgb;
+
+	bloom_sum2 *= 0.010;
+	
+	float dist = radius2 - radius1;
+	
+	float3 HDR = (c_center + (bloom_sum2 - bloom_sum1)) * dist;
+	float3 blend = HDR + colorInput.rgb;
+	colorInput.rgb = HDR + pow(blend, HDRPower); // pow - don't use fractions for HDRpower
+	
+	return saturate(colorInput);
+}

+ 24 - 0
Game Folder/SweetFX/Shaders/Levels.h

@@ -0,0 +1,24 @@
+   /*-----------------------------------------------------------.   
+  /                          Levels                             /
+  '------------------------------------------------------------/
+
+by Christian Cann Schuldt Jensen ~ CeeJay.dk
+
+Allows you to set a new black and a white level.
+This increases contrast, but clips any colors outside the new range to either black or white
+and so some details in the shadows or highlights can be lost.
+
+The shader is very useful for expanding the 16-235 TV range to 0-255 PC range.
+You might need it if you're playing a game meant to display on a TV with an emulator that does not do this.
+But it's also a quick and easy way to uniformly increase the contrast of an image.
+
+*/
+
+#define black_point_float ( Levels_black_point / 255.0 )
+#define white_point_float ( 255.0 / (Levels_white_point - Levels_black_point))
+
+float4 LevelsPass( float4 colorInput )
+{
+  colorInput.rgb = colorInput.rgb * white_point_float - (black_point_float *  white_point_float);
+  return colorInput;
+}

+ 29 - 0
Game Folder/SweetFX/Shaders/LiftGammaGain.h

@@ -0,0 +1,29 @@
+   /*-----------------------------------------------------------.   
+  /                      Lift Gamma Gain                        /
+  '-----------------------------------------------------------*/
+/*
+  by 3an and CeeJay.dk
+  
+  Version 1.1
+*/
+
+float4 LiftGammaGainPass( float4 colorInput )
+{
+	// -- Get input --
+	float3 color = colorInput.rgb;
+	
+	// -- Lift --
+	//color = color + (RGB_Lift / 2.0 - 0.5) * (1.0 - color); 
+	color = color * (1.5-0.5 * RGB_Lift) + 0.5 * RGB_Lift - 0.5;
+	color = saturate(color); //isn't strictly necessary, but doesn't cost performance.
+	
+	// -- Gain --
+	color *= RGB_Gain; 
+	
+	// -- Gamma --
+	colorInput.rgb = pow(color, 1.0 / RGB_Gamma); //Gamma
+	
+	// -- Return output --
+	//return (colorInput);
+	return saturate(colorInput);
+}

+ 217 - 0
Game Folder/SweetFX/Shaders/LumaSharpen.h

@@ -0,0 +1,217 @@
+/*
+   _____________________
+
+     LumaSharpen 1.4.1
+   _____________________
+
+  by Christian Cann Schuldt Jensen ~ CeeJay.dk
+
+  It blurs the original pixel with the surrounding pixels and then subtracts this blur to sharpen the image.
+  It does this in luma to avoid color artifacts and allows limiting the maximum sharpning to avoid or lessen halo artifacts.
+
+  This is similar to using Unsharp Mask in Photoshop.
+
+  Compiles with 3.0
+*/
+
+   /*-----------------------------------------------------------.
+  /                      Developer settings                     /
+  '-----------------------------------------------------------*/
+#define CoefLuma float3(0.2126, 0.7152, 0.0722)      // BT.709 & sRBG luma coefficient (Monitors and HD Television)
+//#define CoefLuma float3(0.299, 0.587, 0.114)       // BT.601 luma coefficient (SD Television)
+//#define CoefLuma float3(1.0/3.0, 1.0/3.0, 1.0/3.0) // Equal weight coefficient
+
+   /*-----------------------------------------------------------.
+  /                          Main code                          /
+  '-----------------------------------------------------------*/
+
+float4 LumaSharpenPass(float4 inputcolor, float2 tex )
+{
+  // -- Get the original pixel --
+  float3 ori = myTex2D(s0, tex).rgb;       // ori = original pixel
+
+  // -- Combining the strength and luma multipliers --
+  float3 sharp_strength_luma = (CoefLuma * sharp_strength); //I'll be combining even more multipliers with it later on
+
+   /*-----------------------------------------------------------.
+  /                       Sampling patterns                     /
+  '-----------------------------------------------------------*/
+  //   [ NW,   , NE ] Each texture lookup (except ori)
+  //   [   ,ori,    ] samples 4 pixels
+  //   [ SW,   , SE ]
+
+  // -- Pattern 1 -- A (fast) 7 tap gaussian using only 2+1 texture fetches.
+  #if pattern == 1
+
+	// -- Gaussian filter --
+	//   [ 1/9, 2/9,    ]     [ 1 , 2 ,   ]
+	//   [ 2/9, 8/9, 2/9]  =  [ 2 , 8 , 2 ]
+ 	//   [    , 2/9, 1/9]     [   , 2 , 1 ]
+
+    float3 blur_ori = myTex2D(s0, tex + (float2(px,py) / 3.0) * offset_bias).rgb;  // North West
+    blur_ori += myTex2D(s0, tex + (float2(-px,-py) / 3.0) * offset_bias).rgb; // South East
+
+    //blur_ori += myTex2D(s0, tex + float2(px,py) / 3.0 * offset_bias); // North East
+    //blur_ori += myTex2D(s0, tex + float2(-px,-py) / 3.0 * offset_bias); // South West
+
+    blur_ori /= 2;  //Divide by the number of texture fetches
+
+    sharp_strength_luma *= 1.5; // Adjust strength to aproximate the strength of pattern 2
+
+  #endif
+
+  // -- Pattern 2 -- A 9 tap gaussian using 4+1 texture fetches.
+  #if pattern == 2
+
+	// -- Gaussian filter --
+	//   [ .25, .50, .25]     [ 1 , 2 , 1 ]
+	//   [ .50,   1, .50]  =  [ 2 , 4 , 2 ]
+ 	//   [ .25, .50, .25]     [ 1 , 2 , 1 ]
+
+
+    float3 blur_ori = myTex2D(s0, tex + float2(px,-py) * 0.5 * offset_bias).rgb; // South East
+    blur_ori += myTex2D(s0, tex + float2(-px,-py) * 0.5 * offset_bias).rgb;  // South West
+    blur_ori += myTex2D(s0, tex + float2(px,py) * 0.5 * offset_bias).rgb; // North East
+    blur_ori += myTex2D(s0, tex + float2(-px,py) * 0.5 * offset_bias).rgb; // North West
+
+    blur_ori *= 0.25;  // ( /= 4) Divide by the number of texture fetches
+
+  #endif
+
+  // -- Pattern 3 -- An experimental 17 tap gaussian using 4+1 texture fetches.
+  #if pattern == 3
+
+	// -- Gaussian filter --
+	//   [   , 4 , 6 ,   ,   ]
+	//   [   ,16 ,24 ,16 , 4 ]
+	//   [ 6 ,24 ,   ,24 , 6 ]
+	//   [ 4 ,16 ,24 ,16 ,   ]
+	//   [   ,   , 6 , 4 ,   ]
+
+    float3 blur_ori = myTex2D(s0, tex + float2(0.4*px,-1.2*py)* offset_bias).rgb;  // South South East
+    blur_ori += myTex2D(s0, tex + float2(-1.2*px,-0.4*py) * offset_bias).rgb; // West South West
+    blur_ori += myTex2D(s0, tex + float2(1.2*px,0.4*py) * offset_bias).rgb; // East North East
+    blur_ori += myTex2D(s0, tex + float2(-0.4*px,1.2*py) * offset_bias).rgb; // North North West
+
+    blur_ori *= 0.25;  // ( /= 4) Divide by the number of texture fetches
+
+    sharp_strength_luma *= 0.51;
+  #endif
+
+  // -- Pattern 4 -- A 9 tap high pass (pyramid filter) using 4+1 texture fetches.
+  #if pattern == 4
+
+	// -- Gaussian filter --
+	//   [ .50, .50, .50]     [ 1 , 1 , 1 ]
+	//   [ .50,    , .50]  =  [ 1 ,   , 1 ]
+ 	//   [ .50, .50, .50]     [ 1 , 1 , 1 ]
+
+    float3 blur_ori = myTex2D(s0, tex + float2(0.5 * px,-py * offset_bias)).rgb;  // South South East
+    blur_ori += myTex2D(s0, tex + float2(offset_bias * -px,0.5 * -py)).rgb; // West South West
+    blur_ori += myTex2D(s0, tex + float2(offset_bias * px,0.5 * py)).rgb; // East North East
+    blur_ori += myTex2D(s0, tex + float2(0.5 * -px,py * offset_bias)).rgb; // North North West
+
+    //blur_ori += (2 * ori); // Probably not needed. Only serves to lessen the effect.
+
+    blur_ori /= 4.0;  //Divide by the number of texture fetches
+
+    sharp_strength_luma *= 0.666; // Adjust strength to aproximate the strength of pattern 2
+  #endif
+
+  // -- Pattern 8 -- A (slower) 9 tap gaussian using 9 texture fetches.
+  #if pattern == 8
+
+	// -- Gaussian filter --
+	//   [ 1 , 2 , 1 ]
+	//   [ 2 , 4 , 2 ]
+ 	//   [ 1 , 2 , 1 ]
+
+    half3 blur_ori = myTex2D(s0, tex + float2(-px,py) * offset_bias).rgb; // North West
+    blur_ori += myTex2D(s0, tex + float2(px,-py) * offset_bias).rgb;     // South East
+    blur_ori += myTex2D(s0, tex + float2(-px,-py)  * offset_bias).rgb;  // South West
+    blur_ori += myTex2D(s0, tex + float2(px,py) * offset_bias).rgb;    // North East
+
+    half3 blur_ori2 = myTex2D(s0, tex + float2(0,py) * offset_bias).rgb; // North
+    blur_ori2 += myTex2D(s0, tex + float2(0,-py) * offset_bias).rgb;    // South
+    blur_ori2 += myTex2D(s0, tex + float2(-px,0) * offset_bias).rgb;   // West
+    blur_ori2 += myTex2D(s0, tex + float2(px,0) * offset_bias).rgb;   // East
+    blur_ori2 *= 2.0;
+
+    blur_ori += blur_ori2;
+    blur_ori += (ori * 4); // Probably not needed. Only serves to lessen the effect.
+
+    // dot()s with gaussian strengths here?
+
+    blur_ori /= 16.0;  //Divide by the number of texture fetches
+
+    //sharp_strength_luma *= 0.75; // Adjust strength to aproximate the strength of pattern 2
+  #endif
+
+  // -- Pattern 9 -- A (slower) 9 tap high pass using 9 texture fetches.
+  #if pattern == 9
+
+	// -- Gaussian filter --
+	//   [ 1 , 1 , 1 ]
+	//   [ 1 , 1 , 1 ]
+ 	//   [ 1 , 1 , 1 ]
+
+    float3 blur_ori = myTex2D(s0, tex + float2(-px,py) * offset_bias).rgb; // North West
+    blur_ori += myTex2D(s0, tex + float2(px,-py) * offset_bias).rgb;     // South East
+    blur_ori += myTex2D(s0, tex + float2(-px,-py)  * offset_bias).rgb;  // South West
+    blur_ori += myTex2D(s0, tex + float2(px,py) * offset_bias).rgb;    // North East
+
+    blur_ori += ori.rgb; // Probably not needed. Only serves to lessen the effect.
+
+    blur_ori += myTex2D(s0, tex + float2(0,py) * offset_bias).rgb;    // North
+    blur_ori += myTex2D(s0, tex + float2(0,-py) * offset_bias).rgb;  // South
+    blur_ori += myTex2D(s0, tex + float2(-px,0) * offset_bias).rgb; // West
+    blur_ori += myTex2D(s0, tex + float2(px,0) * offset_bias).rgb; // East
+
+    blur_ori /= 9;  //Divide by the number of texture fetches
+
+    //sharp_strength_luma *= (8.0/9.0); // Adjust strength to aproximate the strength of pattern 2
+  #endif
+
+
+   /*-----------------------------------------------------------.
+  /                            Sharpen                          /
+  '-----------------------------------------------------------*/
+
+  // -- Calculate the sharpening --
+  float3 sharp = ori - blur_ori;  //Subtracting the blurred image from the original image
+
+  #if 0 //New experimental limiter .. not yet finished
+    float sharp_luma = dot(sharp, sharp_strength_luma); //Calculate the luma
+    sharp_luma = (abs(sharp_luma)*8.0) * exp(1.0-(abs(sharp_luma)*8.0)) * sign(sharp_luma) / 16.0; //I should probably move the strength modifier here
+
+  #elif 0 //SweetFX 1.4 code
+    // -- Adjust strength of the sharpening --
+    float sharp_luma = dot(sharp, sharp_strength_luma); //Calculate the luma and adjust the strength
+
+    // -- Clamping the maximum amount of sharpening to prevent halo artifacts --
+    sharp_luma = clamp(sharp_luma, -sharp_clamp, sharp_clamp);  //TODO Try a curve function instead of a clamp
+  
+  #else //SweetFX 1.5.1 code
+    // -- Adjust strength of the sharpening and clamp it--
+    float4 sharp_strength_luma_clamp = float4(sharp_strength_luma * (0.5 / sharp_clamp),0.5); //Roll part of the clamp into the dot
+
+    //sharp_luma = saturate((0.5 / sharp_clamp) * sharp_luma + 0.5); //scale up and clamp
+    float sharp_luma = saturate(dot(float4(sharp,1.0), sharp_strength_luma_clamp)); //Calculate the luma, adjust the strength, scale up and clamp
+    sharp_luma = (sharp_clamp * 2.0) * sharp_luma - sharp_clamp; //scale down
+  #endif
+
+  // -- Combining the values to get the final sharpened pixel	--
+  //float4 done = ori + sharp_luma;    // Add the sharpening to the original.
+  inputcolor.rgb = inputcolor.rgb + sharp_luma;    // Add the sharpening to the input color.
+
+   /*-----------------------------------------------------------.
+  /                     Returning the output                    /
+  '-----------------------------------------------------------*/
+  #if show_sharpen == 1
+    //inputcolor.rgb = abs(sharp * 4.0);
+    inputcolor.rgb = saturate(0.5 + (sharp_luma * 4)).rrr;
+  #endif
+
+  return saturate(inputcolor);
+
+}

+ 325 - 0
Game Folder/SweetFX/Shaders/Main.h

@@ -0,0 +1,325 @@
+  /*-------------------------.
+  | :: Defining constants :: |
+  '-------------------------*/
+
+//These values are normally defined by the injector dlls, but not when analyzed by GPU Shaderanalyzer
+//I need to ensure they always have a value to be able to compile them whenever I'm not using the injector.
+#ifdef SMAA_PIXEL_SIZE
+  #ifndef BUFFER_RCP_WIDTH
+    #define BUFFER_RCP_WIDTH SMAA_PIXEL_SIZE.x
+    #define BUFFER_RCP_HEIGHT SMAA_PIXEL_SIZE.y
+    #define BUFFER_WIDTH (1.0 / SMAA_PIXEL_SIZE.x)
+    #define BUFFER_HEIGHT (1.0 / SMAA_PIXEL_SIZE.y)
+  #endif
+#endif
+
+#ifndef BUFFER_RCP_WIDTH
+  #define BUFFER_RCP_WIDTH (1.0 / 1680)
+  #define BUFFER_RCP_HEIGHT (1.0 / 1050)
+  #define BUFFER_WIDTH 1680
+  #define BUFFER_HEIGHT 1050
+#endif
+
+#define screen_size float2(BUFFER_WIDTH,BUFFER_HEIGHT)
+
+#define px BUFFER_RCP_WIDTH
+#define py BUFFER_RCP_HEIGHT
+
+#define pixel float2(px,py)
+
+// -- Define DirectX9 FXAA specific aliases --
+#if FXAA_HLSL_3 == 1
+  #define myTex2D(s,p) tex2D(s,p)
+
+  //#define s0 colorTexG
+  //#define s1 colorTexG //TODO make a nearest sampler if needed
+#endif
+
+// -- Define DirectX10/11 FXAA specific aliases --
+#if FXAA_HLSL_4 == 1
+  //#define myTex2D(s,p) s.SampleLevel(screenSampler, p, 0)
+  #define myTex2D(s,p) s.Sample(screenSampler, p)
+
+  #define s0 gLumaTexture
+  #define s1 gLumaTexture //TODO make a nearest sampler if needed
+#endif
+
+
+// -- Define DirectX9 specific aliases --
+#if SMAA_HLSL_3 == 1
+  #define myTex2D(s,p) tex2D(s,p)
+
+  #define s0 colorTexG
+  #define s1 colorTexG //TODO make a nearest sampler if needed
+#endif
+
+// -- Define DirectX10/11 specific aliases --
+#if SMAA_HLSL_4 == 1 || SMAA_HLSL_4_1 == 1
+  //#define myTex2D(s,p) s.SampleLevel(LinearSampler, p, 0)
+  #define myTex2D(s,p) s.Sample(LinearSampler, p)
+
+  #define s0 colorTexGamma
+  #define s1 colorTexGamma //TODO make a nearest sampler if needed
+#endif
+
+
+  /*------------------------------.
+  | :: Include enabled shaders :: |
+  '------------------------------*/
+
+#if (USE_CUSTOM == 1)
+  #include "SweetFX\Shaders\Custom.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_EXPLOSION == 1)
+  #include "SweetFX\Shaders\Explosion.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_CARTOON == 1)
+  #include "SweetFX\Shaders\Cartoon.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_ADVANCED_CRT == 1)
+  #include "SweetFX\Shaders\AdvancedCRT.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_SWEETCRT == 1)
+  #include "SweetFX\Shaders\SweetCRT.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_BLOOM == 1)
+  #include "SweetFX\Shaders\Bloom.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_HDR == 1)
+  #include "SweetFX\Shaders\HDR.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_LUMASHARPEN == 1)
+  #include "SweetFX\Shaders\LumaSharpen.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_LEVELS == 1)
+  #include "SweetFX\Shaders\Levels.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_TECHNICOLOR == 1)
+  #include "SweetFX\Shaders\Technicolor.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_DPX == 1)
+  #include "SweetFX\Shaders\DPX.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_MONOCHROME == 1)
+  #include "SweetFX\Shaders\Monochrome.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_LIFTGAMMAGAIN == 1)
+  #include "SweetFX\Shaders\LiftGammaGain.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_TONEMAP == 1)
+  #include "SweetFX\Shaders\Tonemap.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_SEPIA == 1)
+  #include "SweetFX\Shaders\Sepia.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_VIBRANCE == 1)
+  #include "SweetFX\Shaders\Vibrance.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_CURVES == 1)
+  #include "SweetFX\Shaders\Curves.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_VIGNETTE == 1)
+  #include "SweetFX\Shaders\Vignette.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_DITHER == 1)
+  #include "SweetFX\Shaders\Dither.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_BORDER == 1)
+  #include "SweetFX\Shaders\Border.h"
+  #define Need_sRGB 1
+#endif
+
+#if (USE_SPLITSCREEN == 1)
+  #include "SweetFX\Shaders\Splitscreen.h"
+  #define Need_sRGB 1
+#endif
+
+  /*--------------------.
+  | :: Effect passes :: |
+  '--------------------*/
+
+float4 SweetFX_main(float2 tex, float4 FinalColor)
+{
+  /*--------------------------------------.
+  | :: Linear to sRGB Gamma correction :: |
+  '--------------------------------------*/
+  
+  //#if Need_sRGB
+
+  // Linear to sRGB Gamma correction. Needed here because SMAA uses linear for it's final step while the other shaders use SRGB.
+  #if (USE_SMAA_ANTIALIASING == 1 && Need_sRGB == 1)
+    //FinalColor.rgb = (FinalColor.rgb <= 0.00304) ? saturate(FinalColor.rgb) * 12.92 : 1.055 * pow( saturate(FinalColor.rgb), 1.0/2.4 ) - 0.055; // Linear to SRGB
+    FinalColor.rgb = (FinalColor.rgb <= 0.00304) ? saturate(FinalColor.rgb * 12.92) : 1.055 * saturate(pow(FinalColor.rgb, 1.0/2.4 )) - 0.055; // Linear to SRGB
+  #endif
+
+  /*--------------------.
+  | :: Effect passes :: |
+  '--------------------*/
+
+  // Custom
+  #if (USE_CUSTOM == 1)
+    FinalColor = CustomPass(FinalColor,tex);
+  #endif
+
+  // Explosion
+  #if (USE_EXPLOSION == 1)
+    FinalColor = ExplosionPass(FinalColor,tex);
+  #endif
+
+  // Cartoon
+  #if (USE_CARTOON == 1)
+	FinalColor = CartoonPass(FinalColor,tex);
+  #endif
+
+  // Advanced CRT
+  #if (USE_ADVANCED_CRT == 1)
+	FinalColor = AdvancedCRTPass(FinalColor,tex);
+  #endif
+  
+  // SweetCRT
+  #if (USE_SWEETCRT == 1)
+    FinalColor = SweetCRTPass(FinalColor,tex);
+  #endif
+
+  // Bloom
+  #if (USE_BLOOM == 1)
+	FinalColor = BloomPass (FinalColor,tex);
+  #endif
+
+  // HDR
+  #if (USE_HDR == 1)
+	FinalColor = HDRPass (FinalColor,tex);
+  #endif
+
+  // LumaSharpen
+  #if (USE_LUMASHARPEN == 1)
+	FinalColor = LumaSharpenPass(FinalColor,tex);
+  #endif
+
+  // Levels
+  #if (USE_LEVELS == 1)
+	FinalColor = LevelsPass(FinalColor);
+  #endif
+
+  // Technicolor
+  #if (USE_TECHNICOLOR == 1)
+	FinalColor = TechnicolorPass(FinalColor);
+  #endif
+
+  // DPX
+  #if (USE_DPX == 1)
+	FinalColor = DPXPass(FinalColor);
+  #endif
+
+  // Monochrome
+  #if (USE_MONOCHROME == 1)
+	FinalColor = MonochromePass(FinalColor);
+  #endif
+
+  // Lift Gamma Gain
+  #if (USE_LIFTGAMMAGAIN == 1)
+	FinalColor = LiftGammaGainPass(FinalColor);
+  #endif
+
+  // Tonemap
+  #if (USE_TONEMAP == 1)
+	FinalColor = TonemapPass(FinalColor);
+  #endif
+
+  // Vibrance
+  #if (USE_VIBRANCE == 1)
+	FinalColor = VibrancePass(FinalColor);
+  #endif
+
+  // Curves
+  #if (USE_CURVES == 1)
+	FinalColor = CurvesPass(FinalColor);
+  #endif
+
+  // Sepia
+  #if (USE_SEPIA == 1)
+    FinalColor = SepiaPass(FinalColor);
+  #endif
+
+  // Vignette
+  #if (USE_VIGNETTE == 1)
+	FinalColor = VignettePass(FinalColor,tex);
+  #endif
+
+  // Dither (should go near the end as it only dithers what went before it)
+  #if (USE_DITHER == 1)
+	FinalColor = DitherPass(FinalColor,tex);
+  #endif
+
+  // Border
+  #if (USE_BORDER == 1)
+    FinalColor = BorderPass(FinalColor,tex);
+  #endif
+
+  // Splitscreen
+  #if (USE_SPLITSCREEN == 1)
+	  FinalColor = SplitscreenPass(FinalColor,tex);
+  #endif
+
+  /*--------------------------------------.
+  | :: sRGB to Linear Gamma correction :: |
+  '--------------------------------------*/
+
+  // sRGB to Linear gamma correction.
+  #if (SMAA_HLSL_3 != 1 && FXAA_HLSL_3 != 1) //If we are not using DirectX 9.. (and therefore are using DX10/11)
+  
+    #if (USE_SMAA_ANTIALIASING == 1 && Need_sRGB != 1) //and if we used SMAA (and thus Linear) and we didn't earlier convert to sRGB
+       //..then we are already linear and don't need to do anything
+       
+	  #else //if not, then we are currently sRGB and need to be Linear. - convert to Linear
+      FinalColor.rgb = saturate(FinalColor.rgb);
+      FinalColor.rgb = (FinalColor.rgb <= 0.03928) ? FinalColor.rgb / 12.92 : pow( (FinalColor.rgb + 0.055) / 1.055, 2.4 ); // sRGB to Linear
+    
+    #endif
+   
+  //But if we were using DirectX 9 then no matter what we should be sRGB at this point and don't need to do anything further.
+   
+  #endif
+
+  // Return FinalColor
+  FinalColor.a = 1.0; //Clear alpha channel to reduce filesize of screenshots that are converted to png and avoid problems when viewing the screenshots.
+  return FinalColor;
+}

+ 17 - 0
Game Folder/SweetFX/Shaders/Monochrome.h

@@ -0,0 +1,17 @@
+   /*-----------------------------------------------------------.   
+  /                          Monochrome                             /
+  '-----------------------------------------------------------*/
+/*
+  by Christian Cann Schuldt Jensen ~ CeeJay.dk
+  
+  Monochrome removes color and makes everything black and white.
+*/
+
+float4 MonochromePass( float4 colorInput )
+{
+  //calculate monochrome
+  colorInput.rgb = dot(Monochrome_conversion_values, colorInput.rgb);
+	
+  //Return the result
+  return saturate(colorInput);
+}

+ 1370 - 0
Game Folder/SweetFX/Shaders/SMAA.h

@@ -0,0 +1,1370 @@
+/**
+ * Copyright (C) 2011 Jorge Jimenez (jorge@iryoku.com)
+ * Copyright (C) 2011 Belen Masia (bmasia@unizar.es)
+ * Copyright (C) 2011 Jose I. Echevarria (joseignacioechevarria@gmail.com)
+ * Copyright (C) 2011 Fernando Navarro (fernandn@microsoft.com)
+ * Copyright (C) 2011 Diego Gutierrez (diegog@unizar.es)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *    1. Redistributions of source code must retain the above copyright notice,
+ *       this list of conditions and the following disclaimer.
+ *
+ *    2. Redistributions in binary form must reproduce the following disclaimer
+ *       in the documentation and/or other materials provided with the
+ *       distribution:
+ *
+ *      "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ *       Belen Masia, Fernando Navarro and Diego Gutierrez."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of the copyright holders.
+ */
+
+
+/**
+ *                  _______  ___  ___       ___           ___
+ *                 /       ||   \/   |     /   \         /   \
+ *                |   (---- |  \  /  |    /  ^  \       /  ^  \
+ *                 \   \    |  |\/|  |   /  /_\  \     /  /_\  \
+ *              ----)   |   |  |  |  |  /  _____  \   /  _____  \
+ *             |_______/    |__|  |__| /__/     \__\ /__/     \__\
+ *
+ *                               E N H A N C E D
+ *       S U B P I X E L   M O R P H O L O G I C A L   A N T I A L I A S I N G
+ *
+ *                         http://www.iryoku.com/smaa/
+ *
+ * Hi, welcome aboard!
+ *
+ * Here you'll find instructions to get the shader up and running as fast as
+ * possible.
+ *
+ * The shader has three passes, chained together as follows:
+ *
+ *                           |input|------------------·
+ *                              v                     |
+ *                    [ SMAA*EdgeDetection ]          |
+ *                              v                     |
+ *                          |edgesTex|                |
+ *                              v                     |
+ *              [ SMAABlendingWeightCalculation ]     |
+ *                              v                     |
+ *                          |blendTex|                |
+ *                              v                     |
+ *                [ SMAANeighborhoodBlending ] <------·
+ *                              v
+ *                           |output|
+ *
+ * Note that each [pass] has its own vertex and pixel shader.
+ *
+ * You've three edge detection methods to choose from: luma, color or depth.
+ * They represent different quality/performance and anti-aliasing/sharpness
+ * tradeoffs, so our recommendation is for you to choose the one that best
+ * suits your particular scenario:
+ *
+ * - Depth edge detection is usually the fastest but it may miss some edges.
+ *
+ * - Luma edge detection is usually more expensive than depth edge detection,
+ *   but catches visible edges that depth edge detection can miss.
+ *
+ * - Color edge detection is usually the most expensive one but catches
+ *   chroma-only edges.
+ *
+ * For quickstarters: just use luma edge detection.
+ *
+ * The general advice is to not rush the integration process and ensure each
+ * step is done correctly (don't try to integrate SMAA T2x with predicated edge
+ * detection from the start!). Ok then, let's go!
+ *
+ *  1. The first step is to create two RGBA temporal framebuffers for holding
+ *     |edgesTex| and |blendTex|.
+ *
+ *     In DX10, you can use a RG framebuffer for the edges texture, but in our
+ *     experience it yields worse performance.
+ *
+ *     On the Xbox 360, you can use the same framebuffer for resolving both
+ *     |edgesTex| and |blendTex|, as they aren't needed simultaneously.
+ *
+ *  2. Both temporal framebuffers |edgesTex| and |blendTex| must be cleared
+ *     each frame. Do not forget to clear the alpha channel!
+ *
+ *  3. The next step is loading the two supporting precalculated textures,
+ *     'areaTex' and 'searchTex'. You'll find them in the 'Textures' folder as
+ *     C++ headers, and also as regular DDS files. They'll be needed for the
+ *     'SMAABlendingWeightCalculation' pass.
+ *
+ *     If you use the C++ headers, be sure to load them in the format specified
+ *     inside of them.
+ *
+ *  4. In DX9, all samplers must be set to linear filtering and clamp, with the
+ *     exception of 'searchTex', which must be set to point filtering.
+ *
+ *  5. All texture reads and buffer writes must be non-sRGB, with the exception
+ *     of the input read and the output write of input in
+ *     'SMAANeighborhoodBlending' (and only in this pass!). If sRGB reads in
+ *     this last pass are not possible, the technique will work anyway, but
+ *     will perform antialiasing in gamma space.
+ *
+ *     IMPORTANT: for best results the input read for the color/luma edge
+ *     detection should *NOT* be sRGB.
+ *
+ *  6. Before including SMAA.h you'll have to setup the framebuffer pixel size,
+ *     the target and any optional configuration defines. Optionally you can
+ *     use a preset.
+ *
+ *     You have three targets available:
+ *         SMAA_HLSL_3
+ *         SMAA_HLSL_4
+ *         SMAA_HLSL_4_1
+ *         SMAA_GLSL_3 *
+ *         SMAA_GLSL_4 *
+ *
+ *         * (See SMAA_ONLY_COMPILE_VS below).
+ *
+ *     And four presets:
+ *         SMAA_PRESET_LOW          (%60 of the quality)
+ *         SMAA_PRESET_MEDIUM       (%80 of the quality)
+ *         SMAA_PRESET_HIGH         (%95 of the quality)
+ *         SMAA_PRESET_ULTRA        (%99 of the quality)
+ *
+ *     For example:
+ *         #define SMAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
+ *         #define SMAA_HLSL_4 1
+ *         #define SMAA_PRESET_HIGH 1
+ *         #include "SMAA.h"
+ *
+ *  7. Then, you'll have to setup the passes as indicated in the scheme above.
+ *     You can take a look into SMAA.fx, to see how we did it for our demo.
+ *     Checkout the function wrappers, you may want to copy-paste them!
+ *
+ *  8. It's recommended to validate the produced |edgesTex| and |blendTex|.
+ *     It's advised to not continue with the implementation until both buffers
+ *     are verified to produce identical results to our reference demo.
+ *
+ *  9. After you get the last pass to work, it's time to optimize. You'll have
+ *     to initialize a stencil buffer in the first pass (discard is already in
+ *     the code), then mask execution by using it the second pass. The last
+ *     pass should be executed in all pixels.
+ *
+ *
+ * After this point you can choose to enable predicated thresholding,
+ * temporal supersampling and motion blur integration:
+ *
+ * a) If you want to use predicated thresholding, take a look into
+ *    SMAA_PREDICATION; you'll need to pass an extra texture in the edge
+ *    detection pass.
+ *
+ * b) If you want to enable temporal supersampling:
+ *
+ * 1. The first step is to render using subpixel jitters. I won't go into
+ *    detail, but it's as simple as moving each vertex position in the
+ *    vertex shader, you can check how we do it in our DX10 demo.
+ *
+ * 2. Then, you must setup the temporal resolve. You may want to take a look
+ *    into SMAAResolve for resolving 2x modes. After you get it working, you'll
+ *    probably see ghosting everywhere. But fear not, you can enable the
+ *    CryENGINE temporal reprojection by setting the SMAA_REPROJECTION macro.
+ *
+ * 3. The next step is to apply SMAA to each subpixel jittered frame, just as
+ *    done for 1x.
+ *
+ * 4. At this point you should already have something usable, but for best
+ *    results the proper area textures must be set depending on current jitter.
+ *    For this, the parameter 'subsampleIndices' of
+ *    'SMAABlendingWeightCalculationPS' must be set as follows, for our T2x
+ *    mode:
+ *
+ *    @SUBSAMPLE_INDICES
+ *
+ *             |         jitter         |    subsampleIndices    |
+ *             +------------------------+------------------------|
+ *             | float2(-0.25f,  0.25f) |    int4(1, 1, 1, 0)    |
+ *             | float2( 0.25f, -0.25f) |    int4(2, 2, 2, 0)    |
+ *       OR
+ *             +------------------------+------------------------|
+ *             | float2( 0.25f,  0.25f) |    int4(2, 1, 0, 2)    |
+ *             | float2(-0.25f, -0.25f) |    int4(1, 2, 0, 1)    |
+ *
+ *    These jitter positions assume a bottom-to-top y axis.
+ *
+ * More information about temporal supersampling here:
+ *    http://iryoku.com/aacourse/downloads/13-Anti-Aliasing-Methods-in-CryENGINE-3.pdf
+ *
+ * c) If motion blur is used, you may want to do the edge detection pass
+ *    together with motion blur. This has two advantages:
+ *
+ * 1. Pixels under heavy motion can be omitted from the edge detection process.
+ *    For these pixels we can just store "no edge", as motion blur will take
+ *    care of them.
+ * 2. The center pixel tap is reused.
+ *
+ * Note that in this case depth testing should be used instead of stenciling,
+ * as we have to write all the pixels in the motion blur pass.
+ *
+ * That's it!
+ */
+
+//-----------------------------------------------------------------------------
+// SMAA Presets
+
+#if SMAA_PRESET_LOW == 1
+#define SMAA_THRESHOLD 0.15
+#define SMAA_MAX_SEARCH_STEPS 4
+#define SMAA_MAX_SEARCH_STEPS_DIAG 0
+#define SMAA_CORNER_ROUNDING 100
+#elif SMAA_PRESET_MEDIUM == 1
+#define SMAA_THRESHOLD 0.1
+#define SMAA_MAX_SEARCH_STEPS 8
+#define SMAA_MAX_SEARCH_STEPS_DIAG 0
+#define SMAA_CORNER_ROUNDING 100
+#elif SMAA_PRESET_HIGH == 1
+#define SMAA_THRESHOLD 0.1
+#define SMAA_MAX_SEARCH_STEPS 16
+#define SMAA_MAX_SEARCH_STEPS_DIAG 8
+#define SMAA_CORNER_ROUNDING 25
+#elif SMAA_PRESET_ULTRA == 1
+#define SMAA_THRESHOLD 0.05
+#define SMAA_MAX_SEARCH_STEPS 32
+#define SMAA_MAX_SEARCH_STEPS_DIAG 16
+#define SMAA_CORNER_ROUNDING 25
+#endif
+
+//-----------------------------------------------------------------------------
+// Configurable Defines
+
+/**
+ * SMAA_THRESHOLD specifies the threshold or sensitivity to edges.
+ * Lowering this value you will be able to detect more edges at the expense of
+ * performance.
+ *
+ * Range: [0, 0.5]
+ *   0.1 is a reasonable value, and allows to catch most visible edges.
+ *   0.05 is a rather overkill value, that allows to catch 'em all.
+ *
+ *   If temporal supersampling is used, 0.2 could be a reasonable value, as low
+ *   contrast edges are properly filtered by just 2x.
+ */
+#ifndef SMAA_THRESHOLD
+#define SMAA_THRESHOLD 0.1
+#endif
+
+/**
+ * SMAA_DEPTH_THRESHOLD specifies the threshold for depth edge detection.
+ *
+ * Range: depends on the depth range of the scene.
+ */
+#ifndef SMAA_DEPTH_THRESHOLD
+#define SMAA_DEPTH_THRESHOLD (0.1 * SMAA_THRESHOLD)
+#endif
+
+/**
+ * SMAA_MAX_SEARCH_STEPS specifies the maximum steps performed in the
+ * horizontal/vertical pattern searches, at each side of the pixel.
+ *
+ * In number of pixels, it's actually the double. So the maximum line length
+ * perfectly handled by, for example 16, is 64 (by perfectly, we meant that
+ * longer lines won't look as good, but still antialiased).
+ *
+ * Range: [0, 98]
+ */
+#ifndef SMAA_MAX_SEARCH_STEPS
+#define SMAA_MAX_SEARCH_STEPS 16
+#endif
+
+/**
+ * SMAA_MAX_SEARCH_STEPS_DIAG specifies the maximum steps performed in the
+ * diagonal pattern searches, at each side of the pixel. In this case we jump
+ * one pixel at time, instead of two.
+ *
+ * Range: [0, 20]; set it to 0 to disable diagonal processing.
+ *
+ * On high-end machines it is cheap (between a 0.8x and 0.9x slower for 16
+ * steps), but it can have a significant impact on older machines.
+ */
+#ifndef SMAA_MAX_SEARCH_STEPS_DIAG
+#define SMAA_MAX_SEARCH_STEPS_DIAG 8
+#endif
+
+/**
+ * SMAA_CORNER_ROUNDING specifies how much sharp corners will be rounded.
+ *
+ * Range: [0, 100]; set it to 100 to disable corner detection.
+ */
+#ifndef SMAA_CORNER_ROUNDING
+#define SMAA_CORNER_ROUNDING 25
+#endif
+
+/**
+ * Predicated thresholding allows to better preserve texture details and to
+ * improve performance, by decreasing the number of detected edges using an
+ * additional buffer like the light accumulation buffer, object ids or even the
+ * depth buffer (the depth buffer usage may be limited to indoor or short range
+ * scenes).
+ *
+ * It locally decreases the luma or color threshold if an edge is found in an
+ * additional buffer (so the global threshold can be higher).
+ *
+ * This method was developed by Playstation EDGE MLAA team, and used in
+ * Killzone 3, by using the light accumulation buffer. More information here:
+ *     http://iryoku.com/aacourse/downloads/06-MLAA-on-PS3.pptx
+ */
+#ifndef SMAA_PREDICATION
+#define SMAA_PREDICATION 0
+#endif
+
+/**
+ * Threshold to be used in the additional predication buffer.
+ *
+ * Range: depends on the input, so you'll have to find the magic number that
+ * works for you.
+ */
+#ifndef SMAA_PREDICATION_THRESHOLD
+#define SMAA_PREDICATION_THRESHOLD 0.01
+#endif
+
+/**
+ * How much to scale the global threshold used for luma or color edge
+ * detection when using predication.
+ *
+ * Range: [1, 5]
+ */
+#ifndef SMAA_PREDICATION_SCALE
+#define SMAA_PREDICATION_SCALE 2.0
+#endif
+
+/**
+ * How much to locally decrease the threshold.
+ *
+ * Range: [0, 1]
+ */
+#ifndef SMAA_PREDICATION_STRENGTH
+#define SMAA_PREDICATION_STRENGTH 0.4
+#endif
+
+/**
+ * Temporal reprojection allows to remove ghosting artifacts when using
+ * temporal supersampling. We use the CryEngine 3 method which also introduces
+ * velocity weighting. This feature is of extreme importance for totally
+ * removing ghosting. More information here:
+ *    http://iryoku.com/aacourse/downloads/13-Anti-Aliasing-Methods-in-CryENGINE-3.pdf
+ *
+ * Note that you'll need to setup a velocity buffer for enabling reprojection.
+ * For static geometry, saving the previous depth buffer is a viable
+ * alternative.
+ */
+#ifndef SMAA_REPROJECTION
+#define SMAA_REPROJECTION 0
+#endif
+
+/**
+ * SMAA_REPROJECTION_WEIGHT_SCALE controls the velocity weighting. It allows to
+ * remove ghosting trails behind the moving object, which are not removed by
+ * just using reprojection. Using low values will exhibit ghosting, while using
+ * high values will disable temporal supersampling under motion.
+ *
+ * Behind the scenes, velocity weighting removes temporal supersampling when
+ * the velocity of the subsamples differs (meaning they are different objects).
+ *
+ * Range: [0, 80]
+ */
+#define SMAA_REPROJECTION_WEIGHT_SCALE 30.0
+
+/**
+ * In the last pass we leverage bilinear filtering to avoid some lerps.
+ * However, bilinear filtering is done in gamma space in DX9, under DX9
+ * hardware (but not in DX9 code running on DX10 hardware), which gives
+ * inaccurate results.
+ *
+ * So, if you are in DX9, under DX9 hardware, and do you want accurate linear
+ * blending, you must set this flag to 1.
+ *
+ * It's ignored when using SMAA_HLSL_4, and of course, only has sense when
+ * using sRGB read and writes on the last pass.
+ */
+#ifndef SMAA_DIRECTX9_LINEAR_BLEND
+#define SMAA_DIRECTX9_LINEAR_BLEND 0
+#endif
+
+/**
+ * On ATI compilers, discard cannot be used in vertex shaders. Thus, they need
+ * to be compiled separately. These macros allow to easily accomplish it.
+ */
+#ifndef SMAA_ONLY_COMPILE_VS
+#define SMAA_ONLY_COMPILE_VS 0
+#endif
+#ifndef SMAA_ONLY_COMPILE_PS
+#define SMAA_ONLY_COMPILE_PS 0
+#endif
+
+//-----------------------------------------------------------------------------
+// Non-Configurable Defines
+
+#ifndef SMAA_AREATEX_MAX_DISTANCE
+#define SMAA_AREATEX_MAX_DISTANCE 16
+#endif
+#ifndef SMAA_AREATEX_MAX_DISTANCE_DIAG
+#define SMAA_AREATEX_MAX_DISTANCE_DIAG 20
+#endif
+#define SMAA_AREATEX_PIXEL_SIZE (1.0 / float2(160.0, 240.0))
+#define SMAA_AREATEX_SUBTEX_SIZE (1.0 / 3.0)
+
+//-----------------------------------------------------------------------------
+// Porting Functions
+
+#if SMAA_HLSL_3 == 1
+#define SMAATexture2D sampler2D
+//#define SMAASampleLevelZero(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))
+#define SMAASampleLevelZero(tex, coord) tex2Dlod(tex, float4(coord, coord)) //CJ nice reduction of ALU
+//#define SMAASampleLevelZeroPoint(tex, coord) tex2Dlod(tex, float4(coord, 0.0, 0.0))
+#define SMAASampleLevelZeroPoint(tex, coord) tex2Dlod(tex, float4(coord, coord)) //CJ nice reduction of ALU
+#define SMAASample(tex, coord) tex2D(tex, coord)
+#define SMAASamplePoint(tex, coord) tex2D(tex, coord)
+//#define SMAASampleLevelZeroOffset(tex, coord, offset) tex2Dlod(tex, float4(coord + offset * SMAA_PIXEL_SIZE, 0.0, 0.0))
+#define SMAASampleLevelZeroOffset(tex, coord, offset) tex2Dlod(tex, float4(coord + offset * SMAA_PIXEL_SIZE,coord + offset * SMAA_PIXEL_SIZE)) //CJ nice reduction of ALU
+#define SMAASampleOffset(tex, coord, offset) tex2D(tex, coord + offset * SMAA_PIXEL_SIZE)
+#define SMAALerp(a, b, t) lerp(a, b, t)
+#define SMAASaturate(a) saturate(a)
+#define SMAAMad(a, b, c) mad(a, b, c)
+#define SMAA_FLATTEN [flatten]
+#define SMAA_BRANCH [branch]
+#endif
+#if SMAA_HLSL_4 == 1 || SMAA_HLSL_4_1 == 1
+SamplerState LinearSampler { Filter = MIN_MAG_LINEAR_MIP_POINT; AddressU = Clamp; AddressV = Clamp; };
+SamplerState PointSampler { Filter = MIN_MAG_MIP_POINT; AddressU = Clamp; AddressV = Clamp; };
+#define SMAATexture2D Texture2D
+//#define SMAASampleLevelZero(tex, coord) tex.SampleLevel(LinearSampler, coord, 0)
+#define SMAASampleLevelZero(tex, coord) tex.SampleLevel(LinearSampler, coord, coord.x) //CJ
+//#define SMAASampleLevelZeroPoint(tex, coord) tex.SampleLevel(PointSampler, coord, 0)
+#define SMAASampleLevelZeroPoint(tex, coord) tex.SampleLevel(PointSampler, coord, coord.x) //CJ
+//#define SMAASample(tex, coord) SMAASampleLevelZero(tex, coord)
+#define SMAASample(tex, coord) tex.Sample(LinearSampler, coord) //CJ
+//#define SMAASamplePoint(tex, coord) SMAASampleLevelZeroPoint(tex, coord)
+#define SMAASamplePoint(tex, coord) tex.Sample(PointSampler, coord) //CJ
+//#define SMAASampleLevelZeroOffset(tex, coord, offset) tex.SampleLevel(LinearSampler, coord, 0, offset)
+#define SMAASampleLevelZeroOffset(tex, coord, offset) tex.SampleLevel(LinearSampler, coord, coord.x, offset) //CJ
+//#define SMAASampleOffset(tex, coord, offset) SMAASampleLevelZeroOffset(tex, coord, offset)
+#define SMAASampleOffset(tex, coord, offset) tex.Sample(LinearSampler, coord, offset) //CJ
+#define SMAALerp(a, b, t) lerp(a, b, t)
+#define SMAASaturate(a) saturate(a)
+#define SMAAMad(a, b, c) mad(a, b, c)
+#define SMAA_FLATTEN [flatten]
+#define SMAA_BRANCH [branch]
+#endif
+#if SMAA_HLSL_4_1 == 1
+#define SMAAGather(tex, coord) tex.Gather(LinearSampler, coord, 0)
+#endif
+#if SMAA_GLSL_3 == 1 || SMAA_GLSL_4 == 1
+#define SMAATexture2D sampler2D
+#define SMAASampleLevelZero(tex, coord) textureLod(tex, coord, 0.0)
+#define SMAASampleLevelZeroPoint(tex, coord) textureLod(tex, coord, 0.0)
+#define SMAASample(tex, coord) texture(tex, coord)
+#define SMAASamplePoint(tex, coord) texture(tex, coord)
+#define SMAASampleLevelZeroOffset(tex, coord, offset) textureLodOffset(tex, coord, 0.0, offset)
+#define SMAASampleOffset(tex, coord, offset) texture(tex, coord, offset)
+#define SMAALerp(a, b, t) mix(a, b, t)
+#define SMAASaturate(a) clamp(a, 0.0, 1.0)
+#define SMAA_FLATTEN
+#define SMAA_BRANCH
+#define float2 vec2
+#define float3 vec3
+#define float4 vec4
+#define int2 ivec2
+#define int3 ivec3
+#define int4 ivec4
+#endif
+#if SMAA_GLSL_3 == 1
+#define SMAAMad(a, b, c) (a * b + c)
+#endif
+#if SMAA_GLSL_4 == 1
+#define SMAAMad(a, b, c) fma(a, b, c)
+#define SMAAGather(tex, coord) textureGather(tex, coord)
+#endif
+
+//-----------------------------------------------------------------------------
+// Misc functions
+
+/**
+ * Gathers current pixel, and the top-left neighbors.
+ */
+float3 SMAAGatherNeighbours(float2 texcoord,
+                            float4 offset[3],
+                            SMAATexture2D tex) {
+    #if SMAA_HLSL_4_1 == 1
+    return SMAAGather(tex, texcoord + SMAA_PIXEL_SIZE * float2(-0.5, -0.5)).grb;
+    #else
+    float P = SMAASample(tex, texcoord).r;
+    float Pleft = SMAASample(tex, offset[0].xy).r;
+    float Ptop  = SMAASample(tex, offset[0].zw).r;
+    return float3(P, Pleft, Ptop);
+    #endif
+}
+
+/**
+ * Adjusts the threshold by means of predication.
+ */
+float2 SMAACalculatePredicatedThreshold(float2 texcoord,
+                                        float4 offset[3],
+                                        SMAATexture2D colorTex,
+                                        SMAATexture2D predicationTex) {
+    float3 neighbours = SMAAGatherNeighbours(texcoord, offset, predicationTex);
+    float2 delta = abs(neighbours.xx - float2(neighbours.y, neighbours.z));
+    float2 edges = step(SMAA_PREDICATION_THRESHOLD, delta);
+    return SMAA_PREDICATION_SCALE * SMAA_THRESHOLD * (1.0 - SMAA_PREDICATION_STRENGTH * edges);
+}
+
+#if SMAA_ONLY_COMPILE_PS == 0
+//-----------------------------------------------------------------------------
+// Vertex Shaders
+
+/**
+ * Edge Detection Vertex Shader
+ */
+void SMAAEdgeDetectionVS(float4 position,
+                         out float4 svPosition,
+                         inout float2 texcoord,
+                         out float4 offset[3]) {
+    svPosition = position;
+
+    offset[0] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0);
+    offset[1] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0,  1.0);
+    offset[2] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-2.0, 0.0, 0.0, -2.0);
+}
+
+/**
+ * Blend Weight Calculation Vertex Shader
+ */
+void SMAABlendWeightCalculationVS(float4 position,
+                                  out float4 svPosition,
+                                  inout float2 texcoord,
+                                  out float2 pixcoord,
+                                  out float4 offset[3]) {
+    svPosition = position;
+
+    pixcoord = texcoord / SMAA_PIXEL_SIZE;
+
+    // We will use these offsets for the searches later on (see @PSEUDO_GATHER4):
+    offset[0] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-0.25, -0.125,  1.25, -0.125);
+    offset[1] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-0.125, -0.25, -0.125,  1.25);
+
+    // And these for the searches, they indicate the ends of the loops:
+    offset[2] = float4(offset[0].xz, offset[1].yw) +
+                float4(-2.0, 2.0, -2.0, 2.0) *
+                SMAA_PIXEL_SIZE.xxyy * float(SMAA_MAX_SEARCH_STEPS);
+}
+
+/**
+ * Neighborhood Blending Vertex Shader
+ */
+void SMAANeighborhoodBlendingVS(float4 position,
+                                out float4 svPosition,
+                                inout float2 texcoord,
+                                out float4 offset[2]) {
+    svPosition = position;
+
+    offset[0] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0);
+    offset[1] = texcoord.xyxy + SMAA_PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0,  1.0);
+}
+
+/**
+ * Resolve Vertex Shader
+ */
+void SMAAResolveVS(float4 position,
+                   out float4 svPosition,
+                   inout float2 texcoord) {
+    svPosition = position;
+}
+#endif // SMAA_ONLY_COMPILE_PS == 0
+
+#if SMAA_ONLY_COMPILE_VS == 0
+//-----------------------------------------------------------------------------
+// Edge Detection Pixel Shaders (First Pass)
+
+/**
+ * Luma Edge Detection
+ *
+ * IMPORTANT NOTICE: luma edge detection requires gamma-corrected colors, and
+ * thus 'colorTex' should be a non-sRGB texture.
+ */
+float4 SMAALumaEdgeDetectionPS(float2 texcoord,
+                               float4 offset[3],
+                               SMAATexture2D colorTex
+                               #if SMAA_PREDICATION == 1
+                               , SMAATexture2D predicationTex
+                               #endif
+                               ) {
+    // Calculate the threshold:
+    #if SMAA_PREDICATION == 1
+    float2 threshold = SMAACalculatePredicatedThreshold(texcoord, offset, colorTex, predicationTex);
+    #else
+    float2 threshold = float2(SMAA_THRESHOLD, SMAA_THRESHOLD);
+    #endif
+
+    // Calculate lumas:
+    float3 weights = float3(0.2126, 0.7152, 0.0722);
+    float L = dot(SMAASample(colorTex, texcoord).rgb, weights);
+    float Lleft = dot(SMAASample(colorTex, offset[0].xy).rgb, weights);
+    float Ltop  = dot(SMAASample(colorTex, offset[0].zw).rgb, weights);
+
+    // We do the usual threshold:
+    float4 delta;
+    delta.xy = abs(L - float2(Lleft, Ltop));
+    float2 edges = step(threshold, delta.xy);
+
+    // Then discard if there is no edge:
+    //if (dot(edges, float2(1.0, 1.0)) == 0.0)
+    //SMAA_BRANCH if ((edges.x + edges.y) == 0.0) //CJ
+    SMAA_BRANCH if (edges.x == -edges.y) //CJ
+    {
+      discard;
+    }
+
+    else //CJ
+    {    //CJ
+
+    // Calculate right and bottom deltas:
+    float Lright = dot(SMAASample(colorTex, offset[1].xy).rgb, weights);
+    float Lbottom  = dot(SMAASample(colorTex, offset[1].zw).rgb, weights);
+    delta.zw = abs(L - float2(Lright, Lbottom));
+
+/*
+    // Calculate the maximum delta in the direct neighborhood:
+    float2 maxDelta = max(delta.xy, delta.zw);
+    maxDelta = max(maxDelta.xx, maxDelta.yy);
+*/
+
+
+    // Calculate the maximum delta in the direct neighborhood: //CJ
+    float2 maxDelta = max(delta.xy, delta.zw);
+    maxDelta.x = max(maxDelta.x, maxDelta.y);
+
+
+/*
+    // Calculate the maximum delta in the direct neighborhood:
+    float2 maxDelta;
+    maxDelta.x = max(delta.x, delta.y);
+    maxDelta.y = max(delta.z, delta.w);
+    maxDelta.x = max(maxDelta.x, maxDelta.y);
+*/
+
+    if (!any(abs(maxDelta.xx) - abs(2.0 * delta.xy)))
+    //if ((2.0 * delta.x) > maxDelta.x || (2.0 * delta.y) > maxDelta.x)
+    {
+    // Calculate left-left and top-top deltas:
+    float Lleftleft = dot(SMAASample(colorTex, offset[2].xy).rgb, weights);
+    float Ltoptop = dot(SMAASample(colorTex, offset[2].zw).rgb, weights);
+    delta.zw = abs(float2(Lleft, Ltop) - float2(Lleftleft, Ltoptop));
+
+/*
+    // Calculate the final maximum delta:
+    maxDelta = max(maxDelta.xy, delta.zw);
+*/
+
+    // Calculate the final maximum delta:
+    maxDelta = max(maxDelta.xx, delta.zw); //CJ
+    } //CJ
+
+    /**
+     * Each edge with a delta in luma of less than 50% of the maximum luma
+     * surrounding this pixel is discarded. This allows to eliminate spurious
+     * crossing edges, and is based on the fact that, if there is too much
+     * contrast in a direction, that will hide contrast in the other
+     * neighbors.
+     * This is done after the discard intentionally as this situation doesn't
+     * happen too frequently (but it's important to do as it prevents some
+     * edges from going undetected).
+     */
+    //edges.xy *= step(0.5 * maxDelta, delta.xy);
+    edges.xy *= step(maxDelta, 2.0 * delta.xy); //CJ
+    } //CJ
+
+    return float4(edges, 0.0, 0.0);
+}
+
+/**
+ * Color Edge Detection
+ *
+ * IMPORTANT NOTICE: color edge detection requires gamma-corrected colors, and
+ * thus 'colorTex' should be a non-sRGB texture.
+ */
+float4 SMAAColorEdgeDetectionPS(float2 texcoord,
+                                float4 offset[3],
+                                SMAATexture2D colorTex
+                                #if SMAA_PREDICATION == 1
+                                , SMAATexture2D predicationTex
+                                #endif
+                                ) {
+    // Calculate the threshold:
+    #if SMAA_PREDICATION == 1
+    float2 threshold = SMAACalculatePredicatedThreshold(texcoord, offset, colorTex, predicationTex);
+    #else
+    float2 threshold = float2(SMAA_THRESHOLD, SMAA_THRESHOLD);
+    #endif
+
+    // Calculate color deltas:
+    float4 delta;
+    float3 C = SMAASample(colorTex, texcoord).rgb;
+
+    float3 Cleft = SMAASample(colorTex, offset[0].xy).rgb;
+    float3 t = abs(C - Cleft);
+    delta.x = max(max(t.r, t.g), t.b);
+
+    float3 Ctop  = SMAASample(colorTex, offset[0].zw).rgb;
+    t = abs(C - Ctop);
+    delta.y = max(max(t.r, t.g), t.b);
+
+    // We do the usual threshold:
+    float2 edges = step(threshold, delta.xy);
+
+    // Then discard if there is no edge:
+    //if (dot(edges, float2(1.0, 1.0)) == 0.0)
+    if ((edges.x + edges.y) == 0.0) //CJ - branching here seems to gain more speed than is lost by the overhead of branching. This would depend on the scene though.
+    //SMAA_BRANCH if (edges.x == -edges.y)
+    {
+      discard;
+    }
+
+    else //CJ
+    {    //CJ
+    // Calculate right and bottom deltas:
+    float3 Cright = SMAASample(colorTex, offset[1].xy).rgb;
+    t = abs(C - Cright);
+    delta.z = max(max(t.r, t.g), t.b);
+
+    float3 Cbottom  = SMAASample(colorTex, offset[1].zw).rgb;
+    t = abs(C - Cbottom);
+    delta.w = max(max(t.r, t.g), t.b);
+
+    // Calculate the maximum delta in the direct neighborhood:
+    float maxDelta = max(max(max(delta.x, delta.y), delta.z), delta.w);
+
+    // Calculate left-left and top-top deltas:
+    float3 Cleftleft  = SMAASample(colorTex, offset[2].xy).rgb;
+    t = abs(C - Cleftleft);
+    delta.z = max(max(t.r, t.g), t.b);
+
+    float3 Ctoptop = SMAASample(colorTex, offset[2].zw).rgb;
+    t = abs(C - Ctoptop);
+    delta.w = max(max(t.r, t.g), t.b);
+
+    // Calculate the final maximum delta:
+    maxDelta = max(max(maxDelta, delta.z), delta.w);
+
+    // Local contrast adaptation in action:
+    //edges.xy *= step(0.5 * maxDelta, delta.xy);
+    edges.xy *= step(maxDelta, delta.xy * 2.0); //CJ a little faster
+
+    } //CJ
+
+    return float4(edges, 0.0, 0.0);
+}
+
+/**
+ * Depth Edge Detection
+ */
+float4 SMAADepthEdgeDetectionPS(float2 texcoord,
+                                float4 offset[3],
+                                SMAATexture2D depthTex) {
+    float3 neighbours = SMAAGatherNeighbours(texcoord, offset, depthTex);
+    float2 delta = abs(neighbours.xx - float2(neighbours.y, neighbours.z));
+    float2 edges = step(SMAA_DEPTH_THRESHOLD, delta);
+
+    //if (dot(edges, float2(1.0, 1.0)) == 0.0)
+    //if ((edges.x + edges.y) == 0.0) //CJ
+    if (edges.x == -edges.y) //CJ
+        discard;
+
+    return float4(edges, 0.0, 0.0);
+}
+
+//-----------------------------------------------------------------------------
+// Diagonal Search Functions
+
+#if SMAA_MAX_SEARCH_STEPS_DIAG > 0 || SMAA_FORCE_DIAGONAL_DETECTION == 1
+
+/**
+ * These functions allows to perform diagonal pattern searches.
+ */
+
+/*
+float SMAASearchDiag1(SMAATexture2D edgesTex, float2 texcoord, float2 dir, float c) {
+    //texcoord += dir * SMAA_PIXEL_SIZE;
+    texcoord = dir * SMAA_PIXEL_SIZE + texcoord; //CJ - no change
+    float2 e = float2(0.0, 0.0);
+    float i;
+    for (i = 0.0; i < float(SMAA_MAX_SEARCH_STEPS_DIAG); i++) {
+        e.rg = SMAASampleLevelZero(edgesTex, texcoord).rg;
+        //SMAA_FLATTEN if (dot(e, float2(1.0, 1.0)) < 1.9) break;
+        SMAA_FLATTEN if ((e.r + e.g) < 1.9) break; //CJ fewer amd ASM
+        texcoord = dir * SMAA_PIXEL_SIZE + texcoord; //CJ - no change
+    }
+    return float(e.g > 0.9) * c + i; //CJ no change
+}
+*/
+
+float SMAASearchDiag1(SMAATexture2D edgesTex, float2 texcoord, float2 dir, float c) { //CJ
+
+    float2 e = float2(0.0, 0.0);
+    float i = 0.0;
+
+    float2 thisway = dir * SMAA_PIXEL_SIZE;
+
+    texcoord = thisway + texcoord; //CJ - no change
+
+    [fastopt] //not glsl compatible I think
+    while (i < float(SMAA_MAX_SEARCH_STEPS_DIAG)) { //hmm I'm not sure GLSL can do while loops - also a do while loop might be better
+        e.rg = SMAASampleLevelZero(edgesTex, texcoord).rg;
+        SMAA_FLATTEN if ((e.r + e.g) < 1.9) break; //CJ fewer amd ASM - no fewer cycles
+        texcoord = thisway + texcoord; //CJ - no change
+        i++;
+    }
+
+    return float(e.g > 0.9) * c + i; //CJ no change
+}
+
+
+
+float SMAASearchDiag2(SMAATexture2D edgesTex, float2 texcoord, float2 dir, float c) {
+    texcoord += dir * SMAA_PIXEL_SIZE;
+    float2 e = float2(0.0, 0.0);
+    float i;
+    for (i = 0.0; i < float(SMAA_MAX_SEARCH_STEPS_DIAG); i++) {
+        e.g = SMAASampleLevelZero(edgesTex, texcoord).g;
+        e.r = SMAASampleLevelZeroOffset(edgesTex, texcoord, int2(1, 0)).r;
+        //SMAA_FLATTEN if (dot(e, float2(1.0, 1.0)) < 1.9) break;
+		SMAA_FLATTEN if ((e.r + e.g) < 1.9) break; //CJ fewer amd ASM - no fewer cycles,but possible performance gain - check
+		texcoord = dir * SMAA_PIXEL_SIZE + texcoord; //CJ - no change
+    }
+    return i + float(e.g > 0.9) * c;
+}
+
+/**
+ * Similar to SMAAArea, this calculates the area corresponding to a certain
+ * diagonal distance and crossing edges 'e'.
+ */
+float2 SMAAAreaDiag(SMAATexture2D areaTex, float2 dist, float2 e, float offset) {
+    float2 texcoord = float(SMAA_AREATEX_MAX_DISTANCE_DIAG) * e + dist;
+
+    // We do a scale and bias for mapping to texel space:
+    texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);
+
+    // Diagonal areas are on the second half of the texture:
+    texcoord.x += 0.5;
+
+    // Move to proper place, according to the subpixel offset:
+    texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;
+
+    // Do it!
+    #if SMAA_HLSL_3 == 1
+    return SMAASampleLevelZero(areaTex, texcoord).ra;
+    #else
+    return SMAASampleLevelZero(areaTex, texcoord).rg;
+    #endif
+}
+
+/**
+ * This searches for diagonal patterns and returns the corresponding weights.
+ */
+float2 SMAACalculateDiagWeights(SMAATexture2D edgesTex, SMAATexture2D areaTex, float2 texcoord, float2 e, int4 subsampleIndices) {
+    float2 weights = float2(0.0, 0.0);
+
+    float2 d;
+    d.x = e.r > 0.0? SMAASearchDiag1(edgesTex, texcoord, float2(-1.0,  1.0), 1.0) : 0.0; //CJ TODO try e.r ? instead of e.r > 0.0?
+    d.y = SMAASearchDiag1(edgesTex, texcoord, float2(1.0, -1.0), 0.0);
+
+    SMAA_BRANCH
+    if (d.r + d.g > 2.0) { // d.r + d.g + 1 > 3
+        float4 coords = SMAAMad(float4(-d.r, d.r, d.g, -d.g), SMAA_PIXEL_SIZE.xyxy, texcoord.xyxy);
+
+        float4 c;
+        c.x = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-1,  0)).g;
+        c.y = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2( 0,  0)).r;
+        c.z = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1,  0)).g;
+        c.w = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1, -1)).r;
+        float2 e = 2.0 * c.xz + c.yw;
+        float t = float(SMAA_MAX_SEARCH_STEPS_DIAG) - 1.0;
+        e *= step(d.rg, float2(t, t));
+
+        weights += SMAAAreaDiag(areaTex, d, e, float(subsampleIndices.z));
+    }
+
+    d.x = SMAASearchDiag2(edgesTex, texcoord, float2(-1.0, -1.0), 0.0);
+    float right = SMAASampleLevelZeroOffset(edgesTex, texcoord, int2(1, 0)).r;
+    d.y = right > 0.0? SMAASearchDiag2(edgesTex, texcoord, float2(1.0, 1.0), 1.0) : 0.0;
+
+    SMAA_BRANCH
+    if (d.r + d.g > 2.0) { // d.r + d.g + 1 > 3
+        float4 coords = SMAAMad(float4(-d.r, -d.r, d.g, d.g), SMAA_PIXEL_SIZE.xyxy, texcoord.xyxy);
+
+        float4 c;
+        c.x  = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-1,  0)).g;
+        c.y  = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2( 0, -1)).r;
+        c.zw = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1,  0)).gr;
+        float2 e = 2.0 * c.xz + c.yw;
+        float t = float(SMAA_MAX_SEARCH_STEPS_DIAG) - 1.0;
+        e *= step(d.rg, float2(t, t));
+
+        weights += SMAAAreaDiag(areaTex, d, e, float(subsampleIndices.w)).gr;
+    }
+
+    return weights;
+}
+#endif
+
+//-----------------------------------------------------------------------------
+// Horizontal/Vertical Search Functions
+
+/**
+ * This allows to determine how much length should we add in the last step
+ * of the searches. It takes the bilinearly interpolated edge (see
+ * @PSEUDO_GATHER4), and adds 0, 1 or 2, depending on which edges and
+ * crossing edges are active.
+ */
+float SMAASearchLength(SMAATexture2D searchTex, float2 e, float bias, float scale) {
+    // Not required if searchTex accesses are set to point:
+    // float2 SEARCH_TEX_PIXEL_SIZE = 1.0 / float2(66.0, 33.0);
+    // e = float2(bias, 0.0) + 0.5 * SEARCH_TEX_PIXEL_SIZE +
+    //     e * float2(scale, 1.0) * float2(64.0, 32.0) * SEARCH_TEX_PIXEL_SIZE;
+    e.r = e.r * scale + bias; //CJ
+    return 255.0 * SMAASampleLevelZeroPoint(searchTex, e).r;
+}
+
+/**
+ * Horizontal/vertical search functions for the 2nd pass.
+ */
+float SMAASearchXLeft(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
+    /**
+     * @PSEUDO_GATHER4
+     * This texcoord has been offset by (-0.25, -0.125) in the vertex shader to
+     * sample between edge, thus fetching four edges in a row.
+     * Sampling with different offsets in each direction allows to disambiguate
+     * which edges are active from the four fetched ones.
+     */
+    float2 e = float2(0.0, 1.0);
+    while (texcoord.x > end &&
+           e.g > 0.8281 && // Is there some edge not activated?
+           e.r == 0.0) { // Or is there a crossing edge that breaks the line?
+      e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+      texcoord -= float2(2.0, 0.0) * SMAA_PIXEL_SIZE;
+		  //texcoord = float2(-2.0, 0.0) * SMAA_PIXEL_SIZE + texcoord; //CJ - no change
+    }
+
+    // We correct the previous (-0.25, -0.125) offset we applied:
+    texcoord.x += 0.25 * SMAA_PIXEL_SIZE.x;
+
+    // The searches are bias by 1, so adjust the coords accordingly:
+    texcoord.x += SMAA_PIXEL_SIZE.x;
+
+    // Disambiguate the length added by the last step:
+    texcoord.x += 2.0 * SMAA_PIXEL_SIZE.x; // Undo last step
+
+    //texcoord.x = 3.25 * SMAA_PIXEL_SIZE.x + texcoord.x; //CJ
+    //texcoord.x -= SMAA_PIXEL_SIZE.x * SMAASearchLength(searchTex, e, 0.0, 0.5);
+    texcoord.x = -SMAA_PIXEL_SIZE.x * SMAASearchLength(searchTex, e, 0.0, 0.5) + texcoord.x; //CJ
+
+    return texcoord.x;
+}
+
+float SMAASearchXRight(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
+    float2 e = float2(0.0, 1.0);
+
+    while (texcoord.x < end &&
+           e.g > 0.8281 && // Is there some edge not activated?
+           e.r == 0.0) { // Or is there a crossing edge that breaks the line?
+        e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+        //texcoord += float2(2.0, 0.0) * SMAA_PIXEL_SIZE;
+        texcoord = float2(2.0, 0.0) * SMAA_PIXEL_SIZE + texcoord; //CJ - no change
+    }
+
+    texcoord.x -= 0.25 * SMAA_PIXEL_SIZE.x;
+    texcoord.x -= SMAA_PIXEL_SIZE.x;
+    texcoord.x -= 2.0 * SMAA_PIXEL_SIZE.x;
+    //texcoord.x += SMAA_PIXEL_SIZE.x * SMAASearchLength(searchTex, e, 0.5, 0.5);
+    texcoord.x = SMAA_PIXEL_SIZE.x * SMAASearchLength(searchTex, e, 0.5, 0.5) + texcoord.x;  //CJ - no change
+    return texcoord.x;
+}
+
+float SMAASearchYUp(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
+    float2 e = float2(1.0, 0.0);
+    while (texcoord.y > end &&
+           e.r > 0.8281 && // Is there some edge not activated?
+           e.g == 0.0) { // Or is there a crossing edge that breaks the line?
+        e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+        texcoord -= float2(0.0, 2.0) * SMAA_PIXEL_SIZE;
+    }
+
+    texcoord.y += 0.25 * SMAA_PIXEL_SIZE.y;
+    texcoord.y += SMAA_PIXEL_SIZE.y;
+    texcoord.y += 2.0 * SMAA_PIXEL_SIZE.y;
+    //texcoord.y -= SMAA_PIXEL_SIZE.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5);
+	texcoord.y = -SMAA_PIXEL_SIZE.y * SMAASearchLength(searchTex, e.gr, 0.0, 0.5) + texcoord.y; //CJ - no change
+    return texcoord.y;
+}
+
+float SMAASearchYDown(SMAATexture2D edgesTex, SMAATexture2D searchTex, float2 texcoord, float end) {
+    float2 e = float2(1.0, 0.0);
+    while (texcoord.y < end &&
+           e.r > 0.8281 && // Is there some edge not activated?
+           e.g == 0.0) { // Or is there a crossing edge that breaks the line?
+        e = SMAASampleLevelZero(edgesTex, texcoord).rg;
+        texcoord += float2(0.0, 2.0) * SMAA_PIXEL_SIZE;
+    }
+
+    texcoord.y -= 0.25 * SMAA_PIXEL_SIZE.y;
+    texcoord.y -= SMAA_PIXEL_SIZE.y;
+    texcoord.y -= 2.0 * SMAA_PIXEL_SIZE.y;
+    //texcoord.y += SMAA_PIXEL_SIZE.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5);
+    texcoord.y = SMAA_PIXEL_SIZE.y * SMAASearchLength(searchTex, e.gr, 0.5, 0.5) + texcoord.y; //CJ - no change
+    return texcoord.y;
+}
+
+/**
+ * Ok, we have the distance and both crossing edges. So, what are the areas
+ * at each side of current edge?
+ */
+float2 SMAAArea(SMAATexture2D areaTex, float2 dist, float e1, float e2, float offset) {
+    // Rounding prevents precision errors of bilinear filtering:
+    float2 texcoord = float(SMAA_AREATEX_MAX_DISTANCE) * round(4.0 * float2(e1, e2)) + dist;
+
+    // We do a scale and bias for mapping to texel space:
+    texcoord = SMAA_AREATEX_PIXEL_SIZE * texcoord + (0.5 * SMAA_AREATEX_PIXEL_SIZE);
+
+    // Move to proper place, according to the subpixel offset:
+    //texcoord.y += SMAA_AREATEX_SUBTEX_SIZE * offset;
+	texcoord.y = SMAA_AREATEX_SUBTEX_SIZE * offset + texcoord.y; //CJ
+
+    // Do it!
+    #if SMAA_HLSL_3 == 1
+    return SMAASampleLevelZero(areaTex, texcoord).ra;
+    #else
+    return SMAASampleLevelZero(areaTex, texcoord).rg;
+    #endif
+}
+
+//-----------------------------------------------------------------------------
+// Corner Detection Functions
+
+void SMAADetectHorizontalCornerPattern(SMAATexture2D edgesTex, inout float2 weights, float2 texcoord, float2 d) {
+    #if SMAA_CORNER_ROUNDING < 100 || SMAA_FORCE_CORNER_DETECTION == 1
+    float4 coords = SMAAMad(float4(d.x, 0.0, d.y, 0.0), //CJ - this look ripe for a rewrite
+                            SMAA_PIXEL_SIZE.xyxy, texcoord.xyxy);
+    float2 e;
+
+	/*
+    e.r = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(0.0,  1.0)).r;
+    bool left = abs(d.x) < abs(d.y);
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(0.0, -2.0)).r;
+
+    if (left) weights *= SMAASaturate(float(SMAA_CORNER_ROUNDING) / 100.0 + 1.0 - e);
+
+    e.r = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2(1.0,  1.0)).r;
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2(1.0, -2.0)).r;
+    if (!left) weights *= SMAASaturate(float(SMAA_CORNER_ROUNDING) / 100.0 + 1.0 - e);
+	*/
+
+	//bool left = abs(d.x) < abs(d.y);
+
+	SMAA_BRANCH  //CJ - test if this branch is faster than original code
+	if (abs(d.x) < abs(d.y)) //if (left)
+	{
+    e.r = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(0.0,  1.0)).r;
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(0.0, -2.0)).r;
+	}
+	else
+	{
+    e.r = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2(1.0,  1.0)).r;
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2(1.0, -2.0)).r;
+	}
+
+	//weights *= SMAASaturate(float(SMAA_CORNER_ROUNDING) / 100.0 + 1.0 - e);
+	weights = SMAASaturate(-e * weights + (1.0 + float(SMAA_CORNER_ROUNDING) * 0.01) * weights); //CJ - should compile to a mad when SMAA_CORNER_ROUNDING is 0
+    #endif
+}
+
+void SMAADetectVerticalCornerPattern(SMAATexture2D edgesTex, inout float2 weights, float2 texcoord, float2 d) {
+    #if SMAA_CORNER_ROUNDING < 100 || SMAA_FORCE_CORNER_DETECTION == 1
+    float4 coords = SMAAMad(float4(0.0, d.x, 0.0, d.y),
+                            SMAA_PIXEL_SIZE.xyxy, texcoord.xyxy);
+    float2 e;
+	/*
+    e.r = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2( 1.0, 0.0)).g;
+    bool left = abs(d.x) < abs(d.y);
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-2.0, 0.0)).g;
+    if (left) weights *= SMAASaturate(float(SMAA_CORNER_ROUNDING) / 100.0 + 1.0 - e);
+
+    e.r = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1.0, 1.0)).g;
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2(-2.0, 1.0)).g;
+    if (!left) weights *= SMAASaturate(float(SMAA_CORNER_ROUNDING) / 100.0 + 1.0 - e);
+	*/
+
+	SMAA_BRANCH  //CJ - test if this branch is faster than original code
+	if (abs(d.x) < abs(d.y)) //if (left)
+	{
+	e.r = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2( 1.0, 0.0)).g;
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.xy, int2(-2.0, 0.0)).g;
+    }
+	else
+	{
+    e.r = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2( 1.0, 1.0)).g;
+    e.g = SMAASampleLevelZeroOffset(edgesTex, coords.zw, int2(-2.0, 1.0)).g;
+	}
+	weights *= SMAASaturate(float(SMAA_CORNER_ROUNDING) / 100.0 + 1.0 - e);
+
+    #endif
+}
+
+//-----------------------------------------------------------------------------
+// Blending Weight Calculation Pixel Shader (Second Pass)
+
+float4 SMAABlendingWeightCalculationPS(float2 texcoord,
+                                       float2 pixcoord,
+                                       float4 offset[3],
+                                       SMAATexture2D edgesTex,
+                                       SMAATexture2D areaTex,
+                                       SMAATexture2D searchTex,
+                                       int4 subsampleIndices) { // Just pass zero for SMAA 1x, see @SUBSAMPLE_INDICES.
+    float4 weights = float4(0.0, 0.0, 0.0, 0.0);
+
+    float2 e = SMAASample(edgesTex, texcoord).rg;
+
+    SMAA_BRANCH
+    //if (e.g > 0.0) { // Edge at north
+    if (e.g != -e.r) { // Edge at north //CJ - if neither e.g or e.r is 0
+        #if SMAA_MAX_SEARCH_STEPS_DIAG > 0 || SMAA_FORCE_DIAGONAL_DETECTION == 1
+        // Diagonals have both north and west edges, so searching for them in
+        // one of the boundaries is enough.
+        weights.rg = SMAACalculateDiagWeights(edgesTex, areaTex, texcoord, e, subsampleIndices);
+
+        // We give priority to diagonals, so if we find a diagonal we skip
+        // horizontal/vertical processing.
+    SMAA_BRANCH
+    //if (dot(weights.rg, float2(1.0, 1.0)) == 0.0) {
+		//if (!(weights.r + weights.g)) { //CJ
+		//if ((weights.r + weights.g) == 0.0) { //CJ one instruction shorter
+		if (weights.r == -weights.g) { //CJ one instruction shorter - same asm as above
+        #endif
+
+        float2 d;
+
+        // Find the distance to the left:
+        float2 coords;
+        coords.x = SMAASearchXLeft(edgesTex, searchTex, offset[0].xy, offset[2].x);
+        coords.y = offset[1].y; // offset[1].y = texcoord.y - 0.25 * SMAA_PIXEL_SIZE.y (@CROSSING_OFFSET)
+        d.x = coords.x;
+
+        // Now fetch the left crossing edges, two at a time using bilinear
+        // filtering. Sampling at -0.25 (see @CROSSING_OFFSET) enables to
+        // discern what value each edge has:
+        float e1 = SMAASampleLevelZero(edgesTex, coords).r;
+
+        // Find the distance to the right:
+        coords.x = SMAASearchXRight(edgesTex, searchTex, offset[0].zw, offset[2].y);
+        d.y = coords.x;
+
+        // We want the distances to be in pixel units (doing this here allow to
+        // better interleave arithmetic and memory accesses):
+        //d = d / SMAA_PIXEL_SIZE.x - pixcoord.x;
+        d = d * (1.0 / SMAA_PIXEL_SIZE.x) - pixcoord.x; //CJ - no change
+
+        // SMAAArea below needs a sqrt, as the areas texture is compressed
+        // quadratically:
+        float2 sqrt_d = sqrt(abs(d));
+
+        // Fetch the right crossing edges:
+        float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, int2(1, 0)).r;
+
+        // Ok, we know how this pattern looks like, now it is time for getting
+        // the actual area:
+        weights.rg = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.y));
+
+        // Fix corners:
+        SMAADetectHorizontalCornerPattern(edgesTex, weights.rg, texcoord, d);
+
+        #if SMAA_MAX_SEARCH_STEPS_DIAG > 0 || SMAA_FORCE_DIAGONAL_DETECTION == 1
+        } else
+            e.r = 0.0; // Skip vertical processing.
+        #endif
+
+
+
+        SMAA_BRANCH
+        if (e.r > 0.0) { // Edge at west
+            float2 d;
+
+            // Find the distance to the top:
+            float2 coords;
+            coords.y = SMAASearchYUp(edgesTex, searchTex, offset[1].xy, offset[2].z);
+            coords.x = offset[0].x; // offset[1].x = texcoord.x - 0.25 * SMAA_PIXEL_SIZE.x;
+            d.x = coords.y;
+
+            // Fetch the top crossing edges:
+            float e1 = SMAASampleLevelZero(edgesTex, coords).g;
+
+            // Find the distance to the bottom:
+            coords.y = SMAASearchYDown(edgesTex, searchTex, offset[1].zw, offset[2].w);
+            d.y = coords.y;
+
+            // We want the distances to be in pixel units:
+            d = d / SMAA_PIXEL_SIZE.y - pixcoord.y;
+
+            // SMAAArea below needs a sqrt, as the areas texture is compressed
+            // quadratically:
+            float2 sqrt_d = sqrt(abs(d));
+
+            // Fetch the bottom crossing edges:
+            float e2 = SMAASampleLevelZeroOffset(edgesTex, coords, int2(0, 1)).g;
+
+            // Get the area for this direction:
+            weights.ba = SMAAArea(areaTex, sqrt_d, e1, e2, float(subsampleIndices.x));
+
+            // Fix corners:
+            SMAADetectVerticalCornerPattern(edgesTex, weights.ba, texcoord, d);
+        }
+
+    } // CJ
+
+    return weights;
+}
+
+//-----------------------------------------------------------------------------
+// Neighborhood Blending Pixel Shader (Third Pass)
+
+float4 SMAANeighborhoodBlendingPS(float2 texcoord,
+                                  float4 offset[2],
+                                  SMAATexture2D colorTex,
+                                  SMAATexture2D blendTex) {
+    // Fetch the blending weights for current pixel:
+    float4 a;
+    a.xz = SMAASample(blendTex, texcoord).xz;
+    a.y = SMAASample(blendTex, offset[1].zw).g;
+    a.w = SMAASample(blendTex, offset[1].xy).a;
+
+    // Is there any blending weight with a value greater than 0.0?
+    SMAA_BRANCH
+    //if (dot(a, float4(1.0, 1.0, 1.0, 1.0)) < 1e-5)
+    //    return SMAASampleLevelZero(colorTex, texcoord);
+    if (((a.x + a.z) + (a.y + a.w)) < 1e-5) //CJ - reduces number of instruction slots
+        return SMAASampleLevelZero(colorTex, texcoord); //CJ
+    else {
+        //float4 color = float4(0.0, 0.0, 0.0, 0.0);
+
+        // Up to 4 lines can be crossing a pixel (one through each edge). We
+        // favor blending by choosing the line with the maximum weight for each
+        // direction:
+        float2 offset;
+        offset.x = a.a > a.b? a.a : -a.b; // left vs. right
+        offset.y = a.g > a.r? a.g : -a.r; // top vs. bottom
+
+		/*
+        // Then we go in the direction that has the maximum weight:
+        if (abs(offset.x) > abs(offset.y)) // horizontal vs. vertical
+            offset.y = 0.0;
+        else
+            offset.x = 0.0;
+		*/
+
+
+        // Then we go in the direction that has the maximum weight:
+        bool2 whichway = saturate(abs(offset.xy) - abs(offset.yx)); // CJ - same # of instructions but one GPR less
+        //float2 whichway = step( abs(offset.xy) , abs(offset.yx) ); //CJ same as above - but now with a possible error
+        offset = offset * whichway; //CJ
+
+        #if SMAA_REPROJECTION == 1
+        // Fetch the opposite color and lerp by hand:
+        float4 C = SMAASampleLevelZero(colorTex, texcoord);
+        texcoord += sign(offset) * SMAA_PIXEL_SIZE;
+        //texcoord = whichway * SMAA_PIXEL_SIZE + texcoord; //CJ faster - but beware that I have not been able to test this. It didn't work for the SMAA_DIRECTX9_LINEAR_BLEND == 1 path though.
+        float4 Cop = SMAASampleLevelZero(colorTex, texcoord);
+        float s = abs(offset.x) > abs(offset.y)? abs(offset.x) : abs(offset.y);
+        //float s = max(abs(offset.x),abs(offset.y)); //CJ
+
+        // Unpack the velocity values:
+        C.a *= C.a;
+        Cop.a *= Cop.a;
+
+        // Lerp the colors:
+        float4 Caa = SMAALerp(C, Cop, s);
+
+        // Unpack velocity and return the resulting value:
+        Caa.a = sqrt(Caa.a);
+        return Caa;
+
+        #else
+
+        #if SMAA_HLSL_4 == 1 || SMAA_DIRECTX9_LINEAR_BLEND == 0
+        // We exploit bilinear filtering to mix current pixel with the chosen
+        // neighbor:
+        texcoord += offset * SMAA_PIXEL_SIZE;
+        return SMAASampleLevelZero(colorTex, texcoord);
+
+        #else
+        // Fetch the opposite color and lerp by hand:
+        float4 C = SMAASampleLevelZero(colorTex, texcoord);
+        texcoord += sign(offset) * SMAA_PIXEL_SIZE;
+        //texcoord = whichway * SMAA_PIXEL_SIZE + texcoord; //CJ faster this way, but causes less smooth lines and I haven't been able to figure out why yet
+        float4 Cop = SMAASampleLevelZero(colorTex, texcoord);
+        float s = abs(offset.x) > abs(offset.y)? abs(offset.x) : abs(offset.y);
+        //float s = max(abs(offset.x),abs(offset.y)); //CJ - No change. Results in same ASM as above
+        //float s = offset.x + offset.y; //CJ at this point we should be sure that either offset.x or .y is 0 so we can just add them - again no improvement in ASM :(
+        return SMAALerp(C, Cop, abs(s));
+
+        #endif
+
+        #endif
+    }
+}
+
+//-----------------------------------------------------------------------------
+// Temporal Resolve Pixel Shader (Optional Fourth Pass)
+
+float4 SMAAResolvePS(float2 texcoord,
+                     SMAATexture2D colorTexCurr,
+                     SMAATexture2D colorTexPrev
+                     #if SMAA_REPROJECTION == 1
+                     , SMAATexture2D velocityTex
+                     #endif
+                     ) {
+    #if SMAA_REPROJECTION == 1
+    // Velocity is calculated from previous to current position, so we need to
+    // inverse it:
+    float2 velocity = -SMAASample(velocityTex, texcoord).rg;
+
+    // Fetch current pixel:
+    float4 current = SMAASample(colorTexCurr, texcoord);
+
+    // Reproject current coordinates and fetch previous pixel:
+    float4 previous = SMAASample(colorTexPrev, texcoord + velocity);
+
+    // Attenuate the previous pixel if the velocity is different:
+    float delta = abs(current.a * current.a - previous.a * previous.a) / 5.0;
+    //float delta = abs(dot(float2(current.a,current.a),float(-previous.a,previous.a)) / 5.0; //CJ
+    //float delta = 0.20 * (current.a + previous.a) * abs(current.a - previous.a) //CJ
+    float weight = 0.5 * SMAASaturate(1.0 - (sqrt(delta) * SMAA_REPROJECTION_WEIGHT_SCALE));
+
+    // Blend the pixels according to the calculated weight:
+    return SMAALerp(current, previous, weight);
+    #else
+    // Just blend the pixels:
+    float4 current = SMAASample(colorTexCurr, texcoord);
+    float4 previous = SMAASample(colorTexPrev, texcoord);
+    return SMAALerp(current, previous, 0.5);
+    #endif
+}
+
+//-----------------------------------------------------------------------------
+#endif // SMAA_ONLY_COMPILE_VS == 0

+ 31 - 0
Game Folder/SweetFX/Shaders/Sepia.h

@@ -0,0 +1,31 @@
+/*------------------------------------------------------------------------------
+						SEPIA
+------------------------------------------------------------------------------*/
+
+float4 SepiaPass( float4 colorInput )
+{
+	float3 sepia = colorInput.rgb;
+	
+	// calculating amounts of input, grey and sepia colors to blend and combine
+	float grey = dot(sepia, float3(0.2126, 0.7152, 0.0722));
+	
+	sepia *= ColorTone;
+	
+	float3 blend2 = (grey * GreyPower) + (colorInput.rgb / (GreyPower + 1));
+
+	colorInput.rgb = lerp(blend2, sepia, SepiaPower);
+	
+	// returning the final color
+	return colorInput;
+}
+
+    //TODO: do speed comparisons of these on nvidia hardware
+    /*
+    float3 blend2 = (grey * GreyPower) + (colorInput.rgb / (GreyPower + 1)); //379fps AMD
+
+    float3 blend2 = (GreyPower * (grey * GreyPower + grey) + colorInput.rgb) / (GreyPower + 1); //379fps AMD
+
+    float3 blend2 = (grey * GreyPower * (GreyPower+1) + colorInput.rgb) / (GreyPower + 1); //379fps AMD
+
+    float3 blend2 = (grey * GreyPower + grey * GreyPower * GreyPower + colorInput.rgb) / (GreyPower + 1); //379fps AMD
+    */

+ 61 - 0
Game Folder/SweetFX/Shaders/Splitscreen.h

@@ -0,0 +1,61 @@
+   /*-----------------------------------------------------------.   
+  /                       Splitscreen                           /
+  '-----------------------------------------------------------*/
+
+float4 SplitscreenPass( float4 colorInput, float2 tex )
+{
+  // -- Vertical 50/50 split --
+  #if splitscreen_mode == 1
+	  return (tex.x < 0.5) ? myTex2D(s0, tex) : colorInput;
+  #endif
+
+  // -- Vertical 25/50/25 split --
+	#if splitscreen_mode == 2
+    //Calculate the distance from center
+    float distance = abs(tex.x - 0.5);
+    
+    //Further than 1/4 away from center?
+    distance = saturate(distance - 0.25);
+    
+    return distance ? myTex2D(s0, tex) : colorInput;
+	#endif
+
+  // -- Vertical 50/50 angled split --
+	#if splitscreen_mode == 3
+	  //Calculate the distance from center
+    float distance = ((tex.x - 3.0/8.0) + (tex.y * 0.25));
+    
+    //Further than 1/4 away from center?
+    distance = saturate(distance - 0.25);
+    
+    return distance ? colorInput : myTex2D(s0, tex);
+	#endif
+  
+  // -- Horizontal 50/50 split --
+  #if splitscreen_mode == 4
+	  return (tex.y < 0.5) ? myTex2D(s0, tex) : colorInput;
+  #endif
+	
+  // -- Horizontal 25/50/25 split --
+  #if splitscreen_mode == 5
+    //Calculate the distance from center
+    float distance = abs(tex.y - 0.5);
+    
+    //Further than 1/4 away from center?
+    distance = saturate(distance - 0.25);
+    
+    return distance ? myTex2D(s0, tex) : colorInput;
+  #endif
+
+  // -- Vertical 50/50 curvy split --
+    #if splitscreen_mode == 6
+    //Calculate the distance from center
+    float distance = (tex.x - 0.25) + (sin(tex.y * 10)*0.10);
+    
+    //Further than 1/4 away from center?
+    distance = saturate(distance - 0.25);
+    
+    return distance ? colorInput : myTex2D(s0, tex);
+    #endif
+
+}

+ 20 - 0
Game Folder/SweetFX/Shaders/SweetCRT.h

@@ -0,0 +1,20 @@
+   /*-----------------------------------------------------------.   
+  /                        SweetCRT                            /
+  '-----------------------------------------------------------*/
+/*
+SweetCRT - a Work in progress.
+*/
+
+#define scanline_strength 0.75
+
+float4 SweetCRTPass( float4 colorInput, float2 tex )
+{
+   //
+   float scanlines = frac(tex.y * (screen_size.y * 0.5)) - 0.49; //
+   scanlines = 1.0 + scanlines * scanline_strength;
+   
+   colorInput.rgb = saturate(colorInput.rgb * scanlines);
+   //colorInput.rgb = saturate(scanlines).xxx;
+  
+   return colorInput;
+}

+ 35 - 0
Game Folder/SweetFX/Shaders/Technicolor.h

@@ -0,0 +1,35 @@
+   /*-----------------------------------------------------------.   
+  /                        TECHICOLOR                           /
+  '-----------------------------------------------------------*/
+// Original by DKT70
+// Optimized by CeeJay.dk
+// - Version 1.1
+
+#define cyanfilter float3(0.0, 1.30, 1.0)
+#define magentafilter float3(1.0, 0.0, 1.05) 
+#define yellowfilter float3(1.6, 1.6, 0.05)
+
+#define redorangefilter float2(1.05, 0.620) //RG_
+#define greenfilter float2(0.30, 1.0)       //RG_
+#define magentafilter2 magentafilter.rb     //R_B
+
+float4 TechnicolorPass( float4 colorInput )
+{
+	float3 tcol = colorInput.rgb;
+	
+  float2 rednegative_mul   = tcol.rg * (1.0 / (redNegativeAmount * TechniPower));
+	float2 greennegative_mul = tcol.rg * (1.0 / (greenNegativeAmount * TechniPower));
+	float2 bluenegative_mul  = tcol.rb * (1.0 / (blueNegativeAmount * TechniPower));
+	
+  float rednegative   = dot( redorangefilter, rednegative_mul );
+	float greennegative = dot( greenfilter, greennegative_mul );
+	float bluenegative  = dot( magentafilter2, bluenegative_mul );
+	
+	float3 redoutput   = rednegative.rrr + cyanfilter;
+	float3 greenoutput = greennegative.rrr + magentafilter;
+	float3 blueoutput  = bluenegative.rrr + yellowfilter;
+	
+	float3 result = redoutput * greenoutput * blueoutput;
+	colorInput.rgb = lerp(tcol, result, TechniAmount);
+	return colorInput;
+}

+ 44 - 0
Game Folder/SweetFX/Shaders/Tonemap.h

@@ -0,0 +1,44 @@
+/*------------------------------------------------------------------------------
+						TONEMAP
+------------------------------------------------------------------------------*/
+// Version 1.1
+
+float4 TonemapPass( float4 colorInput )
+{
+	float3 color = colorInput.rgb;
+
+	color = saturate(color - Defog * FogColor); // Defog
+	
+	color *= pow(2.0f, Exposure); // Exposure
+	
+	color = pow(color, Gamma);    // Gamma -- roll into the first gamma correction in main.h ?
+
+	//#define BlueShift 0.00	//Blueshift
+	//float4 d = color * float4(1.05f, 0.97f, 1.27f, color.a);
+	//color = lerp(color, d, BlueShift);
+	
+	float3 lumCoeff = float3(0.2126, 0.7152, 0.0722);
+	float lum = dot(lumCoeff, color.rgb);
+	
+	float3 blend = lum.rrr; //dont use float3
+	
+	float L = saturate( 10.0 * (lum - 0.45) );
+  	
+	float3 result1 = 2.0f * color.rgb * blend;
+	float3 result2 = 1.0f - 2.0f * (1.0f - blend) * (1.0f - color.rgb);
+	
+	float3 newColor = lerp(result1, result2, L);
+	float A2 = Bleach * color.rgb; //why use a float for A2 here and then multiply by color.rgb (a float3)?
+	//float3 A2 = Bleach * color.rgb; //
+	float3 mixRGB = A2 * newColor;
+	
+	color.rgb += ((1.0f - A2) * mixRGB);
+	
+	//float3 middlegray = float(color.r + color.g + color.b) / 3;
+	float3 middlegray = dot(color,(1.0/3.0)); //1fps slower than the original on nvidia, 2 fps faster on AMD
+	
+	float3 diffcolor = color - middlegray; //float 3 here
+	colorInput.rgb = (color + diffcolor * Saturation)/(1+(diffcolor*Saturation)); //saturation
+	
+	return colorInput;
+}

+ 41 - 0
Game Folder/SweetFX/Shaders/Vibrance.h

@@ -0,0 +1,41 @@
+   /*-----------------------------------------------------------.
+  /                          Vibrance                           /
+  '-----------------------------------------------------------*/
+/*
+  by Christian Cann Schuldt Jensen ~ CeeJay.dk
+
+  Vibrance intelligently boosts the saturation of pixels
+  so pixels that had little color get a larger boost than pixels that had a lot.
+
+  This avoids oversaturation of pixels that were already very saturated.
+*/
+
+float4 VibrancePass( float4 colorInput )
+{
+  #ifndef Vibrance_RGB_balance //for backwards compatibility with setting presets for older version.
+    #define Vibrance_RGB_balance float3(1.00, 1.00, 1.00)
+  #endif
+  
+  #define Vibrance_coeff float3(Vibrance_RGB_balance * Vibrance)
+
+	float4 color = colorInput; //original input color
+  float3 lumCoeff = float3(0.212656, 0.715158, 0.072186);  //Values to calculate luma with
+
+	float luma = dot(lumCoeff, color.rgb); //calculate luma (grey)
+
+	float max_color = max(colorInput.r, max(colorInput.g,colorInput.b)); //Find the strongest color
+	float min_color = min(colorInput.r, min(colorInput.g,colorInput.b)); //Find the weakest color
+
+  float color_saturation = max_color - min_color; //The difference between the two is the saturation
+
+  //color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance * (1.0 - color_saturation)))); //extrapolate between luma and original by 1 + (1-saturation) - simple
+
+  //color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance * (1.0 - (sign(Vibrance) * color_saturation))))); //extrapolate between luma and original by 1 + (1-saturation) - current
+  color.rgb = lerp(luma, color.rgb, (1.0 + (Vibrance_coeff * (1.0 - (sign(Vibrance_coeff) * color_saturation))))); //extrapolate between luma and original by 1 + (1-saturation) - current
+
+  //color.rgb = lerp(luma, color.rgb, 1.0 + (1.0-pow(color_saturation, 1.0 - (1.0-Vibrance))) ); //pow version
+
+	return color; //return the result
+	//return color_saturation.xxxx; //Visualize the saturation
+}
+

+ 93 - 0
Game Folder/SweetFX/Shaders/Vignette.h

@@ -0,0 +1,93 @@
+   /*-----------------------------------------------------------.
+  /                          Vignette                           /
+  '-----------------------------------------------------------*/
+/*
+  Version 1.3
+
+  Darkens the edges of the image to make it look more like it was shot with a camera lens.
+  May cause banding artifacts.
+*/
+
+//Make sure the VignetteRatio exits to avoid breaking if the user uses a Settings for a previous version that didn't include this
+#ifndef VignetteRatio
+  #define VignetteRatio 1.0
+#endif
+
+#ifndef VignetteType
+  #define VignetteType 1
+#endif
+
+
+//Logical XOR - not used right now but it might be useful at a later time
+float XOR( float xor_A, float xor_B )
+{
+  return saturate( dot(float4(-xor_A ,-xor_A ,xor_A , xor_B) , float4(xor_B, xor_B ,1.0 ,1.0 ) ) ); // -2 * A * B + A + B
+}
+
+float4 VignettePass( float4 colorInput, float2 tex )
+{
+
+	#if VignetteType == 1
+		//Set the center
+		float2 tc = tex - VignetteCenter;
+
+		//Adjust the ratio
+		tc *= float2((pixel.y / pixel.x),VignetteRatio);
+
+		//Calculate the distance
+		tc /= VignetteRadius;
+		float v = dot(tc,tc);
+
+		//Apply the vignette
+		colorInput.rgb *= (1.0 + pow(v, VignetteSlope * 0.5) * VignetteAmount); //pow - multiply
+	#endif
+
+	#if VignetteType == 2 // New round (-x*x+x) + (-y*y+y) method.
+    
+        tex = -tex * tex + tex;
+		colorInput.rgb = saturate(( (pixel.y / pixel.x)*(pixel.y / pixel.x) * VignetteRatio * tex.x + tex.y) * 4.0) * colorInput.rgb;
+  #endif
+
+	#if VignetteType == 3 // New (-x*x+x) * (-y*y+y) TV style method.
+
+        tex = -tex * tex + tex;
+		colorInput.rgb = saturate(tex.x * tex.y * 100.0) * colorInput.rgb;
+	#endif
+		
+	#if VignetteType == 4
+		tex = abs(tex - 0.5);
+		//tex = abs(0.5 - tex); //same result
+		float tc = dot(float4(-tex.x ,-tex.x ,tex.x , tex.y) , float4(tex.y, tex.y ,1.0 ,1.0 ) ); //XOR
+
+		tc = saturate(tc -0.495);
+		colorInput.rgb *= (pow((1.0 - tc * 200),4)+0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
+  #endif
+  
+	#if VignetteType == 5
+		tex = abs(tex - 0.5);
+		//tex = abs(0.5 - tex); //same result
+		float tc = dot(float4(-tex.x ,-tex.x ,tex.x , tex.y) , float4(tex.y, tex.y ,1.0 ,1.0 ) ); //XOR
+
+		tc = saturate(tc -0.495)-0.0002;
+		colorInput.rgb *= (pow((1.0 - tc * 200),4)+0.0); //or maybe abs(tc*100-1) (-(tc*100)-1)
+  #endif
+
+	#if VignetteType == 6 //MAD version of 2
+		tex = abs(tex - 0.5);
+		//tex = abs(0.5 - tex); //same result
+		float tc = tex.x * (-2.0 * tex.y + 1.0) + tex.y; //XOR
+
+		tc = saturate(tc -0.495);
+		colorInput.rgb *= (pow((-tc * 200 + 1.0),4)+0.25); //or maybe abs(tc*100-1) (-(tc*100)-1)
+		//colorInput.rgb *= (pow(((tc*200.0)-1.0),4)); //or maybe abs(tc*100-1) (-(tc*100)-1)
+  #endif
+
+  #if VignetteType == 7 // New round (-x*x+x) * (-y*y+y) method.
+    
+	  //tex.y /= float2((pixel.y / pixel.x),VignetteRatio);
+    float tex_xy = dot( float4(tex,tex) , float4(-tex,1.0,1.0) ); //dot is actually slower
+		colorInput.rgb = saturate(tex_xy * 4.0) * colorInput.rgb;
+	#endif
+
+	return colorInput;
+}

+ 10 - 0
Game Folder/SweetFX/SweetFX_compatibility_settings.txt

@@ -0,0 +1,10 @@
+
+   /*-----------------------------------------------------------.
+  /                SweetFX compatibility settings               /
+  '-----------------------------------------------------------*/
+#define SweetFX_shader_model 3  //If you have an ancient card that does not support shader model 3 (which SweetFX normally uses)
+                               //then you force a lower and older shader model here. This should be set to the highest setting that works.
+                               //0 = SM 2.0, 1 = SM 2.0a (nvidia), 2 = SM 2.0b (ATI), 3 = SM 3.0 and above (SM 4.0 and 5.0 will be autodetected if available)
+
+//Note that several of the more advanced effects require at least shader model 3, and even if you stick to the simpler effects,
+//it may not be possible to enable several of them at the same time unless shader model 3 is enabled.

BIN
Game Folder/SweetFX/dlls/SMAA dlls/dxgi.dll


+ 2 - 0
Game Folder/SweetFX_preset.txt

@@ -0,0 +1,2 @@
+#include "SweetFX_settings.txt"
+//#include "SweetFX\Presets\Default_1.5_settings.txt"

+ 265 - 0
Game Folder/SweetFX_settings.txt

@@ -0,0 +1,265 @@
+   /*-----------------------------------------------------------.
+  /                       Description                           /
+  '------------------------------------------------------------/
+
+Game:
+Author:
+SweetFX version: 1.5.1
+Description:
+
+Please note when tweaking settings that higher numbers does not always equal better (nor does lower).
+Finding the best settings for your game and your taste is about finding just the right amount to apply.
+
+If you made a good setttings preset please share it with your friends, on forums and websites,
+and/or submit it to the SweetFX Settings Database : http://sfx.thelazy.net/games/
+
+This description field and the above Game and Author fields are here so you can fill in your own details for the presets you create.
+Just delete this description and fill in your own and then share it with the world.
+
+Hope you enjoy my mod.
+ - CeeJay.dk
+
+   /*-----------------------------------------------------------.
+  /                      Choose effects                         /
+  '-----------------------------------------------------------*/
+
+// Set to 1 for ON or 0 for OFF
+#define USE_SMAA_ANTIALIASING  1            // [0 or 1] SMAA Anti-aliasing : Smoothens jagged lines using the SMAA technique.
+#define USE_FXAA_ANTIALIASING  0            // [0 or 1] FXAA Anti-aliasing : Smoothens jagged lines using the FXAA technique. WIP - Currently only works in DX9 and you need to use the FXAA injector dlls.
+#define USE_EXPLOSION          0            // [0 or 1] Explosion : Scatters the pixels, making the image look fuzzy.
+#define USE_CARTOON            0            // [0 or 1] Cartoon : "Toon"s the image. (Interferes with SMAA, CRT, Bloom, HDR and Lumasharpen)
+#define USE_ADVANCED_CRT       0            // [0 or 1] Advanced CRT : Simulates an old CRT TV display. (Interferes with SMAA, Cartoon, Bloom, HDR and Lumasharpen, and it has a very high performance cost)
+#define USE_BLOOM              0            // [0 or 1] Bloom : Makes bright lights bleed their light into their surroundings (relatively high performance cost)
+#define USE_HDR                0            // [0 or 1] HDR : Not actual HDR - It just tries to mimic an HDR look (relatively high performance cost)
+#define USE_LUMASHARPEN        1            // [0 or 1] LumaSharpen : Also sharpens the antialiased edges which makes them less smooth - I'm working on fixing that.
+#define USE_LEVELS             1            // [0 or 1] Levels : Sets a new black and white point. This increases contrast but causes clipping. Use Curves instead if you want to avoid that.
+#define USE_TECHNICOLOR        0            // [0 or 1] TECHNICOLOR : Attempts to mimic the look of an old movie using the Technicolor three-strip color process (Techicolor Process 4)
+#define USE_DPX                0            // [0 or 1] Cineon DPX : Should make the image look like it's been converted to DXP Cineon - basically it's another movie-like look similar to technicolor.
+#define USE_MONOCHROME         0            // [0 or 1] Monochrome : Monochrome makes the colors disappear.
+#define USE_LIFTGAMMAGAIN      1            // [0 or 1] Lift Gamma Gain : Adjust brightness and color of shadows, midtones and highlights
+#define USE_TONEMAP            0            // [0 or 1] Tonemap : Adjust gamma, exposure, saturation, bleach and defog. (may cause clipping)
+#define USE_VIBRANCE           0            // [0 or 1] Vibrance : Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define USE_CURVES             1            // [0 or 1] Curves : Contrast adjustments using S-curves.
+#define USE_SEPIA              0            // [0 or 1] Sepia : Sepia tones the image.
+#define USE_VIGNETTE           0            // [0 or 1] Vignette : Darkens the edges of the image to make it look more like it was shot with a camera lens. May cause banding artifacts.
+#define USE_DITHER             1            // [0 or 1] Dither : Applies dithering to simulate more colors than your monitor can display. This lessens banding artifacts (mostly caused by Vignette)
+#define USE_BORDER             0            // [0 or 1] Border : Makes the screenedge black as a workaround for the bright edge that forcing some AA modes sometimes causes.
+#define USE_SPLITSCREEN        0            // [0 or 1] Splitscreen : Enables the before-and-after splitscreen comparison mode.
+
+#define USE_CUSTOM             0            // [0 or 1] Custom : Write your own shader by editing custom.h, and then enable it here.
+
+   /*-----------------------------------------------------------.
+  /                  SMAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+
+#define SMAA_THRESHOLD         0.15         // [0.08 to 0.20] Edge detection threshold. If SMAA misses some edges try lowering this slightly. I prefer between 0.08 and 0.12.
+#define SMAA_MAX_SEARCH_STEPS  98           // [0 to 98] Determines the radius SMAA will search for aliased edges
+#define SMAA_MAX_SEARCH_STEPS_DIAG 16           // [0 to 16] Determines the radius SMAA will search for diagonal aliased edges
+#define SMAA_CORNER_ROUNDING   100          // [0 to 100] Determines the percent of antialiasing to apply to corners. 0 seems to affect fine text the least so it's the default.
+
+// -- Advanced SMAA settings --
+#define COLOR_EDGE_DETECTION   1            // [0 or 1] 1 Enables color edge detection (slower but slightly more acurate) - 0 uses luma edge detection (faster)
+#define SMAA_DIRECTX9_LINEAR_BLEND 0            // [0 or 1] Using DX9 HARDWARE? (software version doesn't matter) if so this needs to be 1 - If not, leave it at 0.
+                                         //Enable this only if you use a Geforce 7xxx series or older card, or a Radeon X1xxx series or older card.
+
+   /*-----------------------------------------------------------.
+  /                  FXAA Anti-aliasing settings                /
+  '-----------------------------------------------------------*/
+#define FXAA_QUALITY__PRESET   9            // [1 to 9] Choose the quality preset. 9 is the highest quality.
+#define fxaa_Subpix            0.400        // [0.000 to 1.000] Choose the amount of sub-pixel aliasing removal.
+#define fxaa_EdgeThreshold     0.250        // [0.000 to 1.000] Edge detection threshold. The minimum amount of local contrast required to apply algorithm.
+#define fxaa_EdgeThresholdMin  0.060        // [0.000 to 1.000] Darkness threshold. Trims the algorithm from processing darks.
+
+   /*-----------------------------------------------------------.
+  /                     Explosion settings                      /
+  '-----------------------------------------------------------*/
+#define Explosion_Radius       2.5          // [0.2 to 100.0] Amount of effect you want.
+
+
+   /*-----------------------------------------------------------.
+  /                      Cartoon settings                       /
+  '-----------------------------------------------------------*/
+#define CartoonPower           1.5          // [0.1 to 10.0] Amount of effect you want.
+#define CartoonEdgeSlope       1.5          // [0.1 to 8.0] Raise this to filter out fainter edges. You might need to increase the power to compensate. Whole numbers are faster.
+
+
+   /*----------------------------------------------------------.
+  /                    Advanced CRT settings                   /
+  '----------------------------------------------------------*/
+#define CRTAmount              1.00         // [0.00 to 1.00] Amount of CRT effect you want
+
+#define CRTResolution          2.0          // [1.0 to 8.0] Input size coefficent (low values gives the "low-res retro look"). Default is 1.2
+#define CRTgamma               2.2          // [0.0 to 4.0] Gamma of simulated CRT (default 2.2)
+#define CRTmonitorgamma        2.4          // [0.0 to 4.0] Gamma of display monitor (typically 2.2 is correct)
+#define CRTBrightness          1.2          // [1.0 to 3.0] Used to boost brightness a little. Default is 1.0
+#define CRTScanlineIntensity   2.0          // [2.0 to 4.0] Scanlines intensity (use integer values preferably). Default is 2.0
+#define CRTScanlineGaussian    1            // [0 or 1] Use the "new nongaussian scanlines bloom effect". Default is on
+
+#define CRTCurvature           1            // [[0 or 1] "Barrel effect" enabled (1) or off (0)
+#define CRTCurvatureRadius     2.0          // [0.0 to 2.0] Curvature Radius (only effective when Curvature is enabled). Default is 1.5
+#define CRTCornerSize          0.0100       // [0.0000 to 0.0020] Higher values, more rounded corner. Default is 0.001
+#define CRTDistance            2.00         // [0.00 to 4.00] Simulated distance from viewer to monitor. Default is 2.00
+#define CRTAngleX              0.00         // [-0.20 to 0.20] Tilt angle in radians (X coordinates)
+#define CRTAngleY              -0.15        // [-0.20 to 0.20] Tilt angle in radians (Y coordinates). (Value of -0.15 gives the 'arcade tilt' look)
+#define CRTOverScan            1.00         // [1.00 to 1.10] Overscan (e.g. 1.02 for 2% overscan). Default is 1.01
+#define CRTOversample          0            // [0 or 1] Enable 3x oversampling of the beam profile (warning : performance hit)
+
+   /*-----------------------------------------------------------.
+  /                       Bloom settings                        /
+  '-----------------------------------------------------------*/
+#define BloomThreshold         20.25        // [0.00 to 50.00] Threshold for what is a bright light (that causes bloom) and what isn't.
+#define BloomPower             1.446        // [0.000 to 8.000] Strength of the bloom
+#define BloomWidth             0.0142       // [0.0000 to 1.0000] Width of the bloom
+
+   /*-----------------------------------------------------------.
+  /                        HDR settings                         /
+  '-----------------------------------------------------------*/
+#define HDRPower               1.30         // [0.00 to 8.00] Strangely lowering this makes the image brighter
+#define radius2                0.87         // [0.00 to 8.00] Raising this seems to make the effect stronger and also brighter
+
+   /*-----------------------------------------------------------.
+  /                     LumaSharpen settings                    /
+  '-----------------------------------------------------------*/
+// -- Sharpening --
+#define sharp_strength         1.20         // [0.10 to 3.00] Strength of the sharpening
+#define sharp_clamp            0.04         // [0.000 to 1.000] Limits maximum amount of sharpening a pixel recieves - Default is 0.035
+
+// -- Advanced sharpening settings --
+#define pattern                3            // [1|2|3|4] Choose a sample pattern. 1 = Fast, 2 = Normal, 3 = Wider, 4 = Pyramid shaped.
+#define offset_bias            1.0          // [0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
+                         //I designed the pattern for offset_bias 1.0, but feel free to experiment.
+
+// -- Debug sharpening settings --
+#define show_sharpen           0            // [0 or 1] Visualize the strength of the sharpen (multiplied by 4 to see it better)
+
+   /*----------------------------------------------------------.
+  /                       Levels settings                      /
+  '----------------------------------------------------------*/
+
+#define Levels_black_point     2            // [0 to 255] The black point is the new black - literally. Everything darker than this will become completely black. Default is 16.0
+#define Levels_white_point     252          // [0 to 255] The new white point. Everything brighter than this becomes completely white. Default is 235.0
+
+//Colors between the two points will stretched, which increases contrast, but details above and below the points are lost (this is called clipping).
+
+
+   /*-----------------------------------------------------------.
+  /                      TECHNICOLOR settings                   /
+  '-----------------------------------------------------------*/
+#define TechniAmount           0.4          // [0.00 to 1.00] 
+#define TechniPower            4.0          // [0.00 to 8.00] 
+#define redNegativeAmount      0.88         // [0.00 to 1.00] 
+#define greenNegativeAmount    0.88         // [0.00 to 1.00] 
+#define blueNegativeAmount     0.88         // [0.00 to 1.00] 
+
+
+   /*-----------------------------------------------------------.
+  /                      Cineon DPX settings                    /
+  '-----------------------------------------------------------*/
+#define Red                    8.0          // [1.0 to 15.0] 
+#define Green                  8.0          // [1.0 to 15.0] 
+#define Blue                   8.0          // [1.0 to 15.0] 
+
+#define ColorGamma             2.5          // [0.1 to 2.5] Adjusts the colorfulness of the effect in a manner similar to Vibrance. 1.0 is neutral.
+#define DPXSaturation          3.0          // [0.0 to 8.0] Adjust saturation of the effect. 1.0 is neutral.
+
+#define RedC                   0.36         // [0.60 to 0.20] 
+#define GreenC                 0.36         // [0.60 to 0.20] 
+#define BlueC                  0.34         // [0.60 to 0.20] 
+
+#define Blend                  0.2          // [0.00 to 1.00] How strong the effect should be.
+
+
+   /*-----------------------------------------------------------.
+  /                      Monochrome settings                    /
+  '-----------------------------------------------------------*/
+#define Monochrome_conversion_values float3(0.18,0.41,0.41) // [0.00 to 1.00] Percentage of RGB to include (should sum up to 1.00)
+
+
+   /*-----------------------------------------------------------.
+  /                      Lift Gamma Gain settings               /
+  '-----------------------------------------------------------*/
+#define RGB_Lift               float3(0.990, 0.990, 1.000) // [0.000 to 2.000] Adjust shadows for Red, Green and Blue.
+#define RGB_Gamma              float3(1.000, 1.000, 1.000) // [0.000 to 2.000] Adjust midtones for Red, Green and Blue
+#define RGB_Gain               float3(1.120, 1.120, 1.120) // [0.000 to 2.000] Adjust highlights for Red, Green and Blue
+
+//Note that a value of 1.000 is a neutral setting that leave the color unchanged.
+
+   /*-----------------------------------------------------------.
+  /                        Tonemap settings                     /
+  '-----------------------------------------------------------*/
+#define Gamma                  1.000        // [0.000 to 2.000] Adjust midtones. 1.000 is neutral. This setting does exactly the same as the one in Lift Gamma Gain, only with less control.
+
+#define Exposure               0.000        // [-1.000 to 1.000] Adjust exposure
+
+#define Saturation             0.000        // [-1.000 to 1.000] Adjust saturation
+
+#define Bleach                 0.000        // [0.000 to 1.000] Brightens the shadows and fades the colors
+
+#define Defog                  0.000        // [0.000 to 1.000] How much of the color tint to remove
+#define FogColor               float3(0.00, 0.00, 2.55) // [0.00 to 2.55, 0.00 to 2.55, 0.00 to 2.55] What color to remove - default is blue
+
+
+   /*-----------------------------------------------------------.
+  /                       Vibrance settings                     /
+  '-----------------------------------------------------------*/
+#define Vibrance               0.15         // [-1.00 to 1.00] Intelligently saturates (or desaturates if you use negative values) the pixels depending on their original saturation.
+#define Vibrance_RGB_balance   float3(1.00, 1.00, 1.00) // [-10.00 to 10.00,-10.00 to 10.00,-10.00 to 10.00] A per channel multiplier to the Vibrance strength so you can give more boost to certain colors over others
+
+
+   /*-----------------------------------------------------------.
+  /                        Curves settings                      /
+  '-----------------------------------------------------------*/
+#define Curves_mode            0            // [0|1|2] Choose what to apply contrast to. 0 = Luma, 1 = Chroma, 2 = both Luma and Chroma. Default is 0 (Luma)
+#define Curves_contrast        0.35         // [-1.00 to 1.00] The amount of contrast you want
+
+// -- Advanced curve settings --
+#define Curves_formula         2            // [1|2|3|4|5|6|7|8|9|10] The contrast s-curve you want to use.
+                             //1 = Sine, 2 = Abs split, 3 = Smoothstep, 4 = Exp formula, 5 = Simplified Catmull-Rom (0,0,1,1), 6 = Perlins Smootherstep
+                             //7 = Abs add, 8 = Techicolor Cinestyle, 9 = Parabola, 10 = Half-circles.
+                             //Note that Technicolor Cinestyle is practically identical to Sine, but runs slower. In fact I think the difference might only be due to rounding errors.
+                             //I prefer 2 myself, but 3 is a nice alternative with a little more effect (but harsher on the highlight and shadows) and it's the fastest formula.
+
+   /*-----------------------------------------------------------.
+  /                         Sepia settings                      /
+  '-----------------------------------------------------------*/
+#define ColorTone              float3(1.40, 1.10, 0.90) // [0.00 to 2.55, 0.00 to 2.55, 0.00 to 2.55] What color to tint the image
+#define GreyPower              0.11         // [0.00 to 1.00] How much desaturate the image before tinting it
+#define SepiaPower             0.58         // [0.00 to 1.00] How much to tint the image
+
+
+   /*-----------------------------------------------------------.
+  /                       Vignette settings                     /
+  '-----------------------------------------------------------*/
+#define VignetteType           1            // [1|2|3] 1 = Original, 2 = New, 3 = TV style
+#define VignetteRatio          1.00         // [0.15 to 6.00] Sets a width to height ratio. 1.00 (1/1) is perfectly round, while 1.60 (16/10) is 60 % wider than it's high.
+#define VignetteRadius         1.00         // [-1.00 to 3.00] lower values = stronger radial effect from center
+#define VignetteAmount         -1.00        // [-2.00 to 1.00] Strength of black. -2.00 = Max Black, 1.00 = Max White.
+#define VignetteSlope          8            // [2 to 16] How far away from the center the change should start to really grow strong (odd numbers cause a larger fps drop than even numbers)
+#define VignetteCenter         float2(0.500, 0.500) // [0.000 to 1.000, 0.000 to 1.000] Center of effect for VignetteType 1. 2 and 3 do not obey this setting.
+
+
+   /*-----------------------------------------------------------.
+  /                        Dither settings                      /
+  '-----------------------------------------------------------*/
+#define dither_method          2            // [1 or 2] 1 = Ordered dithering (very good and very fast), 2 = Random dithering (different but slightly slower dithering)
+
+//Note that the patterns used by Dither, makes an image harder to compress.
+//This can make your screenshots and video recordings take up more space.
+
+
+   /*-----------------------------------------------------------.
+  /                        Border settings                      /
+  '-----------------------------------------------------------*/
+#define border_width           float2(1,20) // [0 to 2048, 0 to 2048] (X,Y)-width of the border. Measured in pixels.
+#define border_color           float3(0, 0, 0) // [0 to 255, 0 to 255, 0 to 255] What color the border should be. In integer RGB colors, meaning 0,0,0 is black and 255,255,255 is full white.
+
+
+   /*-----------------------------------------------------------.
+  /                     Splitscreen settings                    /
+  '-----------------------------------------------------------*/
+#define splitscreen_mode       1            // [1|2|3|4|5|6] 1 = Vertical 50/50 split, 2 = Vertical 25/50/25 split, 3 = Vertical 50/50 angled split, 4 = Horizontal 50/50 split, 5 = Horizontal 25/50/25 split, 6 = Curvy vertical 50/50 split
+
+   /*-----------------------------------------------------------.
+  /                       Custom settings                       /
+  '-----------------------------------------------------------*/
+#define custom_strength        1.0          // [0.00 to 1.00] Adjust the strength of the effect

+ 376 - 0
Game Folder/d3d9.fx

@@ -0,0 +1,376 @@
+/**
+ * Copyright (C) 2011 Jorge Jimenez (jorge@iryoku.com)
+ * Copyright (C) 2011 Belen Masia (bmasia@unizar.es)
+ * Copyright (C) 2011 Jose I. Echevarria (joseignacioechevarria@gmail.com)
+ * Copyright (C) 2011 Fernando Navarro (fernandn@microsoft.com)
+ * Copyright (C) 2011 Diego Gutierrez (diegog@unizar.es)
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *    1. Redistributions of source code must retain the above copyright notice,
+ *       this list of conditions and the following disclaimer.
+ *
+ *    2. Redistributions in binary form must reproduce the following disclaimer
+ *       in the documentation and/or other materials provided with the
+ *       distribution:
+ *
+ *      "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ *       Belen Masia, Fernando Navarro and Diego Gutierrez."
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of the copyright holders.
+ */
+
+//Include SweetFX settings
+#include "SweetFX_preset.txt"
+#include "SweetFX/SweetFX_compatibility_settings.txt"
+
+/**
+ * Setup mandatory defines. Use a real macro here for maximum performance!
+ */
+#ifndef SMAA_PIXEL_SIZE // It's actually set on runtime, this is for compilation time syntax checking.
+  #define SMAA_PIXEL_SIZE float2(1.0 / 1920.0, 1.0 / 1080.0)
+#endif
+
+/**
+ * This can be ignored; its purpose is to support interactive custom parameter
+ * tweaking.
+ */
+
+/*
+float threshold;
+float maxSearchSteps;
+float maxSearchStepsDiag;
+*/
+
+/*
+#ifdef SMAA_PRESET_CUSTOM
+#define SMAA_THRESHOLD threshold
+#define SMAA_MAX_SEARCH_STEPS maxSearchSteps
+#define SMAA_MAX_SEARCH_STEPS_DIAG maxSearchStepsDiag
+#define SMAA_FORCE_DIAGONALS 1
+#endif
+*/
+
+// Set the HLSL version:
+#define SMAA_HLSL_3 1
+
+// And include our header!
+#include "SweetFX\Shaders\SMAA.h"
+
+
+/**
+ * Input vars and textures.
+ */
+
+texture2D colorTex2D;
+/*texture2D depthTex2D;*/
+texture2D edgesTex2D;
+texture2D blendTex2D;
+texture2D areaTex2D;
+texture2D searchTex2D;
+
+
+/**
+ * DX9 samplers.
+ */
+sampler2D colorTex {
+    Texture = <colorTex2D>;
+    AddressU  = Clamp; AddressV = Clamp;
+    MipFilter = Point; MinFilter = Linear; MagFilter = Linear;
+    SRGBTexture = true;
+};
+
+sampler2D colorTexG {
+    Texture = <colorTex2D>;
+    AddressU  = Clamp; AddressV = Clamp;
+    MipFilter = Linear; MinFilter = Linear; MagFilter = Linear;
+    SRGBTexture = false;
+};
+
+/*
+sampler2D depthTex {
+    Texture = <depthTex2D>;
+    AddressU  = Clamp; AddressV = Clamp;
+    MipFilter = Linear; MinFilter = Linear; MagFilter = Linear;
+    SRGBTexture = false;
+};
+*/
+
+sampler2D edgesTex {
+    Texture = <edgesTex2D>;
+    AddressU = Clamp; AddressV = Clamp;
+    MipFilter = Linear; MinFilter = Linear; MagFilter = Linear;
+    SRGBTexture = false;
+};
+
+sampler2D blendTex {
+    Texture = <blendTex2D>;
+    AddressU = Clamp; AddressV = Clamp;
+    MipFilter = Linear; MinFilter = Linear; MagFilter = Linear;
+    SRGBTexture = false;
+};
+
+sampler2D areaTex {
+    Texture = <areaTex2D>;
+    AddressU = Clamp; AddressV = Clamp; AddressW = Clamp;
+    MipFilter = Linear; MinFilter = Linear; MagFilter = Linear;
+    SRGBTexture = false;
+};
+
+sampler2D searchTex {
+    Texture = <searchTex2D>;
+    AddressU = Clamp; AddressV = Clamp; AddressW = Clamp;
+    MipFilter = Point; MinFilter = Point; MagFilter = Point;
+    SRGBTexture = false;
+};
+
+//Include the main SweetFX control shader
+#include "SweetFX/Shaders/Main.h"
+
+#if (USE_SMAA_ANTIALIASING == 1)
+
+/**
+ * Function wrappers
+ */
+void DX9_SMAAEdgeDetectionVS(inout float4 position : POSITION,
+                             inout float2 texcoord : TEXCOORD0,
+                             out float4 offset[3] : TEXCOORD1) {
+    SMAAEdgeDetectionVS(position, position, texcoord, offset);
+}
+
+void DX9_SMAABlendWeightCalculationVS(inout float4 position : POSITION,
+                                      inout float2 texcoord : TEXCOORD0,
+                                      out float2 pixcoord : TEXCOORD1,
+                                      out float4 offset[3] : TEXCOORD2) {
+    SMAABlendWeightCalculationVS(position, position, texcoord, pixcoord, offset);
+}
+
+void DX9_SMAANeighborhoodBlendingVS(inout float4 position : POSITION,
+                                    inout float2 texcoord : TEXCOORD0,
+                                    out float4 offset[2] : TEXCOORD1) {
+    SMAANeighborhoodBlendingVS(position, position, texcoord, offset);
+}
+
+
+float4 DX9_SMAALumaEdgeDetectionPS(float4 position : SV_POSITION,
+                                   float2 texcoord : TEXCOORD0,
+                                   float4 offset[3] : TEXCOORD1,
+                                   uniform SMAATexture2D colorGammaTex) : COLOR {
+    return SMAALumaEdgeDetectionPS(texcoord, offset, colorGammaTex);
+}
+
+float4 DX9_SMAAColorEdgeDetectionPS(float4 position : SV_POSITION,
+                                    float2 texcoord : TEXCOORD0,
+                                    float4 offset[3] : TEXCOORD1,
+                                    uniform SMAATexture2D colorGammaTex) : COLOR {
+    return SMAAColorEdgeDetectionPS(texcoord, offset, colorGammaTex);
+}
+
+float4 DX9_SMAADepthEdgeDetectionPS(float4 position : SV_POSITION,
+                                    float2 texcoord : TEXCOORD0,
+                                    float4 offset[3] : TEXCOORD1,
+                                    uniform SMAATexture2D depthTex) : COLOR {
+    return SMAADepthEdgeDetectionPS(texcoord, offset, depthTex);
+}
+
+float4 DX9_SMAABlendingWeightCalculationPS(float4 position : SV_POSITION,
+                                           float2 texcoord : TEXCOORD0,
+                                           float2 pixcoord : TEXCOORD1,
+                                           float4 offset[3] : TEXCOORD2,
+                                           uniform SMAATexture2D edgesTex,
+                                           uniform SMAATexture2D areaTex,
+                                           uniform SMAATexture2D searchTex) : COLOR {
+    return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesTex, areaTex, searchTex, 0);
+}
+
+float4 DX9_SMAANeighborhoodBlendingPS(float4 position : SV_POSITION,
+                                      float2 texcoord : TEXCOORD0,
+                                      float4 offset[2] : TEXCOORD1,
+                                      uniform SMAATexture2D colorTex,
+                                      uniform SMAATexture2D blendTex) : COLOR {
+
+    float4 SMAAoutput = SMAANeighborhoodBlendingPS(texcoord, offset, colorTex, blendTex);
+
+    SMAAoutput = SweetFX_main(texcoord,SMAAoutput); // Add the other effects
+
+    return SMAAoutput;  //Returning the pixel
+}
+
+
+   /*----------------------------------------------------------*/
+
+/**
+ * Time for some techniques!
+ */
+technique LumaEdgeDetection { // Pass 1A
+    pass LumaEdgeDetection {
+        VertexShader = compile vs_3_0 DX9_SMAAEdgeDetectionVS();
+
+        #if COLOR_EDGE_DETECTION == 1
+          PixelShader = compile ps_3_0 DX9_SMAAColorEdgeDetectionPS(colorTexG);
+        #else
+          PixelShader = compile ps_3_0 DX9_SMAALumaEdgeDetectionPS(colorTexG);
+        #endif
+
+        ZEnable = false;
+        SRGBWriteEnable = false;
+        AlphaBlendEnable = false;
+
+        // We will be creating the stencil buffer for later usage.
+        StencilEnable = true;
+        StencilPass = REPLACE;
+        StencilRef = 1;
+    }
+}
+/*
+technique ColorEdgeDetection { // Pass 1B
+    pass ColorEdgeDetection {
+        VertexShader = compile vs_3_0 DX9_SMAAEdgeDetectionVS();
+        PixelShader = compile ps_3_0 DX9_SMAAColorEdgeDetectionPS(colorTexG);
+        ZEnable = false;
+        SRGBWriteEnable = false;
+        AlphaBlendEnable = false;
+
+        // We will be creating the stencil buffer for later usage.
+        StencilEnable = true;
+        StencilPass = REPLACE;
+        StencilRef = 1;
+    }
+}
+*/
+/*
+technique DepthEdgeDetection { // Pass 1C
+    pass DepthEdgeDetection {
+        VertexShader = compile vs_3_0 DX9_SMAAEdgeDetectionVS();
+        PixelShader = compile ps_3_0 DX9_SMAADepthEdgeDetectionPS(depthTex);
+        ZEnable = false;
+        SRGBWriteEnable = false;
+        AlphaBlendEnable = false;
+
+        // We will be creating the stencil buffer for later usage.
+        StencilEnable = true;
+        StencilPass = REPLACE;
+        StencilRef = 1;
+    }
+}
+*/
+
+technique BlendWeightCalculation { // Pass 2
+    pass BlendWeightCalculation {
+        VertexShader = compile vs_3_0 DX9_SMAABlendWeightCalculationVS();
+        PixelShader = compile ps_3_0 DX9_SMAABlendingWeightCalculationPS(edgesTex, areaTex, searchTex);
+        ZEnable = false;
+        SRGBWriteEnable = false;
+        AlphaBlendEnable = false;
+
+        // Here we want to process only marked pixels.
+        StencilEnable = true;
+        StencilPass = KEEP;
+        StencilFunc = EQUAL;
+        StencilRef = 1;
+    }
+}
+
+technique NeighborhoodBlending { // Pass 3
+    pass NeighborhoodBlending {
+        VertexShader = compile vs_3_0 DX9_SMAANeighborhoodBlendingVS();
+        PixelShader = compile ps_3_0 DX9_SMAANeighborhoodBlendingPS(colorTex, blendTex);
+        ZEnable = false;
+        #if (Need_sRGB == 1)
+          SRGBWriteEnable = false;
+        #else
+          SRGBWriteEnable = true;
+        #endif
+        AlphaBlendEnable = false;
+
+        // Here we want to process all the pixels.
+        StencilEnable = false;
+    }
+}
+
+#else // if SMAA is off
+
+  /*---------------------------------------.
+  | :: SweetFX - SMAA_off vertex shader :: |
+  '---------------------------------------*/
+
+void DX9_SMAA_off_VS(inout float4 position : POSITION
+                    ,inout float2 texcoord : TEXCOORD0
+					        //,out float4 lumacoord[2] : TEXCOORD1
+					          ){
+
+  //lumacoord[0] = pixel.xyxy * (float4(0.5, -0.5, -0.5, -0.5) * offset_bias) + texcoord.xyxy;
+  //lumacoord[1] = pixel.xyxy * (float4(0.5, 0.5, -0.5, 0.5) * offset_bias) + texcoord.xyxy;
+  
+}
+
+  /*--------------------------------------.
+  | :: SweetFX - SMAA_off pixel shader :: |
+  '--------------------------------------*/
+
+float4 main( float2 texcoord : TEXCOORD0
+           //, float4 lumacoord[2] : TEXCOORD1
+           ) : COLOR {
+
+    float4 SMAAoutput = tex2D(s0, texcoord);
+
+    //SMAAoutput = SweetFX_main(SMAAoutput,texcoord,lumacoord); // Add the other effects
+    SMAAoutput = SweetFX_main(texcoord,SMAAoutput); // Add the other effects
+
+    return SMAAoutput;  //Returning the pixel
+}
+
+  /*--------------------------.
+  | :: SweetFX - Technique :: |
+  '--------------------------*/
+
+    //What Shader Model should we use?
+    #if (SweetFX_shader_model == 0)
+      #define vertex_shader_model vs_2_0
+      #define pixel_shader_model  ps_2_0
+
+    #elif (SweetFX_shader_model == 1)
+      #define vertex_shader_model vs_2_0
+      #define pixel_shader_model  ps_2_a
+
+    #elif (SweetFX_shader_model == 2)
+      #define vertex_shader_model vs_2_0
+      #define pixel_shader_model  ps_2_b
+
+    #else
+      #define vertex_shader_model vs_3_0
+      #define pixel_shader_model  ps_3_0
+
+    #endif
+
+technique SMAA_off { // Not doing SMAA.
+    pass SMAA_off {
+
+        VertexShader = compile vertex_shader_model DX9_SMAA_off_VS();
+        PixelShader  = compile pixel_shader_model main(); //Use this with GPU Shaderanalyzer
+
+        ZEnable = false;
+        SRGBWriteEnable = false;
+        AlphaBlendEnable = false;
+
+        // Here we want to process all the pixels.
+        StencilEnable = false;
+    }
+}
+#endif

BIN
Game Folder/dxgi.dll


+ 386 - 0
Game Folder/dxgi.fx

@@ -0,0 +1,386 @@
+/**
+ * Copyright (C) 2011 Jorge Jimenez (jorge@iryoku.com)
+ * Copyright (C) 2011 Belen Masia (bmasia@unizar.es) 
+ * Copyright (C) 2011 Jose I. Echevarria (joseignacioechevarria@gmail.com) 
+ * Copyright (C) 2011 Fernando Navarro (fernandn@microsoft.com) 
+ * Copyright (C) 2011 Diego Gutierrez (diegog@unizar.es)
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * 
+ *    1. Redistributions of source code must retain the above copyright notice,
+ *       this list of conditions and the following disclaimer.
+ * 
+ *    2. Redistributions in binary form must reproduce the following disclaimer
+ *       in the documentation and/or other materials provided with the 
+ *       distribution:
+ * 
+ *      "Uses SMAA. Copyright (C) 2011 by Jorge Jimenez, Jose I. Echevarria,
+ *       Belen Masia, Fernando Navarro and Diego Gutierrez."
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS 
+ * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS OR CONTRIBUTORS 
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
+ * 
+ * The views and conclusions contained in the software and documentation are 
+ * those of the authors and should not be interpreted as representing official
+ * policies, either expressed or implied, of the copyright holders.
+ */
+
+//Include SweetFX settings
+#include "SweetFX_preset.txt"
+
+/**
+ * Setup mandatory defines. Use a real macro here for maximum performance!
+ */
+#ifndef SMAA_PIXEL_SIZE // It's actually set on runtime, this is for compilation time syntax checking.
+#define SMAA_PIXEL_SIZE float2(1.0 / 1280.0, 1.0 / 720.0)
+#endif
+
+/**
+ * This is only required for temporal modes (SMAA T2x).
+ */
+int4 subsampleIndices;
+
+/*
+#define SMAA_PRESET_CUSTOM
+#ifdef SMAA_PRESET_CUSTOM
+#define SMAA_THRESHOLD threshld
+#define SMAA_MAX_SEARCH_STEPS maxSearchSteps
+#define SMAA_MAX_SEARCH_STEPS_DIAG maxSearchStepsDiag
+#define SMAA_CORNER_ROUNDING cornerRounding
+#define SMAA_FORCE_DIAGONAL_DETECTION 1
+#define SMAA_FORCE_CORNER_DETECTION 1
+#endif
+*/
+
+// Set the HLSL version:
+#ifndef SMAA_HLSL_4_1
+#define SMAA_HLSL_4 1
+#endif
+
+/*
+#ifdef SMAA_PRESET_CUSTOM
+#include "SMAA_settings.h" //include custom settings
+#endif
+*/
+
+// And include our header!
+#include "SweetFX\Shaders\SMAA.h"
+
+// Set pixel shader version accordingly:
+#if SMAA_HLSL_4_1 == 1
+#define PS_VERSION ps_4_1
+#else
+#define PS_VERSION ps_4_0
+#endif
+
+
+/**
+ * DepthStencilState's and company
+ */
+DepthStencilState DisableDepthStencil {
+    DepthEnable = FALSE;
+    StencilEnable = FALSE;
+};
+
+DepthStencilState DisableDepthReplaceStencil {
+    DepthEnable = FALSE;
+    StencilEnable = TRUE;
+    FrontFaceStencilPass = REPLACE;
+};
+
+DepthStencilState DisableDepthUseStencil {
+    DepthEnable = FALSE;
+    StencilEnable = TRUE;
+    FrontFaceStencilFunc = EQUAL;
+};
+
+BlendState NoBlending {
+    AlphaToCoverageEnable = FALSE;
+    BlendEnable[0] = FALSE;
+};
+
+
+/**
+ * Input textures
+ */
+Texture2D colorTexPrev;
+Texture2D colorTex;
+Texture2D colorTexGamma;
+Texture2D depthTex;
+Texture2D velocityTex;
+
+/**
+ * Temporal textures
+ */
+Texture2D edgesTex;
+Texture2D blendTex;
+
+/**
+ * Pre-computed area and search textures
+ */
+Texture2D areaTex;
+Texture2D searchTex;
+
+#include "SweetFX/Shaders/Main.h"
+
+/**
+ * Function wrappers
+ */
+void DX10_SMAAEdgeDetectionVS(float4 position : POSITION,
+                              out float4 svPosition : SV_POSITION,
+                              inout float2 texcoord : TEXCOORD0,
+                              out float4 offset[3] : TEXCOORD1) {
+    SMAAEdgeDetectionVS(position, svPosition, texcoord, offset);
+}
+
+void DX10_SMAABlendWeightCalculationVS(float4 position : POSITION,
+                                       out float4 svPosition : SV_POSITION,
+                                       inout float2 texcoord : TEXCOORD0,
+                                       out float2 pixcoord : TEXCOORD1,
+                                       out float4 offset[3] : TEXCOORD2) {
+    SMAABlendWeightCalculationVS(position, svPosition, texcoord, pixcoord, offset);
+}
+
+void DX10_SMAANeighborhoodBlendingVS(float4 position : POSITION,
+                                     out float4 svPosition : SV_POSITION,
+                                     inout float2 texcoord : TEXCOORD0,
+                                     out float4 offset[2] : TEXCOORD1) {
+    SMAANeighborhoodBlendingVS(position, svPosition, texcoord, offset);
+}
+
+void DX10_SMAAResolveVS(float4 position : POSITION,
+                        out float4 svPosition : SV_POSITION,
+                        inout float2 texcoord : TEXCOORD0) {
+    SMAAResolveVS(position, svPosition, texcoord);
+}
+
+[earlydepthstencil]
+float4 DX10_SMAALumaEdgeDetectionPS(float4 position : SV_POSITION,
+                                    float2 texcoord : TEXCOORD0,
+                                    float4 offset[3] : TEXCOORD1,
+                                    uniform SMAATexture2D colorTexGamma) : SV_TARGET {
+    #if SMAA_PREDICATION == 1
+    return SMAALumaEdgeDetectionPS(texcoord, offset, colorTexGamma, depthTex);
+    #else
+    return SMAALumaEdgeDetectionPS(texcoord, offset, colorTexGamma);
+    #endif
+}
+
+[earlydepthstencil]
+float4 DX10_SMAAColorEdgeDetectionPS(float4 position : SV_POSITION,
+                                     float2 texcoord : TEXCOORD0,
+                                     float4 offset[3] : TEXCOORD1,
+                                     uniform SMAATexture2D colorTexGamma) : SV_TARGET {
+    #if SMAA_PREDICATION == 1
+    return SMAAColorEdgeDetectionPS(texcoord, offset, colorTexGamma, depthTex);
+    #else
+    return SMAAColorEdgeDetectionPS(texcoord, offset, colorTexGamma);
+    #endif
+}
+
+[earlydepthstencil]
+float4 DX10_SMAADepthEdgeDetectionPS(float4 position : SV_POSITION,
+                                     float2 texcoord : TEXCOORD0,
+                                     float4 offset[3] : TEXCOORD1,
+                                     uniform SMAATexture2D depthTex) : SV_TARGET {
+    return SMAADepthEdgeDetectionPS(texcoord, offset, depthTex);
+}
+
+[earlydepthstencil]
+float4 DX10_SMAABlendingWeightCalculationPS(float4 position : SV_POSITION,
+                                            float2 texcoord : TEXCOORD0,
+                                            float2 pixcoord : TEXCOORD1,
+                                            float4 offset[3] : TEXCOORD2,
+                                            uniform SMAATexture2D edgesTex, 
+                                            uniform SMAATexture2D areaTex, 
+                                            uniform SMAATexture2D searchTex) : SV_TARGET {
+    return SMAABlendingWeightCalculationPS(texcoord, pixcoord, offset, edgesTex, areaTex, searchTex, subsampleIndices);
+}
+
+[earlydepthstencil]
+float4 DX10_SMAANeighborhoodBlendingPS(float4 position : SV_POSITION,
+                                       float2 texcoord : TEXCOORD0,
+                                       float4 offset[2] : TEXCOORD1,
+                                       uniform SMAATexture2D colorTex,
+                                       uniform SMAATexture2D blendTex) : SV_TARGET {
+                                                                          
+    float4 SMAAoutput = SMAANeighborhoodBlendingPS(texcoord, offset, colorTex, blendTex);
+    
+    SMAAoutput = SweetFX_main(texcoord,SMAAoutput); // Add the other effects
+
+    return SMAAoutput;  //Returning the pixel
+}
+
+[earlydepthstencil]
+float4 DX10_SMAAResolvePS(float4 position : SV_POSITION,
+                          float2 texcoord : TEXCOORD0,
+                          uniform SMAATexture2D colorTex,
+                          uniform SMAATexture2D colorTexPrev,
+                          uniform SMAATexture2D velocityTex) : SV_TARGET {
+    #if SMAA_REPROJECTION == 1
+    return SMAAResolvePS(texcoord, colorTex, colorTexPrev, velocityTex);
+    #else
+    return SMAAResolvePS(texcoord, colorTex, colorTexPrev);
+    #endif
+}
+
+#if (USE_SMAA_ANTIALIASING == 1)
+
+/**
+ * Edge detection techniques
+ */
+
+technique10 LumaEdgeDetection {
+    pass LumaEdgeDetection {
+        SetVertexShader(CompileShader(vs_4_0, DX10_SMAAEdgeDetectionVS()));
+        SetGeometryShader(NULL);
+
+        #if COLOR_EDGE_DETECTION == 1
+          SetPixelShader(CompileShader(PS_VERSION, DX10_SMAAColorEdgeDetectionPS(colorTexGamma)));
+        #else
+          SetPixelShader(CompileShader(PS_VERSION, DX10_SMAALumaEdgeDetectionPS(colorTexGamma)));
+        #endif
+
+        SetDepthStencilState(DisableDepthReplaceStencil, 1);
+        SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
+    }
+}
+
+technique10 ColorEdgeDetection {
+    pass ColorEdgeDetection {
+        SetVertexShader(CompileShader(vs_4_0, DX10_SMAAEdgeDetectionVS()));
+        SetGeometryShader(NULL);
+        SetPixelShader(CompileShader(PS_VERSION, DX10_SMAAColorEdgeDetectionPS(colorTexGamma)));
+
+        SetDepthStencilState(DisableDepthReplaceStencil, 1);
+        SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
+    }
+}
+
+technique10 DepthEdgeDetection {
+    pass DepthEdgeDetection {
+        SetVertexShader(CompileShader(vs_4_0, DX10_SMAAEdgeDetectionVS()));
+        SetGeometryShader(NULL);
+        SetPixelShader(CompileShader(PS_VERSION, DX10_SMAADepthEdgeDetectionPS(depthTex)));
+
+        SetDepthStencilState(DisableDepthReplaceStencil, 1);
+        SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
+    }
+}
+
+/**
+ * Blending weight calculation technique
+ */
+
+technique10 BlendingWeightCalculation {
+    pass BlendingWeightCalculation {
+        SetVertexShader(CompileShader(vs_4_0, DX10_SMAABlendWeightCalculationVS()));
+        SetGeometryShader(NULL);
+        SetPixelShader(CompileShader(PS_VERSION, DX10_SMAABlendingWeightCalculationPS(edgesTex, areaTex, searchTex)));
+
+        SetDepthStencilState(DisableDepthUseStencil, 1);
+        SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
+    }
+}
+
+/**
+ * Neighborhood blending technique
+ */
+technique10 NeighborhoodBlending {
+    pass NeighborhoodBlending {
+        SetVertexShader(CompileShader(vs_4_0, DX10_SMAANeighborhoodBlendingVS()));
+        SetGeometryShader(NULL);
+        SetPixelShader(CompileShader(PS_VERSION, DX10_SMAANeighborhoodBlendingPS(colorTex, blendTex)));
+
+        SetDepthStencilState(DisableDepthStencil, 0);
+        SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
+    }
+}
+
+/**
+ * Temporal resolve technique
+ */
+technique10 Resolve {
+    pass Resolve {
+        SetVertexShader(CompileShader(vs_4_0, DX10_SMAAResolveVS()));
+        SetGeometryShader(NULL);
+        SetPixelShader(CompileShader(PS_VERSION, DX10_SMAAResolvePS(colorTex, colorTexPrev, velocityTex)));
+
+        SetDepthStencilState(DisableDepthStencil, 0);
+        SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
+    }
+}
+
+#else //SMAA off
+
+  /*------------------------.
+  | :: SweetFX - structs :: |
+  '------------------------*/
+
+struct Output
+{
+float4 position_cs : SV_POSITION;
+float2 texcoord : TEXCOORD;
+};
+
+  /*---------------------------------------.
+  | :: SweetFX - SMAA_off vertex shader :: |
+  '---------------------------------------*/
+
+Output DX10_SMAA_off_VS(uint id: SV_VertexID) {
+                      
+Output output;
+ 
+output.texcoord = float2((id << 1) & 2, id & 2);
+output.position_cs = float4(output.texcoord * float2(2, -2) + float2(-1, 1), 0, 1);
+
+return output;
+}
+
+  /*--------------------------------------.
+  | :: SweetFX - SMAA_off pixel shader :: |
+  '--------------------------------------*/
+
+[earlydepthstencil]
+float4 main(float4 position : SV_POSITION,
+                                       float2 texcoord : TEXCOORD0,
+                                       /*float4 offset[2] : TEXCOORD1,*/
+                                       uniform SMAATexture2D colorTexGamma) : SV_TARGET {
+                                                                          
+    float4 SMAAoutput = myTex2D(colorTexGamma, texcoord);
+    SMAAoutput = SweetFX_main(texcoord,SMAAoutput); // Add the other effects
+
+    return SMAAoutput;  //Returning the pixel
+}
+
+
+  /*--------------------------.
+  | :: SweetFX - Technique :: |
+  '--------------------------*/
+
+/**
+ * SMAA_off technique
+ */
+
+technique10 LumaEdgeDetection {
+    pass LumaEdgeDetection {
+        SetVertexShader(CompileShader(vs_4_0, DX10_SMAA_off_VS()));
+        SetGeometryShader(NULL);
+        SetPixelShader(CompileShader(PS_VERSION, main(colorTexGamma)));
+
+        SetDepthStencilState(DisableDepthStencil, 0); //SetDepthStencilState(DisableDepthReplaceStencil, 1);
+        SetBlendState(NoBlending, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
+    }
+}
+#endif

+ 918 - 0
Game Folder/effect.txt

@@ -0,0 +1,918 @@
+/**
+ *	SHADER ADDON
+ * 	Featuring BlurShift, Sharpen, Noise, LumaSharpen, Vibrance, Contrast, Black Level
+ *	Exterior/Interior separation ready (some also has Day/Night factors), GUI-enabled
+ *	By ZeroKing
+ */
+
+/**
+ *	ENBSeries
+ *	visit http://enbdev.com for updates
+ *	Copyright (c) 2007-2014 Boris Vorontsov
+ */ 
+ 
+//--------------------------//
+//   Internal parameters	// 
+//     Can be modified		//
+//--------------------------// 
+
+//////////////////
+//	 DEFINES	//
+//////////////////
+#define ESHARPENING
+#define ESHARPENINGCOLOR
+#define ECOLORSHIFT
+#define SharpMethod 						4
+#define NoiseMethod							0 
+
+// Set your resolution here 
+float	XCoord <
+	string UIName="Horizontal Pixel Resolution";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=7680.0;
+> = {1920};
+
+float	YCoord <
+	string UIName="Vertical Pixel Resolution";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=4320.0;
+> = {1080};
+
+///////////////
+//	CHOICES	 //
+///////////////
+bool   C_BLACKLEVEL <
+	string UIName =  "Enable Black Level";
+> = {false};
+
+bool   C_CONTRASTCURVES <
+	string UIName =  "Enable Contrast";
+> = {false};
+
+bool   C_VIBRANCE <
+	string UIName =  "Enable Vibrance";
+> = {false};
+ 
+//////////////////////////////
+//	BLUR-SHIFT AND SHARPEN	//
+//////////////////////////////
+#define BlurSamplingRange			BlurRange
+#define SharpSamplingRange			SharpRange
+#define SharpeningAmount			SharpAmount
+#define ShiftSamplingRange			ShiftRange
+
+float	BlurRange <
+	string UIName="Blur Sampling Range";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=1.0;
+> = {0.25};
+
+float	SharpRange <
+	string UIName="Sharp Sampling Range";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=1.0;
+> = {0.75};
+
+float	SharpAmount <
+	string UIName="Sharpening Amount";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=5.0;
+> = {1.5};
+		
+float	ShiftRange <
+	string UIName="Shift Sampling Range";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=1.0;
+> = {0.25};
+		
+//////////////
+//	NOISE	//
+//////////////
+float	NoiseAmountExt <
+	string UIName="Noise Amount - Exterior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=1.0;
+> = {0.0};
+
+float	NoiseAmountInt <
+	string UIName="Noise Amount - Interior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=1.0;
+> = {0.0};
+
+float	NoiseFinenessExt <
+	string UIName="Noise Fineness - Exterior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=100.0;
+> = {50};
+
+float	NoiseFinenessInt <
+	string UIName="Noise Fineness - Interior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=100.0;
+> = {50};
+
+//////////////////
+//	CONTRAST	//
+//////////////////
+float	ContrastCurveDayExt <
+	string UIName="Contrast - Exterior Day";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+
+float	ContrastCurveDayInt <
+	string UIName="Contrast - Interior Day";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+
+float	ContrastCurveNightExt <
+	string UIName="Contrast - Exterior Night";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+
+float	ContrastCurveNightInt <
+	string UIName="Contrast - Interior Night";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+
+//////////////////
+//	VIBRANCE	//
+//////////////////
+float	VibranceDayExt <
+	string UIName="Vibrance - Exterior Day";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+
+float	VibranceDayInt <
+	string UIName="Vibrance - Interior Day";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+
+float	VibranceNightExt <
+	string UIName="Vibrance - Exterior Night";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+
+float	VibranceNightInt <
+	string UIName="Vibrance - Interior Night";
+	string UIWidget="Spinner";
+	float UIMin=-1.0;
+	float UIMax=1.0;
+> = {0};
+				
+////////////////////
+//	LUMASHARPEN	  //
+////////////////////
+float	sharp_strengthExt <
+	string UIName="LumaSharpen Strength - Exterior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=5.0;
+> = {0.75};	
+
+float	sharp_strengthInt <
+	string UIName="LumaSharpen Strength - Interior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=5.0;
+> = {0.75};	
+
+float	sharp_clampExt <
+	string UIName="LumaSharpen Clamp - Exterior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=1.0;
+> = {0.025};	
+
+float	sharp_clampInt <
+	string UIName="LumaSharpen Clamp - Interior";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=1.0;
+> = {0.025};	
+
+////////////////////
+//	BLACK LEVELS  //
+////////////////////
+float	BlackPointDayExt <
+	string UIName="Black Level - Exterior Day";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {5};	
+
+float	BlackPointDayInt <
+	string UIName="Black Level - Interior Day";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {5};	
+
+float	WhitePointDayExt <
+	string UIName="White Level - Exterior Day";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {235};	
+
+float	WhitePointDayInt <
+	string UIName="White Level - Interior Day";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {235};	
+
+float	BlackPointNightExt <
+	string UIName="Black Level - Exterior Night";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {5};	
+
+float	BlackPointNightInt <
+	string UIName="Black Level - Interior Night";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {5};	
+
+float	WhitePointNightExt <
+	string UIName="White Level - Exterior Night";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {235};	
+
+float	WhitePointNightInt <
+	string UIName="White Level - Interior Night";
+	string UIWidget="Spinner";
+	float UIMin=0.0;
+	float UIMax=255.0;
+> = {235};
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+		
+//--------------------------//
+//   External parameters	// 
+//     Do not modify		//
+//--------------------------//
+
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// Keyboard controlled temporary variables. 
+// Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. 
+// By default all set to 1.0
+float4	tempF1; 			//0,1,2,3
+float4	tempF2; 			//5,6,7,8
+float4	tempF3; 			//9,0
+float4	Timer;				//x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
+float4	ScreenSize;			//x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
+float	ENightDayFactor;	//changes in range 0..1, 0 means that night time, 1 - day time
+float	EInteriorFactor;	//changes 0 or 1. 0 means that exterior, 1 - interior
+////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+//////////////////
+//	TEXTURES	//
+//////////////////
+texture2D texColor;
+texture2D texNoise;
+
+///////////////////
+//	 SAMPLERS	 //
+///////////////////
+sampler2D SamplerColor = sampler_state
+{
+	Texture   = <texColor>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerNoise = sampler_state
+{
+	Texture   = <texNoise>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;
+	AddressU  = Wrap;
+	AddressV  = Wrap;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+//////////////////
+//	 STRUCTS	//
+//////////////////
+struct VS_OUTPUT_POST
+{
+	float4 vpos  : POSITION;
+	float2 txcoord : TEXCOORD0;
+};
+
+struct VS_INPUT_POST
+{
+	float3 pos  : POSITION;
+	float2 txcoord : TEXCOORD0;
+};
+
+VS_OUTPUT_POST VS_PostProcess(VS_INPUT_POST IN)
+{
+	VS_OUTPUT_POST OUT;
+
+	float4 pos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
+
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+
+	return OUT;
+}
+
+//////////////////
+//	 SHADERS	//
+//////////////////
+float4 PS_ProcessLumaSharpen(VS_OUTPUT_POST IN, float2 vPos : VPOS, float2 tex : TEXCOORD0) : COLOR
+{
+    float2 coord = IN.txcoord.xy;
+       
+	#define px (1/XCoord) 		
+	#define py (1/YCoord)
+			
+	// Bias value
+	float offset_bias = 1.0;	
+			
+	float sharp_strength = sharp_strengthExt;
+	float sharp_clamp = sharp_clampExt;
+	if (EInteriorFactor) 
+	{
+		sharp_strength = sharp_strengthInt;
+		sharp_clamp = sharp_clampInt;
+	};		
+	
+	#define sharp_strength_luma 				(CoefLuma * sharp_strength) 
+	#define CoefLuma 							float4(0.2126, 0.7152, 0.0722, 0)  
+ 
+    half4 ori = tex2D(SamplerColor, coord.xy);
+ 
+    [branch] if (any(frac(ori.rgb)))
+    {
+		#if SharpMethod == 1
+			// -- Gaussian filter --
+			//   [ 2/9, 4/9,    ]     [ 1 , 2 ,   ]
+			//   [ 4/9, 8/9, 4/9]  =  [ 2 , 4 , 2 ]
+			//   [    , 2/9, 2/9]     [   , 2 , 1 ]
+		   
+			half4 blur_ori = tex2Dlod(SamplerColor, float4(tex,tex) + float4(-px,py,-px,py) / 3 * offset_bias); 	// North West
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(px,-py,px,-py) / 3 * offset_bias);  		// South East
+			
+			//Divide by the number of texture fetches
+			blur_ori /= 2; 
+		#endif
+ 
+		// -- Pattern 2 -- A 9 tap gaussian using 4+1 texture fetches.
+		#if SharpMethod == 2
+			// -- Gaussian filter --
+			//   [ .25, .50, .25]     [ 1 , 2 , 1 ]
+			//   [ .50,   1, .50]  =  [ 2 , 4 , 2 ]
+			//   [ .25, .50, .25]     [ 1 , 2 , 1 ]
+ 
+			half4 blur_ori = tex2Dlod(SamplerColor, float4(tex,tex) + float4(-px,py,-px,py) * 0.5 * offset_bias); 		// North West
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(px,-py,px,-py) * 0.5 * offset_bias);  			// South East
+ 
+			if (any((blur_ori.rgb / 2) - ori.rgb))
+			{
+				blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(-px,-py,-px,-py) * 0.5 * offset_bias); 		// South West
+				blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(px,py,px,py) * 0.5 * offset_bias); 			// North East
+				
+				//Divide by the number of texture fetches
+				blur_ori *= 0.25;;  
+			}
+	 
+			//Divide by the number of texture fetches
+			blur_ori *= 0.25;;  
+		#endif
+ 
+		// -- Pattern 3 -- An experimental 17 tap gaussian using 4+1 texture fetches.
+		#if SharpMethod == 3 
+			// -- Gaussian filter --
+			//   [   , 4 , 6 ,   ,   ]
+			//   [   ,16 ,24 ,16 , 4 ]
+			//   [ 6 ,24 ,50 ,24 , 6 ]
+			//   [ 4 ,16 ,24 ,16 ,   ]
+			//   [   ,   , 6 , 4 ,   ]
+ 
+			half4 blur_ori = tex2Dlod(SamplerColor, float4(tex,tex) + float4(-0.4*px,1.2*py,-0.4*px,1.2*py) * offset_bias); 	// North North West
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(0.4*px,-1.2*py,0.4*px,-1.2*py) * offset_bias);  		// South South East
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(1.2*px,0.4*py,0,0) * offset_bias); 						// East North East
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(-1.2*px,-0.4*py,0,0) * offset_bias); 					// West South West
+			blur_ori += ori; 	// Probably not needed. Only serves to lessen the effect.
+	   
+			blur_ori /= 5;  	//Divide by the number of texture fetches
+		#endif
+ 
+		// -- Pattern 4 -- A 9 tap high pass using 4+1 texture fetches.
+		#if SharpMethod == 4 
+			// -- Gaussian filter --
+			//   [ .50, .50, .50]     [ 1 , 1 , 1 ]
+			//   [ .50,    , .50]  =  [ 1 ,   , 1 ]
+			//   [ .50, .50, .50]     [ 1 , 1 , 1 ]
+ 
+			half4 blur_ori = tex2Dlod(SamplerColor, float4(tex,tex) + float4(0.5 * -px,py,0.5 * -px,py) * offset_bias);		// North North West
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(0.5 * px,-py,0.5 * px,-py));  						// South South East
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(-px,0.5 * -py,-px,0.5 * -py)); 						// West South West
+			blur_ori += tex2Dlod(SamplerColor, float4(tex,tex) + float4(px,0.5 * py,px,0.5 * py) * offset_bias); 			// East North East
+			blur_ori += (2 * ori); 	// Probably not needed. Only serves to lessen the effect.
+        
+			blur_ori /= 6;  		//Divide by the number of texture fetches
+		#endif	
+               
+        // -- Calculate the sharpening -- 
+        half sharp = ori - blur_ori;  
+        // -- Adjust strength of the sharpening --
+        sharp = dot(sharp, sharp_strength_luma); 
+		// -- Clamping the maximum amount of sharpening to prevent halo artifacts --
+        sharp = clamp(sharp, -sharp_clamp, sharp_clamp);  
+		// -- Combining the values to get the final sharpened pixel   --
+        half4 done = ori + sharp;     
+
+        return done;
+    }
+    
+	else
+    {               
+        return ori;
+    }
+}
+
+float4 PS_ProcessBlur(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float4 res;
+	float4 coord=0.0;
+
+	coord.xy=IN.txcoord.xy;
+	float4 origcolor;
+
+	coord.w=0.0;
+
+	origcolor=tex2Dlod(SamplerColor, coord);
+
+	float2 offset[16]=
+	{
+		float2(1.0, 1.0),
+		float2(-1.0, -1.0),
+		float2(-1.0, 1.0),
+		float2(1.0, -1.0),
+
+		float2(1.0, 0.0),
+		float2(-1.0, 0.0),
+		float2(0.0, 1.0),
+		float2(0.0, -1.0),
+
+		float2(1.41, 0.0),
+		float2(-1.41, 0.0),
+		float2(0.0, 1.41),
+		float2(0.0, -1.41),
+
+		float2(1.41, 1.41),
+		float2(-1.41, -1.41),
+		float2(-1.41, 1.41),
+		float2(1.41, -1.41)
+	};
+	int i=0;
+
+	float4 tcol=origcolor;
+	float invscreensize=1.0/ScreenSize;
+
+	for (i=0; i<16; i++)
+	{
+		float2 tdir=offset[i].xy;
+		coord.xy=IN.txcoord.xy+tdir.xy*invscreensize*BlurSamplingRange;
+		float4 ct=tex2Dlod(SamplerColor, coord);
+
+		tcol+=ct;
+	}
+	tcol*=0.05882353;
+
+	res.xyz=tcol.xyz;
+		
+	res.w=1.0;
+	return res;
+}
+
+float4 PS_ProcessSharpen(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{		
+	float4 res;
+	float4 coord=0.0;
+
+	coord.xy=IN.txcoord.xy;
+	float4 origcolor;
+
+	coord.w=0.0;
+	origcolor=tex2Dlod(SamplerColor, coord);
+
+	float2 offset[8]=
+	{
+		float2(1.0, 1.0),
+		float2(-1.0, -1.0),
+		float2(-1.0, 1.0),
+		float2(1.0, -1.0),
+
+		float2(1.41, 0.0),
+		float2(-1.41, 0.0),
+		float2(0.0, 1.41),
+		float2(0.0, -1.41)
+	};
+	int i=0;
+
+	float4 tcol=origcolor;
+	float invscreensize=1.0/ScreenSize;
+	
+	for (i=0; i<8; i++) 
+	{
+		float2 tdir=offset[i].xy;
+		coord.xy=IN.txcoord.xy+tdir.xy*invscreensize*SharpSamplingRange;	
+		float4 ct=tex2Dlod(SamplerColor, coord);
+		tcol+=ct;
+	}
+	tcol*=0.1111; 
+
+	//sharp
+	#ifdef ESHARPENING
+		#ifdef ESHARPENINGCOLOR
+			//color
+			res=origcolor*(1.0+((origcolor-tcol)*SharpeningAmount));
+		#else
+			//non color
+			float difffact=dot((origcolor.xyz-tcol.xyz), 0.333);
+			res=origcolor*(1.0+difffact*SharpeningAmount);
+		#endif
+
+		//less sharpening for bright pixels
+		float rgray=origcolor.z; 	
+		rgray=pow(rgray, 3.0);
+		res=lerp(res, origcolor, saturate(rgray));
+	#endif
+
+	res.w=1.0;
+	return res;
+}
+
+float4 PS_ProcessShift(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float4 res;
+	float4 coord=0.0;
+
+	coord.xy=IN.txcoord.xy;
+	float4 origcolor;
+
+	coord.w=0.0;
+
+	origcolor=tex2Dlod(SamplerColor, coord);
+
+	int i=0;
+
+	#ifdef ECOLORSHIFT
+		float4 tcol=origcolor;
+		float2 invscreensize=1.0/ScreenSize.x;
+		invscreensize.y=invscreensize.y/ScreenSize.z;
+
+		coord.xy=IN.txcoord.xy;
+		origcolor=tex2Dlod(SamplerColor, coord);
+		res.y=origcolor.y;
+
+		coord.xy=IN.txcoord.xy;
+		coord.y-=invscreensize*ShiftSamplingRange;
+		origcolor=tex2Dlod(SamplerColor, coord);
+		res.x=origcolor.x;
+
+		coord.xy=IN.txcoord.xy;
+		coord.y+=invscreensize*ShiftSamplingRange;
+		origcolor=tex2Dlod(SamplerColor, coord);
+		res.z=origcolor.z;
+	#endif
+
+	res.w=1.0;
+	return res;
+}
+
+float4 PS_ProcessContrast(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float ContrastCurve = lerp(ContrastCurveNightExt, ContrastCurveDayExt, ENightDayFactor);
+	if (EInteriorFactor) 
+	{
+		ContrastCurve = lerp(ContrastCurveNightInt, ContrastCurveDayInt, ENightDayFactor);
+	};			
+	
+	float4	res;
+	float3	origcolor=tex2D(SamplerColor, IN.txcoord.xy);
+	float3	lumCoeff = float3(0.212656, 0.715158, 0.072186);  	//Calculate luma with these values
+	
+	float luma = dot(lumCoeff, origcolor.rgb);
+	float3 chroma = origcolor.rgb - luma;
+	
+	float Curves_contrast_blend = ContrastCurve;
+	float PI = 3.1415926535897932384626433832795; 
+	
+	float x = luma; 											//If the curve should be applied to Luma
+  
+	x = x - 0.5;
+	x = x / ((abs(x)*1.25) + 0.375 ) + 0.5;
+	
+	x = lerp(luma, x, Curves_contrast_blend);					//if the curve should be applied to both Luma and Chroma
+		
+	if (C_CONTRASTCURVES==true)
+	{	
+		res.rgb = x + chroma; 										//Blend by Curves_contrast
+	}
+	
+	if (C_CONTRASTCURVES==false)
+	{
+		res.rgb = origcolor.rgb;
+	}	
+  
+	res.w=1.0;
+	return res;
+}
+
+float4 PS_ProcessVibrance(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+
+	float Vibrance = lerp(VibranceNightExt, VibranceDayExt, ENightDayFactor);
+	if (EInteriorFactor) 
+	{
+		Vibrance = lerp(VibranceNightInt, VibranceDayInt, ENightDayFactor);
+	};
+	
+	float4	res;
+	float3	origcolor = tex2D(SamplerColor, IN.txcoord.xy);
+	float3	lumCoeff = float3(0.212656, 0.715158, 0.072186);  				//Calculate luma with these values
+	
+	float	max_color = max(origcolor.r, max(origcolor.g,origcolor.b)); 	//Find the strongest color
+	float	min_color = min(origcolor.r, min(origcolor.g,origcolor.b)); 	//Find the weakest color
+
+	float	color_saturation = max_color - min_color; 						//Saturation is the difference between min and max
+
+	float	luma = dot(lumCoeff, origcolor.rgb); 							//Calculate luma (grey)
+
+	if (C_VIBRANCE==true)
+	{	
+		res.rgb = lerp(luma, origcolor.rgb, (1.0 + (Vibrance * (1.0 - (sign(Vibrance) * color_saturation))))); 	//Extrapolate between luma and original by 1 + (1-saturation) - current
+	}
+	
+	if (C_VIBRANCE==false)
+	{
+		res.rgb = origcolor.rgb;
+	}	
+	
+	res.w=1.0;
+	return res;
+}
+
+float4 PS_ProcessNoise(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float NoiseAmount = NoiseAmountExt;
+	float NoiseFineness = NoiseFinenessExt;
+	if (EInteriorFactor) 
+	{
+		NoiseAmount = NoiseAmountInt;
+		NoiseFineness = NoiseFinenessInt;
+	};
+
+	float4 coord=0.0;
+	 
+	coord.xy=IN.txcoord.xy;
+	coord.w=0.0; 
+	
+	#define noise_strength_luma 				(CoefLuma * NoiseAmount)  
+	#define CoefLuma 							float4(0.2126, 0.7152, 0.0722, 0)
+ 
+	float4 tcol=tex2Dlod(SamplerColor, coord); 
+	float origgray=max(tcol.x, tcol.y);
+	origgray=max(origgray, tcol.z);
+	coord.xy=IN.txcoord.xy*NoiseFineness + frac(Timer.x * 100000.0 + Timer.x);
+	float4 cnoi=tex2Dlod(SamplerNoise, coord);
+ 
+	#if NoiseMethod == 1
+		tcol=lerp(tcol, (cnoi.x+0.5)*tcol, noise_strength_luma*saturate(1.0-origgray*0.5));
+	#endif
+	
+	#if NoiseMethod == 0
+		tcol=lerp(tcol, (cnoi.x+0.5)*tcol, NoiseAmount*saturate(1.0-origgray*0.5));
+	#endif
+ 
+	tcol.w=1.0;
+	return tcol;
+} 
+
+float4 PS_LevelsPass(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float Levels_black_point = lerp(BlackPointNightExt, BlackPointDayExt, ENightDayFactor);
+	float Levels_white_point = lerp(WhitePointNightExt, WhitePointDayExt, ENightDayFactor);
+	if (EInteriorFactor) 
+	{
+		Levels_black_point = lerp(BlackPointNightInt, BlackPointDayInt, ENightDayFactor);
+		Levels_white_point = lerp(WhitePointNightInt, WhitePointDayInt, ENightDayFactor);
+	};
+
+	#define black_point_float ( Levels_black_point / 255.0 )
+	#define white_point_float ( 255.0 / (Levels_white_point - Levels_black_point))
+	
+	float4	res;
+	float3	origcolor = tex2D(SamplerColor, IN.txcoord.xy);
+	
+	if (C_BLACKLEVEL==true)
+	{	
+		res.rgb = origcolor.rgb * white_point_float - (black_point_float *  white_point_float);
+	}
+	
+	if (C_BLACKLEVEL==false)
+	{
+		res.rgb = origcolor.rgb;
+	}	
+	
+	res.w=1.0;
+	return res;
+}
+
+///////////////////////
+//	  TECHNIQUES	 //
+///////////////////////
+technique PostProcess
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessNoise();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique PostProcess2
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessBlur();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique PostProcess3
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessSharpen();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique PostProcess4
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessShift();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}	
+
+technique PostProcess5
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessContrast();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique PostProcess6
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessVibrance();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique PostProcess7
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessLumaSharpen();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+	
+technique PostProcess8
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_LevelsPass();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}	

+ 35 - 0
Game Folder/effect.txt.ini

@@ -0,0 +1,35 @@
+[EFFECT.TXT]
+TECHNIQUE=0
+Horizontal Pixel Resolution=1280.0
+Vertical Pixel Resolution=720.0
+Enable Black Level=true
+Enable Contrast=true
+Enable Vibrance=true
+Blur Sampling Range=0.0
+Sharp Sampling Range=0.0
+Sharpening Amount=0.0
+Shift Sampling Range=0.0
+Noise Amount - Exterior=0.0
+Noise Amount - Interior=0.0
+Noise Fineness - Exterior=0.0
+Noise Fineness - Interior=50.0
+Contrast - Exterior Day=0.1
+Contrast - Interior Day=0.1
+Contrast - Exterior Night=0.0
+Contrast - Interior Night=0.0
+Vibrance - Exterior Day=-0.0
+Vibrance - Interior Day=-0.05
+Vibrance - Exterior Night=0.0
+Vibrance - Interior Night=-0.05
+LumaSharpen Strength - Exterior=0.95
+LumaSharpen Strength - Interior=0.85
+LumaSharpen Clamp - Exterior=0.2
+LumaSharpen Clamp - Interior=0.195
+Black Level - Exterior Day=12.0
+Black Level - Interior Day=1.0
+White Level - Exterior Day=215.0
+White Level - Interior Day=245.0
+Black Level - Exterior Night=0.0
+Black Level - Interior Night=1.0
+White Level - Exterior Night=255.0
+White Level - Interior Night=255.0

+ 603 - 0
Game Folder/enbbloom.fx

@@ -0,0 +1,603 @@
+// M I D H R A S T I C   E N B   F O R   F A L L O U T  3
+
+//++++++++++++++++++++++++++++++++++++++++++++
+// ENBSeries effect file
+// visit http://enbdev.com for updates
+// Copyright (c) 2007-2011 Boris Vorontsov
+// Tinting and Anamorphic Flare code courtesy of Matso
+//++++++++++++++++++++++++++++++++++++++++++++
+
+
+//+++++++++++++++++++++++++++++
+//internal parameters, can be modified
+//+++++++++++++++++++++++++++++
+
+#define USE_TINTING		1
+#define TINT_COLOR		float3(0.77, 0.7, 0.825)
+#define TINT_TEXTURE	tex2D(SamplerBloom6, In.txcoord0.xy).rgb
+#define TINT_LEVEL		1.3
+#define USE_ANAMFLARE	1			// comment it to disable anamorphic lens flare
+
+#if USE_TINTING == 1
+ #define TINT			TINT_COLOR
+#elseif USE_TINTING == 2
+ #define TINT			TINT_TEXTURE
+#endif
+
+//+++++++++++++++++++++++++++++
+//external parameters, do not modify
+//+++++++++++++++++++++++++++++
+//keyboard controlled temporary variables (in some versions exists in the config file). Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. By default all set to 1.0
+float4	tempF1; //0,1,2,3
+float4	tempF2; //5,6,7,8
+float4	tempF3; //9,0
+//x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
+float4	ScreenSize;
+//x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
+float4	Timer;
+//additional info for computations
+float4	TempParameters; 
+//Lenz reflection intensity, lenz reflection power
+float4	LenzParameters;
+//BloomRadius1, BloomRadius2, BloomBlueShiftAmount, BloomContrast
+float4	BloomParameters;
+
+// Anamorphic flare parameters
+#define fFlareLuminance 0.333				// bright pass luminance value 
+#define fFlareBlur 200.0						// manages the size of the flare //200
+#define fFlareIntensity 0.10				// effect intensity
+
+// MIDHRAS - Use the settings below to adjust BloomRadius for the consecutive bloom passes. 
+//#define BloomRadius0 0.282
+#define BloomRadius1 1.524
+#define BloomRadius2 1.524
+
+texture2D texBloom1;
+texture2D texBloom2;
+texture2D texBloom3;
+texture2D texBloom4;
+texture2D texBloom5;
+texture2D texBloom6;
+texture2D texBloom7;//additional bloom tex
+texture2D texBloom8;//additional bloom tex
+
+sampler2D SamplerBloom1 = sampler_state
+{
+    Texture   = <texBloom1>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerBloom2 = sampler_state
+{
+    Texture   = <texBloom2>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerBloom3 = sampler_state
+{
+    Texture   = <texBloom3>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerBloom4 = sampler_state
+{
+    Texture   = <texBloom4>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerBloom5 = sampler_state
+{
+    Texture   = <texBloom5>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerBloom6 = sampler_state
+{
+    Texture   = <texBloom6>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerBloom7 = sampler_state
+{
+    Texture   = <texBloom7>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerBloom8 = sampler_state
+{
+    Texture   = <texBloom8>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+struct VS_OUTPUT_POST
+{
+	float4 vpos  : POSITION;
+	float2 txcoord0 : TEXCOORD0;
+};
+struct VS_INPUT_POST
+{
+	float3 pos  : POSITION;
+	float2 txcoord0 : TEXCOORD0;
+};
+
+
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+VS_OUTPUT_POST VS_Bloom(VS_INPUT_POST IN)
+{
+	VS_OUTPUT_POST OUT;
+	OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
+	OUT.txcoord0.xy=IN.txcoord0.xy+TempParameters.xy;//1.0/(bloomtexsize*2.0)
+
+	return OUT;
+}
+
+/**
+ * Bright pass - rescales sampled pixel to emboss bright enough value.
+ */
+float3 BrightPass(float2 tex)
+{
+	float3 c = tex2D(SamplerBloom2, tex).rgb;
+    float3 bC = max(c - float3(fFlareLuminance, fFlareLuminance, fFlareLuminance), 0.0);
+    float bright = dot(bC, 1.0);
+    bright = smoothstep(0.0f, 0.5, bright);
+    return lerp(0.0, c, bright);
+}
+
+/**
+ * Anamorphic sampling function - scales pixel coordinate
+ * to stratch the image along one of the axels.
+ * (http://en.wikipedia.org/wiki/Anamorphosis)
+ */
+float3 AnamorphicSample(int axis, float2 tex, float blur)
+{
+	tex = 2.0 * tex - 1.0;
+	if (!axis) tex.x /= -blur;
+	else tex.y /= -blur;
+	tex = 0.5 * tex + 0.5;
+	return BrightPass(tex);
+}
+
+/**
+ * Converts pixel color to gray-scale.
+ */
+float GrayScale(float3 sample)
+{
+	return dot(sample, float3(0.3, 0.59, 0.11));
+}
+
+// Constants ///////////////////////////////////////////////////////////////
+const float2 bloomOffset[8]=
+{
+	float2(0.707, 0.707),
+	float2(0.707, -0.707),
+	float2(-0.707, 0.707),
+	float2(-0.707, -0.707),
+	float2(0.0, 1.0),
+	float2(0.0, -1.0),
+	float2(1.0, 0.0),
+	float2(-1.0, 0.0)
+};
+
+// deepness, curvature, inverse size
+const float3 offset[4]=
+{
+	float3(1.6, 4.0, 1.0),
+	float3(0.7, 0.25, 2.0),
+	float3(0.3, 1.5, 0.5),
+	float3(-0.5, 1.0, 1.0)
+};
+
+// color filter per reflection
+const float3 factors[4]=
+{
+	float3(0.3, 0.4, 0.4),
+	float3(0.2, 0.4, 0.5),
+	float3(0.5, 0.3, 0.7),
+	float3(0.1, 0.2, 0.7)
+};
+////////////////////////////////////////////////////////////////////////////
+
+// Anamorphic lens flare pixel shader (Matso code)
+float4 PS_ProcessPass_Anamorphic(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float4 res;
+	float2 coord = IN.txcoord0.xy;
+//MIDHRAS - Anamorphic flare can be used in various ways: if you set all RGB-values to a single identical number, the AF will take on the colour of the light it's triggered by. However, setting only one RGB value, or any combination of the three using different numbers, allows you to set the colour of the flare. The higher the numbers, the more opaque and strong the flares.
+	float3 anamFlare = AnamorphicSample(0, coord.xy, fFlareBlur) * float3(0.35, 0.35, 0.35); //trichromatic Anamorphic Flare (adaptive)
+	//float3 anamFlare = AnamorphicSample(0, coord.xy, fFlareBlur) * float3(0.75, 0.55, 0.0); //monochromatic Anamorphic Flare RED
+	//float3 anamFlare = AnamorphicSample(0, coord.xy, fFlareBlur) * float3(0.0, 0.55, 0.0); //monochromatic Anamorphic Flare GREEN
+	//float3 anamFlare = AnamorphicSample(0, coord.xy, fFlareBlur) * float3(0.0, 0.0, 1.0); //monochromatic Anamorphic Flare BLUE
+	//MIDHRAS - The RGB values for the float3 values above can be used to set the colour of the AnamFlare. Putting them all at the same values results in an anamFlare that takes on the colour of the light that causes it. Putting two values to 0 will give you a flare in the colour of the parameter that you gave a value above zero. the higher the number, the more opaque the flare.
+	
+	res.rgb = anamFlare * fFlareIntensity;
+	res.a = 1.0;
+	
+	return res;
+}
+
+//zero pass HQ, input texture is fullscreen
+//SamplerBloom1 - fullscreen texture
+float4 PS_BloomPrePass(VS_OUTPUT_POST In) : COLOR
+{
+	float4 bloomuv;
+	float4 bloom=0.05;//MIDHRAS - 0.0 //tex2D(SamplerBloom1, In.txcoord0);
+	const float2 offset[4]=
+	{
+		float2(0.25, 1.25),
+		float2(0.25, -0.25),
+		float2(-0.25, 0.25),
+		float2(-0.25, -0.25)
+	};
+	//TempParameters.w==1 if first pass, ==2 is second pass
+	float2 screenfact=TempParameters.z;
+	screenfact.y*=ScreenSize.z;
+	float4 srcbloom=bloom;
+	for (int i=0; i<4; i++)
+	{
+		bloomuv.xy=offset[i];
+		bloomuv.xy=(bloomuv.xy*screenfact.xy)+In.txcoord0.xy;
+		float4 tempbloom=tex2D(SamplerBloom1, bloomuv.xy);
+		bloom.xyz+=tempbloom.xyz;
+	}
+	bloom.xyz*=0.35;
+
+	bloom.xyz=min(bloom.xyz, 32768.0);
+	bloom.xyz=max(bloom.xyz, 0.0);
+
+	return bloom;
+}
+
+
+
+//first and second passes draw to every texture
+//twice, after computations of these two passes,
+//result is set as input to next cycle
+
+//first pass
+//SamplerBloom1 is result of prepass or second pass from cycle
+float4 PS_BloomTexture1(VS_OUTPUT_POST In) : COLOR
+{
+	float4 bloomuv;
+	float4 bloom=tex2D(SamplerBloom1, In.txcoord0);
+	const float2 offset[8]=
+	{
+		float2(1.0, 1.0),
+		float2(1.0, -1.0),
+		float2(-1.0, 1.0),
+		float2(-1.0, -1.0),
+		float2(0.0, 1.0),
+		float2(0.0, -1.0),
+		float2(1.0, 0.0),
+		float2(-1.0, 0.0)
+	};
+	float2 screenfact=0.0017;
+	screenfact.y*=ScreenSize.z;
+	float4 srcbloom=bloom;
+	//TempParameters.w == (1+passnumber)
+	//float step=BloomParameters.x;//*pow(2.0, BloomParameters.x * (TempParameters.w-1.0));//*0.5
+	float step = BloomRadius1 * BloomParameters.x;  //MIDHRAS - uncomment if bloom radius control is needed (also set BloomRadius1 above).
+//	float step=(TempParameters.w-0.25);//
+	screenfact.xy*=step;//====================================================
+
+	float4 bloomadd=bloom;
+
+	for (int i=0; i<8; i++)
+	{
+		bloomuv.xy=offset[i];
+		bloomuv.xy=(bloomuv.xy*screenfact.xy)+In.txcoord0.xy;//-(1.0/256.0);//-(1.0/512.0);
+		float4 tempbloom=tex2D(SamplerBloom1, bloomuv.xy);
+		bloom+=tempbloom;
+	}
+	bloom*=0.1111111;
+
+
+//////////////////////////////////////////////////////////////////////////////////
+#ifdef USE_TINTING
+	float3 tint = TINT * TINT_LEVEL;
+	float ttt = max(dot(bloom.xyz, 0.333) - dot(srcbloom.xyz, 0.111), 0.0);
+	//float ttt = max(dot(bloom.xyz, 0.333) - dot(srcbloom.xyz, 0.333), 0.0);	
+	float gray = BloomParameters.z * ttt * 10.0;	
+	float mixfact = (gray / (1.0 + gray));
+	
+	mixfact *= 1.0 - saturate((TempParameters.w - 1.0) * 0.2);
+	tint.xy += saturate((TempParameters.w - 1.0) * 0.3);
+	tint.xy = saturate(tint.xy);
+	
+	bloom.xyz *= lerp(1.0, tint.xyz, mixfact);
+#endif
+//////////////////////////////////////////////////////////////////////////////////		
+
+//MIDHRAS - dpeasant alternative to Matso's tinting code:
+/*
+	//float3 violet=float3(0.78, 0.5, 1.0);
+	float3 violet=float3(0.6, 0.4, 1.0);//v3
+//	float3 violet=float3(0.27, 0.52, 1.0);//v4
+
+	//this applies when white
+	//float gray=0.104*dot(srcbloom.xyz, 0.333);//max(srcbloom.x, max(srcbloom.y, srcbloom.z));
+	//this applies on dark and when contrast
+	float ttt=dot(bloom.xyz, 0.333)-dot(srcbloom.xyz, 0.333);
+	ttt=max(ttt, 0.0);
+	float gray=BloomParameters.z*ttt*10;//max(srcbloom.x, max(srcbloom.y, srcbloom.z));
+	float mixfact=(gray/(1.0+gray));
+	mixfact*=1.0-saturate((TempParameters.w-1.0)*0.2);
+	violet.xy+=saturate((TempParameters.w-1.0)*0.3);
+	violet.xy=saturate(violet.xy);
+	bloom.xyz*=lerp(1.0, violet.xyz, mixfact);
+*/
+	
+	
+	bloom.w=1.0;
+	return bloom;
+}
+
+
+//second pass
+//SamplerBloom1 is result of first pass
+float4 PS_BloomTexture2(VS_OUTPUT_POST In) : COLOR
+{
+	float4 bloomuv;
+	float4 bloom=tex2D(SamplerBloom1, In.txcoord0);
+	const float2 offset[8]=
+	{
+		float2(1.0, 1.0),
+		float2(1.0, -1.0),
+		float2(-1.0, 1.0),
+		float2(-1.0, -1.0),
+		float2(0.0, 1.0),
+		float2(0.0, -1.0),
+		float2(1.0, 0.0),
+		float2(-1.0, 0.0)
+	};
+	float2 screenfact=0.0017;
+	screenfact.y*=ScreenSize.z;
+	float4 srcbloom=bloom;
+
+	//TempParameters.w == (1+passnumber)
+//	float step=(TempParameters.w-0.25);
+	//float step=BloomParameters.y;//*pow(2.0, BloomParameters.y * (TempParameters.w-1.0))*2.0;//*0.5
+	float step = BloomRadius2 * BloomParameters.y;	
+	screenfact.xy*=step;//*0.25====================================================
+	float4 rotvec=0.0;
+	sincos(0.3927, rotvec.x, rotvec.y);
+	for (int i=0; i<8; i++)
+	{
+		bloomuv.xy=offset[i];
+		bloomuv.xy=reflect(bloomuv.xy, rotvec.xy);///????????
+		bloomuv.xy=(bloomuv.xy*screenfact.xy)+In.txcoord0.xy;
+		float4 tempbloom=tex2D(SamplerBloom1, bloomuv.xy);
+		bloom+=tempbloom;
+	}
+	bloom*=0.111111;
+
+float Saturation=-0.206;//todo modify this, negative or positive, you can move this at the beginning of shader file
+float middlegray=(bloom.r+bloom.g+bloom.b)*0.333;
+float3 diffcolor=bloom.rgb-middlegray;
+//bloom.rgb+=diffcolor*Saturation;
+//bloom.rgb=max(bloom.rgb, 0.0); //output must be never negative, but "saturate" also work here and faster.
+
+
+
+	bloom.w=1.0;
+	return bloom;
+}
+
+
+
+//last pass, mix several bloom textures
+//SamplerBloom5 is the result of prepass
+//float4 PS_BloomPostPass(float2 vPos : VPOS ) : COLOR
+float4 PS_BloomPostPass(VS_OUTPUT_POST In) : COLOR
+{
+	float4 bloom;
+	//v1
+	bloom =tex2D(SamplerBloom1, In.txcoord0);
+	bloom+=tex2D(SamplerBloom2, In.txcoord0);
+	bloom+=tex2D(SamplerBloom3, In.txcoord0);
+	bloom+=tex2D(SamplerBloom4, In.txcoord0);
+	bloom+=tex2D(SamplerBloom7, In.txcoord0);
+	bloom+=tex2D(SamplerBloom8, In.txcoord0);
+	bloom+=tex2D(SamplerBloom5, In.txcoord0);
+//	bloom+=tex2D(SamplerBloom6, In.txcoord0);
+	bloom*=0.142857;
+
+	float3 lenz=0;
+	float2 lenzuv=0.0;
+	//deepness, curvature, inverse size
+	const float3 offset[4]=
+	{
+		float3(1.6, 4.0, 1.0),
+		float3(0.7, 0.25, 2.0),
+		float3(0.3, 1.5, 0.5),
+		float3(-0.5, 1.0, 1.0)
+	};
+	//color filter per reflection
+	const float3 factors[4]=
+	{
+		float3(0.3, 0.4, 0.4),
+		float3(0.2, 0.4, 0.5),
+		float3(0.5, 0.3, 0.7),
+		float3(0.1, 0.2, 0.7)
+	};
+
+//lenzuv.xy=0.5-lenzuv.xy;
+//distfact=0.5-lenzuv.xy-0.5;
+
+	if (LenzParameters.x>0.00001)
+	{
+		for (int i=0; i<4; i++)
+		{
+			float2 distfact=(In.txcoord0.xy-0.5);
+			lenzuv.xy=offset[i].x*distfact;
+			lenzuv.xy*=pow(2.0*length(float2(distfact.x*ScreenSize.z,distfact.y)), offset[i].y);
+			lenzuv.xy*=offset[i].z;
+			lenzuv.xy=0.5-lenzuv.xy;//v1
+	//		lenzuv.xy=In.txcoord0.xy-lenzuv.xy;//v2
+			float3 templenz=tex2D(SamplerBloom2, lenzuv.xy);
+			templenz=templenz*factors[i];
+			distfact=(lenzuv.xy-0.5);
+			distfact*=2.0;
+			templenz*=saturate(1.0-dot(distfact,distfact));//limit by uv 0..1
+	//		templenz=factors[i] * (1.0-dot(distfact,distfact));
+			float maxlenz=max(templenz.x, max(templenz.y, templenz.z));
+/*			float3 tempnor=(templenz.xyz/maxlenz);
+			tempnor=pow(tempnor, tempF1.z);
+			templenz.xyz=tempnor.xyz*maxlenz;
+*/
+			float tempnor=(maxlenz/(1.0+maxlenz));
+			tempnor=pow(tempnor, LenzParameters.y);
+			templenz.xyz*=tempnor;
+
+	//		templenz*=maxlenz*maxlenz;
+			lenz+=templenz;
+	//		lenz.xyz=max(lenz.xyz, templenz.xyz*0.99);
+		}
+		lenz.xyz*=0.25*LenzParameters.x;
+
+		bloom.xyz+=lenz.xyz;
+//		bloom.w=dot(lenz.xyz, 0.333);
+		bloom.w=max(lenz.xyz, max(lenz.y, lenz.z));
+	}
+	return bloom;
+}
+
+//---------------------------------------------------------------------------------
+
+technique BloomPrePass
+{
+    pass p0
+    {
+	VertexShader = compile vs_3_0 VS_Bloom();
+	PixelShader  = compile ps_3_0 PS_BloomPrePass();
+
+	ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
+	CullMode=NONE;
+	AlphaBlendEnable=FALSE;
+	AlphaTestEnable=FALSE;
+	SEPARATEALPHABLENDENABLE=FALSE;
+	FogEnable=FALSE;
+	SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique BloomTexture1
+{
+    pass p0
+    {
+	VertexShader = compile vs_3_0 VS_Bloom();
+	PixelShader  = compile ps_3_0 PS_BloomTexture1();
+
+	ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
+	CullMode=NONE;
+	AlphaBlendEnable=FALSE;
+	AlphaTestEnable=FALSE;
+	SEPARATEALPHABLENDENABLE=FALSE;
+	FogEnable=FALSE;
+	SRGBWRITEENABLE=FALSE;
+	}
+}
+
+
+technique BloomTexture2
+{
+    pass p0
+    {
+	VertexShader = compile vs_3_0 VS_Bloom();
+	PixelShader  = compile ps_3_0 PS_BloomTexture2();
+
+	ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
+	CullMode=NONE;
+	AlphaBlendEnable=FALSE;
+	AlphaTestEnable=FALSE;
+	SEPARATEALPHABLENDENABLE=FALSE;
+	FogEnable=FALSE;
+	SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique BloomPostPass
+{
+    pass p0
+    {
+	VertexShader = compile vs_3_0 VS_Bloom();
+	PixelShader  = compile ps_3_0 PS_BloomPostPass();
+
+	ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
+	CullMode=NONE;
+	AlphaBlendEnable=FALSE;
+	AlphaTestEnable=FALSE;
+	SEPARATEALPHABLENDENABLE=FALSE;
+	FogEnable=FALSE;
+	SRGBWRITEENABLE=FALSE;
+	}
+
+#ifdef USE_ANAMFLARE
+	pass p1
+	{
+		AlphaBlendEnable = true;
+		SrcBlend = One;
+		DestBlend = One;
+			
+		PixelShader = compile ps_3_0 PS_ProcessPass_Anamorphic();
+	}
+#endif
+}

+ 704 - 0
Game Folder/enbeffect.fx

@@ -0,0 +1,704 @@
+// M I D H R A S T I C   E N B   F O R   F A L L O U T  3
+
+//++++++++++++++++++++++++++++++++++++++++++++
+// ENBSeries effect file 
+// visit http://enbdev.com for updates
+// Copyright (c) 2007-2011 Boris Vorontsov
+// Edited By dpeasant. Thanks to:...
+//++++++++++++++++++++++++++++++++++++++++++++
+
+// Use #define to activate, and #undef to deactivate. Alternatively, place // before the '#define's. 
+
+//post processing mode. Change value (could be 1, 2, 3, 4). Every mode have own internal parameters, look below
+#ifndef POSTPROCESS
+ #define POSTPROCESS	3
+#endif
+
+//use original game processing first, then mine
+//#define APPLYGAMECOLORCORRECTION
+
+//use original game processing only, with vanilla bloom
+//#define ENB_FLIPTECHNIQUE
+
+// Whether to use the values defined below for a colour filter. 
+//#undef ColourFilter
+
+//+++++++++++++++++++++++++++++
+//internal parameters, can be modified
+//+++++++++++++++++++++++++++++
+
+float3	EColorFilter=float3(1.0, 1, 1);
+
+//modify these values to tweak various color processing
+//POSTPROCESS 1
+float	EAdaptationMinV1=0.01;
+float	EAdaptationMaxV1=0.07;
+float	EContrastV1=0.95;
+float	EColorSaturationV1=1.0;
+float	EToneMappingCurveV1=6.0;
+
+//POSTPROCESS 2
+//float	EBrightnessV2=2.5;
+float	EAdaptationMinV2=0.05;
+float	EAdaptationMaxV2=0.05;//0.125;
+float	EToneMappingCurveV2=8.0;
+float	EIntensityContrastV2=1.0;
+float	EToneMappingOversaturationV2=180.0;
+float	EColorSaturationV2=2.0;
+
+//POSTPROCESS 3
+float	EAdaptationMinV3=0.10;
+float	EAdaptationMaxV3=0.115;
+float	EToneMappingCurveV3=3.5;
+float	EToneMappingOversaturationV3=50.0;
+
+//POSTPROCESS 4
+float	EAdaptationMinV4=0.1920;
+float	EAdaptationMaxV4=0.20;
+float	EBrightnessCurveV4=1.3;
+float	EBrightnessMultiplierV4=1.2;
+float	EBrightnessToneMappingCurveV4=2.6;
+
+
+
+//+++++++++++++++++++++++++++++
+//external parameters, do not modify
+//+++++++++++++++++++++++++++++
+//keyboard controlled temporary variables (in some versions exists in the config file). Press and hold key 1,2,3...8 together with PageUp or PageDown to modify. By default all set to 1.0
+float4	tempF1; //0,1,2,3
+float4	tempF2; //5,6,7,8
+float4	tempF3; //9,0
+//x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
+float4	Timer;
+//x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
+float4	ScreenSize;
+//changes in range 0..1, 0 means that night time, 1 - day time
+float	ENightDayFactor;
+//enb version of bloom applied, ignored if original post processing used
+float	EBloomAmount;
+
+
+
+texture2D texs0;//color
+texture2D texs1;//bloom skyrim
+texture2D texs2;//adaptation skyrim
+texture2D texs3;//bloom enb
+texture2D texs4;//adaptation enb
+texture2D texs7;//palette enb
+
+sampler2D _s0 = sampler_state
+{
+	Texture   = <texs0>;
+	MinFilter = POINT;//
+	MagFilter = POINT;//
+	MipFilter = NONE;//LINEAR;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D _s1 = sampler_state
+{
+	Texture   = <texs1>;
+	MinFilter = LINEAR;//
+	MagFilter = LINEAR;//
+	MipFilter = NONE;//LINEAR;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D _s2 = sampler_state
+{
+	Texture   = <texs2>;
+	MinFilter = LINEAR;//
+	MagFilter = LINEAR;//
+	MipFilter = NONE;//LINEAR;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D _s3 = sampler_state
+{
+	Texture   = <texs3>;
+	MinFilter = LINEAR;//
+	MagFilter = LINEAR;//
+	MipFilter = NONE;//LINEAR;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D _s4 = sampler_state
+{
+	Texture   = <texs4>;
+	MinFilter = LINEAR;//
+	MagFilter = LINEAR;//
+	MipFilter = NONE;//LINEAR;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D _s7 = sampler_state
+{
+	Texture   = <texs7>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+struct VS_OUTPUT_POST
+{
+	float4 vpos  : POSITION;
+	float2 txcoord0 : TEXCOORD0;
+};
+struct VS_INPUT_POST
+{
+	float3 pos  : POSITION;
+	float2 txcoord0 : TEXCOORD0;
+};
+
+
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
+{
+	VS_OUTPUT_POST OUT;
+
+	OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
+
+	OUT.txcoord0.xy=IN.txcoord0.xy;
+
+	return OUT;
+}
+
+
+//skyrim shader specific externals, do not modify
+float4	_c1 : register(c1);
+float4	_c2 : register(c2);
+float4	_c3 : register(c3);
+float4	_c4 : register(c4);
+float4	_c5 : register(c5);
+
+float4 PS_D6EC7DD1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float4 _oC0=0.0; //output
+
+	float4 _c6=float4(0, 0, 0, 0);
+	float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
+
+	float4 r0;
+	float4 r1;
+	float4 r2;
+	float4 r3;
+	float4 r4;
+	float4 r5;
+	float4 r6;
+	float4 r7;
+	float4 r8;
+	float4 r9;
+	float4 r10;
+	float4 r11;
+
+
+	float4 _v0=0.0;
+
+	_v0.xy=IN.txcoord0.xy;
+	r1=tex2D(_s0, _v0.xy); //color
+
+	r11=r1; //my bypass
+	_oC0.xyz=r1.xyz; //for future use without game color corrections
+
+#ifdef APPLYGAMECOLORCORRECTION
+	//apply original
+    r0.x=1.0/_c2.y;
+    r1=tex2D(_s4, _v0);
+    r0.yz=r1.xy * _c1.y;
+    r0.w=1.0/r0.y;
+    r0.z=r0.w * r0.z;
+    r1=tex2D(_s0, _v0);
+    r1.xyz=r1 * _c1.y;
+    r0.w=dot(_c7.xyz, r1.xyz);
+    r1.w=r0.w * r0.z;
+    r0.z=r0.z * r0.w + _c7.w;
+    r0.z=1.0/r0.z;
+    r0.x=r1.w * r0.x + _c7.w;
+    r0.x=r0.x * r1.w;
+    r0.x=r0.z * r0.x;
+    if (r0.w<0) r0.x=_c6.x;
+    r0.z=1.0/r0.w;
+    r0.z=r0.z * r0.x;
+    r0.x=saturate(-r0.x + _c2.x);
+    r2=tex2D(_s3, _v0);//enb bloom
+//    r2=tex2D(_s1, _v0);//skyrim bloom
+    r2.xyz=r2 * _c1.y;
+    r2.xyz=r0.x * r2;
+    r1.xyz=r1 * r0.z + r2;
+    r0.x=dot(r1.xyz, _c7.xyz);
+    r1.w=_c7.w;
+    r2=lerp(r0.x, r1, _c3.x);
+    r1=r0.x * _c4 - r2;
+    r1=_c4.w * r1 + r2;
+    r1=_c3.w * r1 - r0.y;
+    r0=_c3.z * r1 + r0.y;
+    r1=-r0 + _c5;
+    _oC0=_c5.w * r1 + r0;
+
+#endif //APPLYGAMECOLORCORRECTION
+
+	float4 color=_oC0;
+
+
+	//adaptation in time
+	float4	Adaptation=tex2D(_s4, 0.5);
+	float	grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
+//	grayadaptation=1.0/grayadaptation;
+
+
+	float4	xcolorbloom=tex2D(_s3, _v0.xy); //bloom
+
+
+
+float bchnd = 0.1;
+		float hbs = 0.1;
+
+xcolorbloom=xcolorbloom*(1-pow(1.3,-xcolorbloom*35));
+
+
+
+//	float	maxb=max(xcolorbloom.x, max(xcolorbloom.y, xcolorbloom.z));
+//	float	violetamount=maxb/(maxb+EVioletShiftAmountInv);
+//	xcolorbloom.xyz=lerp(xcolorbloom.xyz, xcolorbloom.xyz*EVioletShiftColor, violetamount*violetamount);
+//xcolorbloom=xcolorbloom*(1-pow(1.5,-xcolorbloom*1));
+
+	//darkening if too bright screen
+	float	srcgray=max(color.x, max(color.y, color.z));
+//v1 not good for hdr, scaling required
+//	color.xyz=color.xyz-(saturate(EAdaptationDarkeningAmount*grayadaptation) * color.xyz)*(1.0-saturate(srcgray*tempF2.y));
+//v2
+//	color.xyz=color.xyz-(saturate(EAdaptationDarkeningAmount*grayadaptation) * color.xyz)*(1.0-saturate(srcgray/(srcgray+1.0*tempF2.y)));
+//v3
+	//color.xyz=color.xyz-(saturate(1*grayadaptation) * color.xyz)*(1.0/(srcgray*0.7+1.0));//0.7 to modify!!!
+
+float	Dpeasant3=1.05;
+	
+	float cgray=dot(xcolorbloom.xyz, 0.333);//luma
+	float3 poweredcolor=pow(xcolorbloom.xyz, Dpeasant3);
+	float newgray=dot(poweredcolor.xyz, 0.333);
+//xcolorbloom.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
+
+float GlobalSaturationFactor=0.6;//todo modify this, negative or positive, you can move this at the beginning of shader file
+float middlegray=(xcolorbloom.r+xcolorbloom.g+xcolorbloom.b)*0.333;
+float3 diffcolor=xcolorbloom.rgb-middlegray;
+xcolorbloom.rgb+=diffcolor*GlobalSaturationFactor;
+xcolorbloom.rgb=max(xcolorbloom.rgb, 0.0); //output must be never negative, but "saturate" also work here and faster.
+
+
+//xcolorbloom.rgb *= pow(2.0f, 0.2);
+
+	color.xyz+=xcolorbloom.xyz*EBloomAmount;
+//color=xcolorbloom*EBloomAmount + color;
+//	color.xyz=color.xyz-((EAdaptationDarkeningAmount/(grayadaptation*2.0*tempF1.x+1.0)) * color.xyz)*(1.0/(srcgray*0.7+1.0));//0.7 to modify!!!
+//v4
+//	color.xyz=color.xyz/(grayadaptation*EAdaptationAmount*tempF1.x+1.0);
+
+//color.xyz=color.xyz+(xcolorbloom.xyz);
+
+
+
+
+
+#ifdef ColourFilter
+//color.xyz*=EColorFilter;
+#endif
+
+
+#if (POSTPROCESS==1)
+
+	grayadaptation=max(grayadaptation, 0.0);
+	grayadaptation=min(grayadaptation, 50.0);
+	//color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV1+EAdaptationMinV1);//*tempF1.x
+
+	float cgray2=dot(color.xyz, float3(0.27, 0.67, 0.06));
+	cgray2=pow(cgray2, EContrastV1);
+	float3 poweredcolor2=pow(color.xyz, EColorSaturationV1);
+	float newgray2=dot(poweredcolor2.xyz, float3(0.27, 0.67, 0.06));
+	color.xyz=poweredcolor2.xyz*cgray2/(newgray2+0.0001);
+
+	float3	luma=color.xyz;
+	float	lumamax=300.0;
+	//color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
+
+#endif
+
+
+
+#if (POSTPROCESS==2)
+
+	grayadaptation=max(grayadaptation, 0.0);
+	grayadaptation=min(grayadaptation, 50.0);
+	color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV2+EAdaptationMinV2);//*tempF1.x
+
+	//color.xyz*=EBrightnessV2;
+	color.xyz+=0.000001;
+	float3 xncol=normalize(color.xyz);
+	float3 scl=color.xyz/xncol.xyz;
+	scl=pow(scl, EIntensityContrastV2);
+	xncol.xyz=pow(xncol.xyz, EColorSaturationV2);
+	color.xyz=scl*xncol.xyz;
+
+	float	lumamax=EToneMappingOversaturationV2;
+	color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV2);
+
+#endif
+
+
+#if (POSTPROCESS==3)
+
+
+float	EBrightnessV2=1.0;
+//color.xyz*=EBrightnessV2;		
+
+float3 dnsatd = float3( 1.05, 1.05, 1.065 );
+		//float bchnd = 0.1;
+		//float hbs = 0.1;
+
+float3 oldcoln = color.xyz;		// RGB controlled saturation
+							// so sweet thx HD6!
+static const float LUMINANCE = float3(0.333,0.333,0.333);
+		color.xyz *= dnsatd; 
+			//float3 greycn = float3(0.299, 0.587, 0.114);
+		float3 greycn = LUMINANCE;//float3(0.333,0.333,0.333); // screw perception
+			//float3 greycn = float3(0.811,0.523,0.996);
+		color.xyz += (oldcoln.x-(oldcoln.x*dnsatd.x)) * greycn.x;
+		color.xyz += (oldcoln.y-(oldcoln.y*dnsatd.y)) * greycn.y;
+		color.xyz += (oldcoln.z-(oldcoln.z*dnsatd.z)) * greycn.z;
+
+
+
+
+float fRatio = 0.4;	// blend ratio (0-1)
+//float fRatio = 0.425;
+float moodR = 0.735;	// mood color red component
+float moodG = 0.62;	// mood color green component
+float moodB = 0.5;	// mood color blue component
+
+
+	float4 colInput = color;
+	float4 colMood = 1.0f;
+	colMood.r = moodR;
+	colMood.g = moodG;
+	colMood.b = moodB;
+	float fLum = ( colInput.r + colInput.g + colInput.b ) / 3;
+
+	colMood = lerp(0, colMood, saturate(fLum * 2.0));
+	colMood = lerp(colMood, 1, saturate(fLum - 0.5) * 2.0);
+	float4 colOutput = lerp(colInput, colMood, saturate(fLum * fRatio));
+	color.rgb=max(0, colOutput);
+
+
+
+float	Contrast = 0.255;
+color.xyz = saturate(color.xyz);
+	color.xyz = lerp(color.xyz, 0.5 * (1 + sin((color.xyz - 0.5)*3.1415926)), Contrast);
+
+
+	grayadaptation=max(grayadaptation, 0.0);
+	grayadaptation=min(grayadaptation, 50.0);
+	color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV3+EAdaptationMinV3);//*tempF1.x
+
+	float	lumamax=EToneMappingOversaturationV3;
+	color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
+
+
+float3 correctedcolor=saturate((1-color*1)*0.05);
+//color.rgb=saturate(color.rgb-correctedcolor);	
+
+//color.rgb=pow(color.rgb,2.45)*0.895;
+
+float3 LUMINANCE2 = float3(0.2125, 0.7154, 0.0721); // cinematic perception of colors
+
+float BP_factor = 0.1;
+
+
+ float    luma2 = dot(color.xyz, LUMINANCE2);
+
+   float3    blend = luma2.xxx;
+   //float    L = min(1, max(0, 10*(luma2 - 0.45)));
+   float L=clamp((luma2 - 0.45) * 10, 0, 1);
+   float3 result1 = 2.0 * color.xyz * blend;
+   float3 result2 = 1.0 - 2.0*(1.0 - blend)*(1.0 - color.xyz);
+   float3 newColor = lerp(result1.xyz, result2.xyz, L);
+   float3 mixRGB = BP_factor * newColor.xyz;
+   mixRGB += ((1.0f - BP_factor) * color.xyz);
+
+   //color.xyz = mixRGB;
+
+
+
+
+
+
+
+float   Exposure=0.45;
+color.rgb *= pow(2.0f, Exposure);
+
+
+
+
+
+
+
+
+#endif
+
+//color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
+//color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
+//color.xyz*=0.7;
+
+
+#if (POSTPROCESS==4)
+
+	grayadaptation=max(grayadaptation, 0.0);
+	grayadaptation=min(grayadaptation, 50.0);
+	color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV4+EAdaptationMinV4);
+
+	float Y = dot(color.xyz, float3(0.299, 0.587, 0.101)); //0.299 * R + 0.587 * G + 0.114 * B;
+	float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.43)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
+	float V = dot(color.xyz, float3(0.615, -0.51499, -0.092)); //0.615 * R - 0.51499 * G - 0.10001 * B;
+	Y=pow(Y, EBrightnessCurveV4);
+	Y=Y*EBrightnessMultiplierV4;
+//	Y=Y/(Y+EBrightnessToneMappingCurveV4);
+//	float	desaturatefact=saturate(Y*Y*Y*1.7);
+//	U=lerp(U, 0.0, desaturatefact);
+//	V=lerp(V, 0.0, desaturatefact);
+	color.xyz=V * float3(1.11, -0.58, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
+
+	color.xyz=max(color.xyz, 0.0);
+	color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
+
+
+
+float3 dnsatd = float3( 1.2, 1.1, 1.2 );
+		float bchnd = 0.1;
+		float hbs = 0.1;
+
+float3 oldcoln = color.xyz;		// RGB controlled saturation
+							// so sweet thx HD6!
+static const float LUMINANCE = float3(0.2125, 0.7154, 0.0721);
+		color.xyz *= dnsatd; 
+			//float3 greycn = float3(0.299, 0.587, 0.114);
+		float3 greycn = LUMINANCE;//float3(0.333,0.333,0.333); // screw perception
+			//float3 greycn = float3(0.811,0.523,0.996);
+		color.xyz += (oldcoln.x-(oldcoln.x*dnsatd.x)) * greycn.x;
+		color.xyz += (oldcoln.y-(oldcoln.y*dnsatd.y)) * greycn.y;
+		color.xyz += (oldcoln.z-(oldcoln.z*dnsatd.z)) * greycn.z;
+
+
+
+
+
+
+
+
+
+
+float	Dpeasant3=1.1;
+	
+	float cgray=dot(color.xyz, 0.333);//luma
+	float3 poweredcolor=pow(color.xyz, Dpeasant3);
+	float newgray=dot(poweredcolor.xyz, 0.333);
+	
+//color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
+//color.rgb=pow(color.rgb,0.95)*1.15;
+
+float	Contrast = 0.5;
+color.xyz = saturate(color.xyz);
+	color.xyz = lerp(color.xyz, 0.5 * (1 + sin((color.xyz - 0.5)*3.1415926)), Contrast);
+
+#endif
+
+
+
+	//pallete texture (0.082+ version feature)
+#ifdef E_CC_PALETTE
+	color.rgb=saturate(color.rgb);
+	float3	brightness=Adaptation.xyz;//tex2D(_s4, 0.5);//adaptation luminance
+//	brightness=saturate(brightness);//old version from ldr games
+	brightness=(brightness/(brightness+1.0));//new version
+	brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
+	float3	palette;
+	float4	uvsrc=0.0;
+	uvsrc.y=brightness.r;
+	uvsrc.x=color.r;
+	palette.r=tex2Dlod(_s7, uvsrc).r;
+	uvsrc.x=color.g;
+	uvsrc.y=brightness.g;
+	palette.g=tex2Dlod(_s7, uvsrc).g;
+	uvsrc.x=color.b;
+	uvsrc.y=brightness.b;
+	palette.b=tex2Dlod(_s7, uvsrc).b;
+	color.rgb=palette.rgb;
+#endif //E_CC_PALETTE
+
+
+/*
+//temporary testing
+color.xyz=tex2D(_s0, _v0.xy);
+//color.xyz=xcolorbloom.xyz*tempF1.x;
+//color.xyz=pow(color.xyz, 0.5);
+color.xyz+=(xcolorbloom.xyz-color.xyz)*tempF1.y;
+//color.xyz=xcolorbloom.xyz*tempF1.y;
+color.xyz=color.xyz*tempF1.x;
+//color.xyz=color.xyz/(color.xyz +1.0*tempF1.z);
+color.xyz=(color.xyz * (1.0 + color.xyz/40))/(color.xyz + EToneMappingCurveV3);
+	Adaptation=tex2D(_s4, 0.5);
+	grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
+	grayadaptation=max(grayadaptation, 0.0);
+	grayadaptation=min(grayadaptation, 50.0);
+//	color.xyz=Adaptation*2;//*tempF1.x
+
+//color.xyz=tex2D(_s0, _v0.xy)*1.3;
+*/
+
+//	color.xyz=tex2D(_s0, _v0.xy)*pow(tempF1.x,4);
+//	color.xyz=max(xcolorbloom.xyz, tex2D(_s0, _v0.xy).xyz)*pow(tempF1.x,4)*0.7;
+
+	_oC0.w=1.0;
+	_oC0.xyz=color.xyz;
+
+	return _oC0;
+}
+
+
+
+//switch between vanilla and mine post processing
+#ifndef ENB_FLIPTECHNIQUE
+technique Shader_D6EC7DD1
+#else
+technique Shader_ORIGINALPOSTPROCESS
+#endif
+{
+	pass p0
+	{
+		VertexShader  = compile vs_3_0 VS_Quad();
+		PixelShader  = compile ps_3_0 PS_D6EC7DD1();
+
+		ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
+		ZEnable=FALSE;
+		ZWriteEnable=FALSE;
+		CullMode=NONE;
+		AlphaTestEnable=FALSE;
+		AlphaBlendEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+
+
+//original shader of post processing
+#ifndef ENB_FLIPTECHNIQUE
+technique Shader_ORIGINALPOSTPROCESS
+#else
+technique Shader_D6EC7DD1
+#endif
+{
+	pass p0
+	{
+		VertexShader  = compile vs_3_0 VS_Quad();
+		PixelShader=
+	asm
+	{
+// Parameters:
+//   sampler2D Avg;
+//   sampler2D Blend;
+//   float4 Cinematic;
+//   float4 ColorRange;
+//   float4 Fade;
+//   sampler2D Image;
+//   float4 Param;
+//   float4 Tint;
+// Registers:
+//   Name         Reg   Size
+//   ------------ ----- ----
+//   ColorRange   c1       1
+//   Param        c2       1
+//   Cinematic    c3       1
+//   Tint         c4       1
+//   Fade         c5       1
+//   Image        s0       1
+//   Blend        s1       1
+//   Avg          s2       1
+//s0 bloom result
+//s1 color
+//s2 is average color
+
+    ps_3_0
+    def c6, 0, 0, 0, 0
+    //was c0 originally
+    def c7, 0.212500006, 0.715399981, 0.0720999986, 1
+    dcl_texcoord v0.xy
+    dcl_2d s0
+    dcl_2d s1
+    dcl_2d s2
+    rcp r0.x, c2.y
+    texld r1, v0, s2
+    mul r0.yz, r1.xxyw, c1.y
+    rcp r0.w, r0.y
+    mul r0.z, r0.w, r0.z
+    texld r1, v0, s1
+    mul r1.xyz, r1, c1.y
+    dp3 r0.w, c7, r1
+    mul r1.w, r0.w, r0.z
+    mad r0.z, r0.z, r0.w, c7.w
+    rcp r0.z, r0.z
+    mad r0.x, r1.w, r0.x, c7.w
+    mul r0.x, r0.x, r1.w
+    mul r0.x, r0.z, r0.x
+    cmp r0.x, -r0.w, c6.x, r0.x
+    rcp r0.z, r0.w
+    mul r0.z, r0.z, r0.x
+    add_sat r0.x, -r0.x, c2.x
+    texld r2, v0, s0
+    mul r2.xyz, r2, c1.y
+    mul r2.xyz, r0.x, r2
+    mad r1.xyz, r1, r0.z, r2
+    dp3 r0.x, r1, c7
+    mov r1.w, c7.w
+    lrp r2, c3.x, r1, r0.x
+    mad r1, r0.x, c4, -r2
+    mad r1, c4.w, r1, r2
+    mad r1, c3.w, r1, -r0.y
+    mad r0, c3.z, r1, r0.y
+    add r1, -r0, c5
+    mad oC0, c5.w, r1, r0
+	};
+		ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
+		ZEnable=FALSE;
+		ZWriteEnable=FALSE;
+		CullMode=NONE;
+		AlphaTestEnable=FALSE;
+		AlphaBlendEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+    }
+}
+

+ 848 - 0
Game Folder/enbeffectprepass.fx

@@ -0,0 +1,848 @@
+//++++++++++++++++++++++++++++++++++++++++++++
+// ENBSeries effect file
+// visit http://enbdev.com for updates
+// Copyright (c) 2007-2011 Boris Vorontsov
+//
+// Using decompiled shader of TES Skyrim
+//++++++++++++++++++++++++++++++++++++++++++++
+//+++++++++++++++++++++++++++++++++++++++++++++++
+// Unreal Cinema ENB - The Directors Cut - 0.219
+//+++++++++++++++++++++++++++++++++++++++++++++++
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// Additions and Tweaking by Kyokushinoyama, & Unreal Warfare
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+#define ENABLE_FLIP_DAY_NIGHT_FACTOR
+//++++++++++++++++++++++++++++++++++++++++++++
+
+//#define NOT_BLURRING_SKY_MODE
+
+#define	      DEPTH_OF_FIELD_QUALITY 2
+//1-7
+//++++++++++++++++++++++++++++++++++++++++++++
+//#define USE_TIGHT_OFFSETS	1			
+//#define USE_CENTERED_OFFSETS	1				
+//#define USE_REGULAR_OFFSETS	1		
+//#define USE_ORIGINAL_OFFSETS	1			
+//#define USE_WIDE_OFFSETS	1		
+#define USE_NATURAL_OFFSETS	1
+//++++++++++++++++++++++++++++++++++++++++++++	
+#define	AUTO_FOCUS
+//++++++++++++++++++++++++++++++++++++++++++++	
+//#define TILT_SHIFT
+
+// Day, Night, Interior angles
+float	TiltShiftAngleDay=30.0;
+float	TiltShiftAngleNight=30.0;
+float	TiltShiftAngleInterior=30.0;
+//++++++++++++++++++++++++++++++++++++++++++++
+#define POLYGONAL_BOKEH			
+#define POLYGON_NUM 5
+//#define POLYGON_NUM 6
+//#define POLYGON_NUM 7
+//#define POLYGON_NUM 8
+//++++++++++++++++++++++++++++++++++++++++++++	
+// FOCUS POINT DAY
+float2 	FocusPointDay=float2(0.5, 0.5); 
+// FOCUS POINT NIGHT	
+float2 	FocusPointNight=float2(0.5, 0.5);	
+// FOCUS POINT INTERIOR 
+float2 	FocusPointInterior=float2(0.5, 0.5);	 
+
+// DYNAMIC DOF DAY SETTINGS
+float FocusSampleRangeDay=1.0; 	
+float NearBlurCurveDay=14.70;
+float FarBlurCurveDay=2.75;					
+float DepthClipDay=999999999.0; 
+
+// DYNAMIC DOF NIGHT SETTINGS
+float FocusSampleRangeNight=1.0; 
+float NearBlurCurveNight=14.70; 
+float FarBlurCurveNight=2.75;	
+float DepthClipNight=999999999.0; 
+
+// DYNAMIC DOF INTERIOR SETTINGS
+float FocusSampleRangeInterior=1.0;
+float NearBlurCurveInterior=14.70; 
+float FarBlurCurveInterior=2.75;	
+float DepthClipInterior=999999999.0;
+//++++++++++++++++++++++++++++++++++++++++++++
+// DAY SETTINGS
+float	FocalPlaneDepthDay=1.00;
+float	FarBlurDepthDay=100.00;	
+
+// NIGHT SETTINGS
+float	FocalPlaneDepthNight=1.00;
+float	FarBlurDepthNight=100.00;	
+
+// INTERIOR SETTINGS
+float	FocalPlaneDepthInterior=1.00;
+float	FarBlurDepthInterior=100.00;			
+//++++++++++++++++++++++++++++++++++++++++++++
+
+// BOKEH DAY SETTINGS
+float	BokehBiasDay=0.00;			//Impacts overall brightness-exposure - Leave @0.00 for normalize
+float	BokehBiasCurveDay=0.75;				
+float	BokehBrightnessThresholdDay=1.00;	
+float	BokehBrightnessMultiplierDay=1.00;	
+float	RadiusScaleMultiplierDay=0.13;			
+
+// BOKEH NIGHT SETTINGS
+float	BokehBiasNight=0.00;			//Impacts overall brightness-exposure - Leave @0.00 for normalize
+float	BokehBiasCurveNight=0.75;				
+float	BokehBrightnessThresholdNight=1.00;	
+float	BokehBrightnessMultiplierNight=1.00;		
+float	RadiusScaleMultiplierNight=0.13;		
+
+// BOKEH INTERIOR SETTINGS
+float	BokehBiasInterior=0.00;			//Impacts overall brightness-exposure - Leave @0.00 for normalize
+float	BokehBiasCurveInterior=0.75;			
+float	BokehBrightnessThresholdInterior=1.00;	
+float	BokehBrightnessMultiplierInterior=1.00;	
+float	RadiusScaleMultiplierInterior=0.13;		
+//++++++++++++++++++++++++++++++++++++++++++++
+// GRAIN GLOBAL SETTINGS
+float	NoiseAmount=0.055;	
+float	NoiseCurve=0.0;			
+
+// GRAIN DIFFUSION DAY
+float	NoiseDiffusionDay=3.0;		//High values dampen grain, depending on Noise Amounts and Curves - 3.0 will 'disable' grain
+
+// GRAIN DIFFUSION NIGHT
+float	NoiseDiffusionNight=3.0;	//High values dampen grain, depending on Noise Amounts and Curves - 3.0 will 'disable' grain
+
+// GRAIN DIFFUSION INTERIOR
+float	NoiseDiffusionInterior=3.0;	//High values dampen grain, depending on Noise Amounts and Curves - 3.0 will 'disable' grain	
+//++++++++++++++++++++++++++++++++++++++++++++
+// CHROMATIC ABERRATION DAY
+float	ChromaticAberrationAmountDay=0.25;
+
+// CHROMATIC ABERRATION NIGHT
+float	ChromaticAberrationAmountNight=0.25;
+
+// CHROMATIC ABERRATION INTERIOR
+float	ChromaticAberrationAmountInterior=0.25;
+
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// EXTERNAL PARAMETERS BEGINS HERE, SHOULD NOT BE MODIFIED UNLESS YOU KNOW WHAT YOU ARE DOING!!!
+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+#ifndef ENABLE_FLIP_DAY_NIGHT_FACTOR
+		1 - ENightDayFactor = ENightDayFactor;
+#endif
+
+//++++++++++++++++++++++++++++++++++++++++++++
+
+float4 tempF1; //0,1,2,3
+float4 tempF2; //5,6,7,8
+float4 tempF3; //9,0
+float4 ScreenSize;
+float4 Timer;
+float ENightDayFactor;
+float EInteriorFactor;
+float FadeFactor;
+
+texture2D texColor;
+texture2D texDepth;
+texture2D texNoise;
+texture2D texPalette;
+texture2D texFocus; //computed focusing depth
+texture2D texCurr; //4*4 texture for focusing
+texture2D texPrev; //4*4 texture for focusing
+
+sampler2D SamplerColor = sampler_state
+{
+	Texture   = <texColor>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;		//LINEAR
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;			//9	//[KYO : TO DO : experiment with mipmaps]
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerDepth = sampler_state
+{
+	Texture   = <texDepth>;
+	MinFilter = POINT;
+	MagFilter = POINT;
+	MipFilter = NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerNoise = sampler_state
+{
+	Texture   = <texNoise>;
+	MinFilter = POINT;
+	MagFilter = POINT;
+	MipFilter = NONE;//NONE;
+	AddressU  = Wrap;
+	AddressV  = Wrap;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerPalette = sampler_state
+{
+	Texture   = <texPalette>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerCurr = sampler_state
+{
+	Texture   = <texCurr>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = LINEAR;//NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerPrev = sampler_state
+{
+	Texture   = <texPrev>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerFocus = sampler_state
+{
+	Texture   = <texFocus>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+struct VS_OUTPUT_POST
+{
+	float4 vpos  : POSITION;
+	float2 txcoord : TEXCOORD0;
+};
+
+struct VS_INPUT_POST
+{
+	float3 pos  : POSITION;
+	float2 txcoord : TEXCOORD0;
+};
+		
+//++++++++++++++++++++++++++++++++++++++++++++
+
+VS_OUTPUT_POST VS_Focus(VS_INPUT_POST IN)
+{
+	VS_OUTPUT_POST OUT;
+
+	float4 pos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
+
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+
+	return OUT;
+}
+
+float linearlizeDepth(float nonlinearDepth)
+{
+	float2 dofProj=float2(0.0509804, 3098.0392);
+	float2 dofDist=float2(0.0, 0.0509804);
+		
+	float4 depth=nonlinearDepth;
+	
+	
+	depth.y=-dofProj.x + dofProj.y;
+	depth.y=1.0/depth.y;
+	depth.z=depth.y * dofProj.y; 
+	depth.z=depth.z * -dofProj.x; 
+	depth.x=dofProj.y * -depth.y + depth.x;
+	depth.x=1.0/depth.x;
+
+	depth.y=depth.z * depth.x;
+
+	depth.x=depth.z * depth.x - dofDist.y; 
+	depth.x+=dofDist.x * -0.5;
+
+	depth.x=max(depth.x, 0.0);
+		
+	return depth.x;
+}
+
+float4 PS_ReadFocus(VS_OUTPUT_POST IN) : COLOR
+{
+
+//++++++++++++++++++++++++++++++++++++++++++++
+
+float FocusPoint =lerp( lerp( FocusPointDay, FocusPointNight, 1 - ENightDayFactor ), FocusPointInterior, EInteriorFactor);
+	float2 uvsrc=FocusPoint;
+
+	float2 pixelSize=ScreenSize.y;
+	pixelSize.y*=ScreenSize.z;
+
+#ifdef USE_TIGHT_OFFSETS
+	const float2 offset[4] = 
+	{
+		float2(0.262, 0.641),
+		float2(0.262, -0.641),
+		float2(0.641, 0.262),
+		float2(-0.641, 0.262)
+	};
+#endif
+
+#ifdef USE_CENTERED_OFFSETS
+	const float2 offset[4] = 
+	{
+		float2(0.5, 1.0),
+		float2(0.5, -1.0),
+		float2(1.0, 0.5),
+		float2(-1.0, 0.5)
+	};
+#endif
+
+#ifdef USE_REGULAR_OFFSETS
+	const float2 offset[4] = 
+	{
+		float2(0.3, 0.9),
+		float2(0.3, -0.9),
+		float2(0.9, 0.3),
+		float2(-0.9, 0.3)
+	};
+#endif
+
+#ifdef USE_ORIGINAL_OFFSETS
+	const float2 offset[4]=
+	{
+		float2(0.0, 1.0),
+		float2(0.0, -1.0),
+		float2(1.0, 0.0),
+		float2(-1.0, 0.0)
+	};
+#endif
+
+#ifdef USE_WIDE_OFFSETS	
+	const float2 offset[4]=
+	{
+		float2(0.524, 1.282),
+		float2(0.524, -1.282),
+		float2(1.282, 0.524),
+		float2(-1.282, 0.524)
+	};	
+#endif
+
+#ifdef USE_NATURAL_OFFSETS
+	const float2 offset[16] = { 
+	float2(0.2007, 0.9796),
+	float2(-0.2007, 0.9796), 
+	float2(0.2007, 0.9796),
+	float2(-0.2007, 0.9796), 
+		
+	float2(0.8240, 0.5665),
+	float2(0.5665, 0.8240),
+	float2(0.8240, 0.5665),
+	float2(0.5665, 0.8240),
+
+	float2(0.9796, 0.2007),
+	float2(0.9796, -0.2007),
+	float2(0.9796, 0.2007),
+	float2(0.9796, -0.2007),
+		
+	float2(-0.8240, 0.5665),
+	float2(-0.5665, 0.8240),
+	float2(-0.8240, 0.5665),
+	float2(-0.5665, 0.8240)
+};			
+#endif	
+
+	float res=linearlizeDepth(tex2D(SamplerDepth, uvsrc.xy).x);
+	for (int i=0; i<4; i++)
+	{
+		uvsrc.xy=uvsrc.xy;
+
+		float FocusSampleRange =lerp( lerp( FocusSampleRangeDay, FocusSampleRangeNight, 1 - ENightDayFactor ), FocusSampleRangeInterior, EInteriorFactor);
+		uvsrc.xy+=offset[i] * pixelSize.xy * FocusSampleRange;
+
+float DepthClip =lerp( lerp( DepthClipDay, DepthClipNight, 1 - ENightDayFactor ), DepthClipInterior, EInteriorFactor);
+
+		#ifdef NOT_BLURRING_SKY_MODE
+			res+=linearlizeDepth(tex2D(SamplerDepth, uvsrc).x);
+		#else
+			res+=min(linearlizeDepth(tex2D(SamplerDepth, uvsrc).x), DepthClip);
+		#endif
+	}
+	res*=0.2;	//.21	//.22
+	return res;
+}
+
+float4 PS_WriteFocus(VS_OUTPUT_POST IN) : COLOR
+{
+float FocusPoint =lerp( lerp( FocusPointDay, FocusPointNight, 1 - ENightDayFactor ), FocusPointInterior, EInteriorFactor);
+	float2 uvsrc=FocusPoint;
+
+	float res=0.0;
+	float curr=tex2D(SamplerCurr, uvsrc.xy).x;
+	float prev=tex2D(SamplerPrev, uvsrc.xy).x;
+
+	
+	res=lerp(prev, curr, saturate(FadeFactor));//time elapsed factor
+
+	return res;
+}
+
+technique ReadFocus
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_Focus();
+		PixelShader  = compile ps_3_0 PS_ReadFocus();
+
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique WriteFocus
+{
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_Focus();
+		PixelShader  = compile ps_3_0 PS_WriteFocus();
+
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+VS_OUTPUT_POST VS_PostProcess(VS_INPUT_POST IN)
+{
+	VS_OUTPUT_POST OUT;
+
+	float4 pos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
+
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+
+	return OUT;
+}
+
+float4 PS_ProcessPass1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+	float scenedepth=tex2D(SamplerDepth, IN.txcoord.xy).x;
+	float scenefocus=tex2D(SamplerFocus, 0.5).x;
+	res.xyz=origcolor.xyz;
+
+	float depth=linearlizeDepth(scenedepth);
+
+float FarBlurCurve =lerp( lerp( FarBlurCurveDay, FarBlurCurveNight, 1 - ENightDayFactor ), FarBlurCurveInterior, EInteriorFactor);
+float FocalPlaneDepth =lerp( lerp( FocalPlaneDepthDay, FocalPlaneDepthNight, 1 - ENightDayFactor ), FocalPlaneDepthInterior, EInteriorFactor);
+float FarBlurDepth =lerp( lerp( FarBlurDepthDay, FarBlurDepthNight, 1 - ENightDayFactor ), FarBlurDepthInterior, EInteriorFactor);
+
+	#ifdef AUTO_FOCUS
+		float focalPlaneDepth=scenefocus;
+		float farBlurDepth=scenefocus*pow(4.0, FarBlurCurve);
+	#else
+		float focalPlaneDepth=FocalPlaneDepth;
+		float farBlurDepth=FarBlurDepth;
+	#endif
+	
+	#ifdef TILT_SHIFT
+float TiltShiftAngle =lerp( lerp( TiltShiftAngleDay, TiltShiftAngleNight, 1 - ENightDayFactor ), TiltShiftAngleInterior, EInteriorFactor);
+		float shiftAngle=(frac(TiltShiftAngle / 90.0) == 0) ? 0.0 : TiltShiftAngle;
+		float depthShift=1.0 + (0.5 - coord.x)*tan(-shiftAngle * 0.017453292);
+		focalPlaneDepth*=depthShift;
+		farBlurDepth*=depthShift;
+	#endif
+	
+	
+	if(depth < focalPlaneDepth)
+		res.w=(depth - focalPlaneDepth)/focalPlaneDepth;
+	else
+	{
+		res.w=(depth - focalPlaneDepth)/(farBlurDepth - focalPlaneDepth);
+		res.w=saturate(res.w);
+	}
+
+	res.w=res.w * 0.5 + 0.5;
+	
+	#ifdef NOT_BLURRING_SKY_MODE
+		#define	DEPTH_OF_FIELD_QUALITY 2	//[KYO : why 0 ?]
+		//#define DEPTH_OF_FIELD_QUALITY 0
+		res.w=(depth > 1000.0) ? 0.5 : res.w;
+	#endif
+	
+	return res;
+}
+
+float4 PS_ProcessPass2(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float4 res;
+	
+	float2 coord=IN.txcoord.xy;
+
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+	
+	float centerDepth=origcolor.w;
+
+	
+	float2 pixelSize=ScreenSize.y;
+	pixelSize.y*=ScreenSize.z;
+	
+	float blurAmount=abs(centerDepth * 2.0 - 1.0);
+	float discRadius=blurAmount * float(DEPTH_OF_FIELD_QUALITY);
+
+float RadiusScaleMultiplier =lerp( lerp( RadiusScaleMultiplierDay, RadiusScaleMultiplierNight, 1 - ENightDayFactor ), RadiusScaleMultiplierInterior, EInteriorFactor);	
+float NearBlurCurve =lerp( lerp( NearBlurCurveDay, NearBlurCurveNight, 1 - ENightDayFactor ), NearBlurCurveInterior, EInteriorFactor);
+float BokehBias =lerp( lerp( BokehBiasDay, BokehBiasNight, 1 - ENightDayFactor ), BokehBiasInterior, EInteriorFactor);
+float BokehBrightnessThreshold =lerp( lerp( BokehBrightnessThresholdDay, BokehBrightnessThresholdNight, 1 - ENightDayFactor ), BokehBrightnessThresholdInterior, EInteriorFactor);
+float BokehBrightnessMultiplier =lerp( lerp( BokehBrightnessMultiplierDay, BokehBrightnessMultiplierNight, 1 - ENightDayFactor ), BokehBrightnessMultiplierInterior, EInteriorFactor);
+float BokehBiasCurve =lerp( lerp( BokehBiasCurveDay, BokehBiasCurveNight, 1 - ENightDayFactor ), BokehBiasCurveInterior, EInteriorFactor);
+	
+	discRadius*=RadiusScaleMultiplier;
+	
+	#ifdef AUTO_FOCUS
+	discRadius*=(centerDepth < 0.5) ? (1.0 / max(NearBlurCurve, 1.0)) : 1.0;
+	#endif
+		
+	res.xyz=origcolor.xyz;
+	res.w=dot(res.xyz, 0.3333);
+	res.w=max((res.w - BokehBrightnessThreshold) * BokehBrightnessMultiplier, 0.0);
+	res.xyz*=1.0 + res.w*blurAmount;
+	
+	res.w=1.0;
+	
+	int sampleCycle=0;
+	int sampleCycleCounter=0;
+	int sampleCounterInCycle=0;
+	
+	#ifdef POLYGONAL_BOKEH
+		float basedAngle=360.0 / POLYGON_NUM;
+		float2 currentVertex;
+		float2 nextVertex;
+	
+		int	dofTaps=DEPTH_OF_FIELD_QUALITY * (DEPTH_OF_FIELD_QUALITY + 1) * POLYGON_NUM / 2.0;
+	#else
+		int	dofTaps=DEPTH_OF_FIELD_QUALITY * (DEPTH_OF_FIELD_QUALITY + 1) * 4;
+	#endif
+		
+	
+	for(int i=0; i < dofTaps; i++)
+	{
+		if(sampleCounterInCycle % sampleCycle == 0) 
+		{
+			sampleCounterInCycle=0;
+			sampleCycleCounter++;
+		
+			#ifdef POLYGONAL_BOKEH
+				sampleCycle+=POLYGON_NUM;
+				currentVertex.xy=float2(1.0 , 0.0);
+				sincos(basedAngle* 0.017453292, nextVertex.y, nextVertex.x);	
+			#else	
+				sampleCycle+=8;
+			#endif
+		}
+		sampleCounterInCycle++;
+		
+		#ifdef POLYGONAL_BOKEH
+			float sampleAngle=basedAngle / float(sampleCycleCounter) * sampleCounterInCycle;
+			float remainAngle=frac(sampleAngle / basedAngle) * basedAngle;
+		
+			if(remainAngle == 0)
+			{
+				currentVertex=nextVertex;
+				sincos((sampleAngle +  basedAngle) * 0.017453292, nextVertex.y, nextVertex.x);
+			}
+
+			float2 sampleOffset=lerp(currentVertex.xy, nextVertex.xy, remainAngle / basedAngle);
+		#else
+			float sampleAngle=0.78539816 / float(sampleCycleCounter) * sampleCounterInCycle;
+			float2 sampleOffset;
+			sincos(sampleAngle, sampleOffset.y, sampleOffset.x);
+		#endif
+		
+		sampleOffset*=sampleCycleCounter / float(DEPTH_OF_FIELD_QUALITY);
+		float2  coordLow=coord.xy + (pixelSize.xy * sampleOffset.xy * discRadius);
+		float4 tap=tex2D(SamplerColor, coordLow.xy);
+		
+		float weight=(tap.w >= centerDepth) ? 1.0 : abs(tap.w * 2.0 - 1.0);
+		
+		float luma=dot(tap.xyz, 0.3333);
+		float brightMultiplier=max((luma - BokehBrightnessThreshold) * BokehBrightnessMultiplier, 0.0);
+		tap.xyz*=1.0 + brightMultiplier*abs(tap.w*2.0 - 1.0);
+		
+		tap.xyz*=1.0 + BokehBias * pow(float(sampleCycleCounter)/float(DEPTH_OF_FIELD_QUALITY), BokehBiasCurve);
+		
+	    res.xyz+=tap.xyz * weight;
+	    res.w+=weight;
+	}
+
+	res.xyz /= res.w;
+		
+	res.w=centerDepth;
+
+
+	return res;
+}
+
+float4 PS_ProcessPass3(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+float RadiusScaleMultiplier =lerp( lerp( RadiusScaleMultiplierDay, RadiusScaleMultiplierNight, 1 - ENightDayFactor ), RadiusScaleMultiplierInterior, EInteriorFactor);	
+
+	float2 coord=IN.txcoord.xy;	
+	float2 pixelSize=ScreenSize.y;
+	pixelSize.y*=ScreenSize.z;
+	
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+	float depth=origcolor.w;
+	float blurAmount=abs(depth * 2.0 - 1.0);
+	float discRadius=blurAmount * float(DEPTH_OF_FIELD_QUALITY) * RadiusScaleMultiplier;
+
+float NearBlurCurve =lerp( lerp( NearBlurCurveDay, NearBlurCurveNight, 1 - ENightDayFactor ), NearBlurCurveInterior, EInteriorFactor);	
+
+	#ifdef AUTO_FOCUS
+		discRadius*=(depth < 0.5) ? (1.0 / max(NearBlurCurve, 1.0)) : 1.0;
+	#endif
+	
+	float4 res=origcolor;
+
+	float3 distortion=float3(-1.0, 0.0, 1.0);
+float ChromaticAberrationAmount =lerp( lerp( ChromaticAberrationAmountDay, ChromaticAberrationAmountNight, 1 - ENightDayFactor ), ChromaticAberrationAmountInterior, EInteriorFactor);
+
+	distortion*=ChromaticAberrationAmount*discRadius;
+
+	origcolor=tex2D(SamplerColor, coord.xy + pixelSize.xy*distortion.x);
+	origcolor.w=smoothstep(0.0, depth, origcolor.w);
+	res.x=lerp(res.x, origcolor.x, origcolor.w);
+	
+	origcolor=tex2D(SamplerColor, coord.xy + pixelSize.xy*distortion.z);
+	origcolor.w=smoothstep(0.0, depth, origcolor.w);
+	res.z=lerp(res.z, origcolor.z, origcolor.w);
+
+	return res;
+}
+
+float4 PS_ProcessPass4(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float2 coord=IN.txcoord.xy;
+	
+	float2 pixelSize=ScreenSize.y;
+	pixelSize.y*=ScreenSize.z;
+	
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+	float depth=origcolor.w;
+	float blurAmount=abs(depth*2.0 - 1.0);
+
+float NearBlurCurve =lerp( lerp( NearBlurCurveDay, NearBlurCurveNight, 1 - ENightDayFactor ), NearBlurCurveInterior, EInteriorFactor);	
+
+	#if (DEPTH_OF_FIELD_QUALITY > 0)
+		#ifdef AUTO_FOCUS
+			blurAmount*=(depth < 0.5) ? (1.0 / max(NearBlurCurve, 1.0)) : 1.0;
+		#endif
+		blurAmount=smoothstep(0.15, 1.0, blurAmount);
+	#endif
+	
+	float weight[5] = {0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 
+		0.0162162162};
+	
+	float4 res=origcolor * weight[0];
+	
+	for(int i=1; i < 5; i++)
+	{
+		res+=tex2D(SamplerColor, coord.xy + float2(i*pixelSize.x*blurAmount, 0)) * weight[i];
+		res+=tex2D(SamplerColor, coord.xy - float2(i*pixelSize.x*blurAmount, 0)) * weight[i];
+	}
+	
+	res.w=depth;
+	
+	return res;
+}
+
+float4 PS_ProcessPass5(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
+{
+	float2 coord=IN.txcoord.xy;
+	
+	float2 pixelSize=ScreenSize.y;
+	pixelSize.y*=ScreenSize.z;
+		
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+	float depth=origcolor.w;
+	float blurAmount=abs(depth*2.0 - 1.0);
+
+float NearBlurCurve =lerp( lerp( NearBlurCurveDay, NearBlurCurveNight, 1 - ENightDayFactor ), NearBlurCurveInterior, EInteriorFactor);
+	
+	#if (DEPTH_OF_FIELD_QUALITY > 0)
+		#ifdef AUTO_FOCUS
+			blurAmount*=(depth < 0.5) ? (1.0 / max(NearBlurCurve, 1.0)) : 1.0;
+		#endif
+		blurAmount=smoothstep(0.15, 1.0, blurAmount);
+	#endif
+	
+	float weight[5] = {0.2270270270, 0.1945945946, 0.1216216216, 0.0540540541, 
+		0.0162162162};
+	float4 res=origcolor * weight[0];
+
+	for(int i=1; i < 5; i++)
+	{
+		res+=tex2D(SamplerColor, coord.xy + float2(0, i*pixelSize.y*blurAmount)) * weight[i];
+		res+=tex2D(SamplerColor, coord.xy - float2(0, i*pixelSize.y*blurAmount)) * weight[i];
+	}
+	
+	float origgray=dot(res.xyz, 0.3333);
+	origgray/=origgray + 1.0;
+	coord.xy=IN.txcoord.xy*16.0 + origgray;
+	float4 cnoi=tex2D(SamplerNoise, coord);
+	float noiseAmount=NoiseAmount*pow(blurAmount, NoiseCurve);
+	//res=lerp(res, (cnoi.x+0.5)*res, noiseAmount*saturate(1.0-origgray*1.8));	
+	//res=lerp(res, (cnoi.x+0.5)*res, noiseAmount*saturate(1.0-origgray*0.5));
+
+float NoiseDiffusion =lerp( lerp( NoiseDiffusionDay, NoiseDiffusionNight, 1 - ENightDayFactor ), NoiseDiffusionInterior, EInteriorFactor);
+
+	res=lerp(res, (cnoi.x+0.5)*res, noiseAmount*saturate(1.0-origgray*NoiseDiffusion));	
+	
+	res.w=depth;
+		
+	return res;
+}
+
+technique PostProcess
+{
+	pass P0
+	{
+
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessPass1();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+
+technique PostProcess2
+{
+	pass P0
+	{
+
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessPass2();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+
+technique PostProcess3
+{
+	pass P0
+	{
+
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessPass3();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+
+technique PostProcess4
+{
+	pass P0
+	{
+
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessPass4();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+technique PostProcess5
+{
+	pass P0
+	{
+
+		VertexShader = compile vs_3_0 VS_PostProcess();
+		PixelShader  = compile ps_3_0 PS_ProcessPass5();
+
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		AlphaBlendEnable=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+}
+
+//+++++++++++++++++++++++++++
+//Modified by Unreal Warfare
+//+++++++++++++++++++++++++++

BIN
Game Folder/enbpalette.bmp


BIN
Game Folder/enbraindrops.tga


+ 201 - 0
Game Folder/enbseries.ini

@@ -0,0 +1,201 @@
+[PROXY]
+EnableProxyLibrary=true
+InitProxyFunctions=true
+ProxyLibrary=sweetfx_d3d9
+
+[GLOBAL]
+AdditionalConfigFile=
+UseEffect=true
+ForceNVidiaCard=true
+ForceNVidiaCaps=true
+
+[GAME]
+SpeedHack=false
+
+[MULTIHEAD]
+ForceVideoAdapterIndex=false
+VideoAdapterIndex=0
+
+[LIMITER]
+WaitBusyRenderer=false
+EnableFPSLimit=false
+FPSLimit=58.0
+
+[INPUT]
+//back
+KeyReadConfig=8
+//shift
+KeyCombination=16
+//f12
+KeyUseEffect=123
+//home
+KeyFPSLimit=36
+//num /       106
+KeyShowFPS=106
+//insert
+KeyScreenshot=45
+KeyToggleEditor=13
+
+[ENGINE]
+ForceAnisotropicFiltering=true
+MaxAnisotropy=8
+SkipShaderOptimization=false
+
+[EFFECT]
+UseOriginalPostProcessing=false
+UseOriginalObjectsProcessing=false
+EnableBloom=true
+EnableAdaptation=true
+EnableDepthOfField=true
+EnableAmbientOcclusion=true
+EnableSunRays=true
+EnableShadowBlurring=false
+EnableDetailedShadow=true
+
+[ANTIALIASING]
+EnableEdgeAA=true
+
+[BLOOM]
+Quality=0
+AmountDay=0.5
+AmountNight=0.5
+AmountInterior=0.5
+//
+ContrastDay=1.58
+ContrastNight=1.58
+ContrastInterior=1.58
+//
+BlueShiftAmountDay=5.57
+BlueShiftAmountNight=5.57
+BlueShiftAmountInterior=5.57
+
+[CAMERAFX]
+LenzReflectionIntensityDay=1.09
+LenzReflectionIntensityNight=1.09
+LenzReflectionPowerDay=1.7
+LenzReflectionPowerNight=2.0
+LenzReflectionIntensityInterior=1.59
+LenzReflectionPowerInterior=2.1
+
+[SSAO_SSIL]
+UseIndirectLighting=true
+SamplingQuality=0
+SamplingRange=0.7
+FadeFogRangeDay=1.0
+FadeFogRangeNight=1.0
+SizeScale=0.5
+SourceTexturesScale=0.76
+FilterQuality=1
+AOAmount=3.45
+ILAmount=1.0
+AOAmountInterior=1.0
+ILAmountInterior=1.0
+AOIntensity=1.44
+AOIntensityInterior=1.0
+AOType=1
+AOMixingType=5
+AOMixingTypeInterior=5
+
+[NIGHTDAY]
+DetectorDefaultDay=false
+DetectorLevelDay=0.65
+DetectorLevelNight=0.25
+DetectorLevelCurve=2.0
+
+[ADAPTATION]
+ForceMinMaxValues=true
+AdaptationSensitivity=0.0
+AdaptationTime=0.25
+AdaptationMin=0.0
+AdaptationMax=0.25
+
+[ENVIRONMENT]
+//0.8
+LightingIntensityInterior=0.7
+LightingIntensityDay=0.7
+LightingIntensityNight=0.7
+//0.96
+LightingCurveInterior=0.8
+LightingCurveDay=0.8
+LightingCurveNight=0.8
+//
+LightingDesaturationInterior=0.0
+LightingDesaturationDay=0.0
+LightingDesaturationNight=0.0
+//0.8
+AmbientLightingIntensityInterior=0.45
+AmbientLightingIntensityDay=0.45
+AmbientLightingIntensityNight=0.45
+//
+AmbientLightingCurveInterior=1.0
+AmbientLightingCurveDay=1.0
+AmbientLightingCurveNight=1.0
+AmbientLightingDesaturationInterior=0.0
+AmbientLightingDesaturationDay=0.0
+AmbientLightingDesaturationNight=0.0
+//1.0
+FogColorMultiplierInterior=0.87
+FogColorMultiplierNight=1.0
+FogColorMultiplierDay=1.0
+//1.75
+FogColorCurveInterior=1.25
+FogColorCurveDay=1.0
+FogColorCurveNight=1.0
+
+[SKY]
+Enable=true
+GradientIntensityDay=0.75
+GradientIntensityNight=0.75
+GradientDesaturationDay=0.0
+GradientDesaturationNight=0.0
+GradientTopIntensityDay=0.75
+GradientTopIntensityNight=0.75
+GradientTopCurveDay=1.25
+GradientTopCurveNight=1.25
+GradientMiddleIntensityDay=0.75
+GradientMiddleIntensityNight=0.75
+GradientMiddleCurveDay=1.25
+GradientMiddleCurveNight=1.25
+GradientHorizonIntensityDay=0.75
+GradientHorizonIntensityNight=0.75
+GradientHorizonCurveDay=1.25
+GradientHorizonCurveNight=1.25
+CloudsIntensityDay=1.25
+CloudsIntensityNight=1.25
+CloudsCurveDay=0.75
+CloudsCurveNight=0.75
+CloudsDesaturationDay=0.0
+CloudsDesaturationNight=0.0
+CloudsEdgeClamp=0.0
+CloudsEdgeIntensity=0.0
+SunIntensity=5.0
+SunDesaturation=0.0
+SunCoronaIntensity=0.001
+SunCoronaCurve=0.1
+SunCoronaDesaturation=0.0
+StarsIntensity=2.5
+StarsCurve=1.25
+MoonIntensity=1.25
+MoonCurve=0.75
+MoonDesaturation=0.0
+
+[COLORCORRECTION]
+UsePaletteTexture=true
+Brightness=0.91
+GammaCurve=1.4
+
+[DEPTHOFFIELD]
+FadeTime=0.3
+
+[RAYS]
+SunRaysMultiplier=1.03
+
+[FIRE]
+IntensityInteriorDay=0.93
+IntensityInteriorNight=0.76
+IntensityDay=0.91
+IntensityNight=0.91
+CurveInteriorDay=0.89
+CurveInteriorNight=0.88
+CurveDay=0.82
+CurveNight=0.82

+ 4804 - 0
Game Folder/enbsunsprite.fx

@@ -0,0 +1,4804 @@
+//	K ENB Extensive Shaders  
+//	Extensive Sunsprite Shader 
+//	Code modifications by KYO aka Oyama w/some help from Boris ;)
+//	Sunglare Technique Vertex Codes by Matso
+//	Initial Lens Distortion Code by IceLaGlace
+//	Sunglare and Lens Textures by --JawZ--
+//	Copyright (c) 2007-2013 Boris Vorontsov
+//	Hexagons and High Dispersion Sunglare
+//
+//	KYO : * DISABLE * USE_SUNGLARE below if using another .tga texture
+
+//====================================================================================================
+//	Internal parameters covering all Techniques
+//====================================================================================================
+
+#define	 fLensIntensity		0.865	//Will affect all Lenses and all Draw Techniques at once		
+#define	 fLensScaleFactor	0.288	//Will affect all Lenses and all Draw techniques at once		
+
+//1.0, 0.75, 0.66, 0.5, 0.25, 0.33, 0.322, so on
+
+
+//====================================================================================================
+//	Usefull Constants
+//====================================================================================================
+
+#define PI			3.1415926535897932384626433832795
+
+
+//====================================================================================================
+//	Enable / Disable full lines of lenses a/o Sunglare 
+//	1 to enable, 0 to disable
+//	Choose 1 PRIMARY method *ONLY* at a time
+//====================================================================================================
+
+#define USE_PRIMARY				1	//11 Lenses w/Color variations		
+#define USE_PRIMARY_ALT				0	//18 Lenses w/Color Variations
+#define USE_PRIMARY_ALT_2			0	//4  Lenses w/Color Variations
+
+#define USE_SUNGLARE				1	//3  Lenses w/Color Variations //* disable for other .tga textures *
+
+#define	USE_SECONDARY				1	//11 Lenses	
+#define USE_SECONDARY_2				0	//11 Lenses	
+
+#define USE_THIRDARY				0	//11 Lenses	
+#define USE_THIRDARY_2				0	//11 Lenses	
+
+#define USE_FOURTH				1	//3 Lenses w/Color Variations	
+#define USE_FOURTH_2				1	//3 Lenses w/Color Variations
+
+
+//====================================================================================================
+//	Enable / Disable Time-Related Sunglare Dispersion Rays Length 
+//	1 to enable, 0 to disable
+//====================================================================================================
+
+#define USE_DISPERSION_BOOST		0			
+#define	fBoost_Sunglare			1.0					
+
+
+//====================================================================================================
+//	Enable / Disable Lens Distortions w/Chromatic Aberration on Edges 
+//	Pointless for Sunglare
+//	1 to enable, 0 to disable
+//	Positive Distortions will "compact" Lenses'Edges, making them "rounder"
+//	Negative Distortions will "enlarge" Lenses'Edges, making them "harder"
+//	Doing so, positive will decrease size, negative will increase
+//	Compensate both effects via LensSize
+//	If using positive distortion, increase LensSize to compensate
+//	If using negative distortion, decrease LensSize to compensate
+//====================================================================================================
+
+#define	USE_LENS_DISTORTIONS_PRIMARY		1
+#define	USE_LENS_DISTORTIONS_PRIMARY_ALT	1
+#define	USE_LENS_DISTORTIONS_PRIMARY_ALT_2	1
+
+#define	USE_LENS_DISTORTIONS_SECONDARY		1
+#define	USE_LENS_DISTORTIONS_SECONDARY_2	1
+
+#define	USE_LENS_DISTORTIONS_THIRDARY		1
+#define	USE_LENS_DISTORTIONS_THIRDARY_2		1
+
+#define	USE_LENS_DISTORTIONS_FOURTH		1
+#define	USE_LENS_DISTORTIONS_FOURTH_2		1
+
+#define USE_CHROMA_FORMULA_PRIMARY		7	//[Choose from 1 to 7]
+#define USE_CHROMA_FORMULA_PRIMARY_ALT		1	//[Choose from 1 to 7]
+#define USE_CHROMA_FORMULA_PRIMARY_ALT_2	1	//[Choose from 1 to 7]
+
+#define USE_CHROMA_FORMULA_SECONDARY		7	//[Choose from 1 to 7]
+#define USE_CHROMA_FORMULA_SECONDARY_2		7	//[Choose from 1 to 7]
+
+#define USE_CHROMA_FORMULA_THIRDARY		1	//[Choose from 1 to 7]
+#define USE_CHROMA_FORMULA_THIRDARY_2		1	//[Choose from 1 to 7]
+
+#define USE_CHROMA_FORMULA_FOURTH		1	//[Choose from 1 to 7]
+#define USE_CHROMA_FORMULA_FOURTH_2		2	//[Choose from 1 to 7]
+
+//====================================================================================================
+//	PRIMARY 
+#define fChromaticAmount_Primary		0.275 	
+#define fLensSize_Primary			0.775  	// 0.5 = Original Size
+#define fLensDistortion_Primary			2.0   	
+#define fLensDistortionCubic_Primary		0.0
+
+//====================================================================
+//	PRIMARY_ALT 
+#define fChromaticAmount_Primary_Alt		0.35 	
+#define fLensSize_Primary_Alt			0.75   	
+#define fLensDistortion_Primary_Alt		2.0   	
+#define fLensDistortionCubic_Primary_Alt	0.0
+
+//====================================================================
+//	PRIMARY_ALT_2
+#define fChromaticAmount_Primary_Alt_2		0.25 	
+#define fLensSize_Primary_Alt_2			0.7   
+#define fLensDistortion_Primary_Alt_2		1.75  	
+#define fLensDistortionCubic_Primary_Alt_2	0.2
+
+//====================================================================
+//	SECONDARY 
+#define fChromaticAmount_Secondary		0.25 	
+#define fLensSize_Secondary			0.5   	
+#define fLensDistortion_Secondary		0.0   	
+#define fLensDistortionCubic_Secondary		0.0
+
+//====================================================================
+//	SECONDARY_2 
+#define fChromaticAmount_Secondary_2		0.25 	
+#define fLensSize_Secondary_2			0.5   	
+#define fLensDistortion_Secondary_2		0.0   	
+#define fLensDistortionCubic_Secondary_2	0.0
+
+//====================================================================
+//	THIRDARY
+#define fChromaticAmount_Thirdary		0.25 	
+#define fLensSize_Thirdary			0.5   	
+#define fLensDistortion_Thirdary		0.0   	
+#define fLensDistortionCubic_Thirdary		0.0
+
+//====================================================================
+//	THIRDARY_2
+#define fChromaticAmount_Thirdary_2		0.25 	
+#define fLensSize_Thirdary_2			0.5   	
+#define fLensDistortion_Thirdary_2		0.0   	
+#define fLensDistortionCubic_Thirdary_2		0.0
+
+//====================================================================
+//	FOURTH 
+#define fChromaticAmount_Fourth			0.25 	
+#define fLensSize_Fourth			0.7   	
+#define fLensDistortion_Fourth			2.0  	
+#define fLensDistortionCubic_Fourth		0.0
+
+//====================================================================
+//	FOURTH_2 
+#define fChromaticAmount_Fourth_2		0.25 	
+#define fLensSize_Fourth_2			0.75   	
+#define fLensDistortion_Fourth_2		2.1   	
+#define fLensDistortionCubic_Fourth_2		0.0
+
+
+//====================================================================================================
+//	Enable / Disable RGB Variations
+//	RGB components vary accordingly to R/G/B multipliers below in Individual Parameters
+//	1 to enable, 0 to disable
+//====================================================================================================
+
+#define USE_RGB_VARIATIONS_PRIMARY		1		
+#define	USE_RGB_VARIATIONS_PRIMARY_ALT		1
+#define	USE_RGB_VARIATIONS_PRIMARY_ALT_2	1
+	
+#define USE_RGB_VARIATIONS_SUNGLARE		1
+
+#define	USE_RGB_VARIATIONS_FOURTH		1
+#define	USE_RGB_VARIATIONS_FOURTH_2		1
+
+
+//====================================================================================================
+//	Enable / Disable Time-Related Variable Scales 
+//	1 to enable, 0 to disable
+//	Higher is Faster
+//====================================================================================================
+
+#define	USE_SCALE_VARIATIONS__PRIMARY			1
+#define	fScaleTimeFactor_Primary			60.0
+	
+#define	USE_SCALE_VARIATIONS__PRIMARY_ALT		1
+#define	fScaleTimeFactor_Primary_Alt			80.0
+	
+#define	USE_SCALE_VARIATIONS__PRIMARY_ALT_2		1
+#define	fScaleTimeFactor_Primary_Alt_2			60.0
+	
+#define	USE_SCALE_VARIATIONS__SUNGLARE			1
+#define	fScaleTimeFactor_Sunglare			60.0
+
+#define	USE_SCALE_VARIATIONS__SECONDARY			1
+#define	fScaleTimeFactor_Secondary			70.0
+
+#define	USE_SCALE_VARIATIONS__SECONDARY_2		1
+#define	fScaleTimeFactor_Secondary_2			70.0
+
+#define	USE_SCALE_VARIATIONS__THIRDARY			1
+#define	fScaleTimeFactor_Thirdary			60.0
+
+#define	USE_SCALE_VARIATIONS__THIRDARY_2		1
+#define	fScaleTimeFactor_Thirdary_2			60.0
+
+#define	USE_SCALE_VARIATIONS__FOURTH			1
+#define	fScaleTimeFactor_Fourth				120.0
+
+#define	USE_SCALE_VARIATIONS__FOURTH_2			1
+#define	fScaleTimeFactor_Fourth_2			90.0			
+
+
+//====================================================================================================
+//	Enable / Disable Time-Related Variable Intensities
+//	1 to enable, 0 to disable
+//	Higher is Faster
+//	* NOTE * : DON'T USE VARIABLE INTENSITIES AND LIGHT EMULATION AT THE SAME TIME FOR SAME TARGET
+//====================================================================================================
+
+#define	USE_INTENSITY_VARIATIONS_PRIMARY		1
+#define	fIntTimeFactor_Primary				60.0
+
+#define	USE_INTENSITY_VARIATIONS_PRIMARY_ALT		1
+#define	fIntTimeFactor_Primary_Alt			60.0
+
+#define	USE_INTENSITY_VARIATIONS_PRIMARY_ALT_2		1
+#define	fIntTimeFactor_Primary_Alt_2			60.0
+
+#define	USE_INTENSITY_VARIATIONS_SUNGLARE		0
+#define	fIntTimeFactor_Sunglare				60.0
+
+#define	USE_INTENSITY_VARIATIONS_SECONDARY		0
+#define	fIntTimeFactor_Secondary			70.0
+
+#define	USE_INTENSITY_VARIATIONS_SECONDARY_2		1
+#define	fIntTimeFactor_Secondary_2			70.0
+
+#define	USE_INTENSITY_VARIATIONS_THIRDARY		0
+#define	fIntTimeFactor_Thirdary				60.0
+
+#define	USE_INTENSITY_VARIATIONS_THIRDARY_2		0
+#define	fIntTimeFactor_Thirdary_2			60.0
+
+#define	USE_INTENSITY_VARIATIONS_FOURTH			1
+#define	fIntTimeFactor_Fourth				80.0
+
+#define	USE_INTENSITY_VARIATIONS_FOURTH_2		1
+#define	fIntTimeFactor_Fourth_2				50.0
+
+
+//====================================================================================================
+//	Enable / Disable Light Emulation (Flashes or Pulses) 
+//	1 to enable, 0 to disable 
+//	Set Low Velocity for Pulses, High Velocity for Flashes
+//	0.0 to 1000.0 = Low
+//	0.0 to 10000.0 = Medium
+//	10000.0 and beyond = High
+//	* NOTE * : DON'T USE LIGHT EMULATION AND VARIABLE INTENSITIES AT THE SAME TIME FOR SAME TARGET
+//====================================================================================================
+	
+#define	USE_LIGHT_PRIMARY		0
+#define	USE_LIGHT_PRIMARY_ALT		0	
+#define	USE_LIGHT_PRIMARY_ALT_2		0
+
+#define	USE_LIGHT_SUNGLARE		0
+
+#define	USE_LIGHT_SECONDARY		1
+#define	USE_LIGHT_SECONDARY_2		0
+	
+#define	USE_LIGHT_THIRDARY		1	
+#define	USE_LIGHT_THIRDARY_2		1	
+
+#define	USE_LIGHT_FOURTH		0	
+#define	USE_LIGHT_FOURTH_2		0
+
+
+#define	fLightVelocity_Primary		2.0
+#define	fLightVelocity_Primary_Alt	2.0
+#define	fLightVelocity_Primary_Alt_2	2.0
+
+/**
+ *	Set high value for Velocity here and do NOT intervene on second part
+ */	
+#define	fLightVelocity_Sunglare 	12000.0 + abs(frac(Timer.x * 20000.0)* 2.0 - 1.0)	
+
+#define fLightVelocity_Secondary	20.0
+#define fLightVelocity_Secondary_2	20.0			
+					
+#define fLightVelocity_Thirdary		40.0			
+#define	fLightVelocity_Thirdary_2	20.0
+
+#define fLightVelocity_Fourth		40.0			
+#define	fLightVelocity_Fourth_2		20.0
+
+
+//====================================================================================================
+//	Enable / Disable Depth-Like Motion, full lines of Lenses 
+//	Motion from Eye to Sun and back
+//	1 to enable, 0 to disable
+//	Higher is Faster
+//====================================================================================================
+	
+#define USE_MOTION_PRIMARY		1
+#define USE_MOTION_PRIMARY_ALT		1
+#define USE_MOTION_PRIMARY_ALT_2	1
+
+#define USE_MOTION_SUNGLARE		0
+
+#define	USE_MOTION_SECONDARY		1
+#define USE_MOTION_SECONDARY_2		1
+		
+#define USE_MOTION_THIRDARY		1	
+#define USE_MOTION_THIRDARY_2		1	
+
+#define USE_MOTION_FOURTH		1	
+#define USE_MOTION_FOURTH_2		1	
+	
+
+#define	fVelocity_Primary		40.0
+#define	fVelocity_Primary_Alt		50.0
+#define	fVelocity_Primary_Alt_2		50.0
+
+#define	fVelocity_Sunglare		200.0
+
+#define	fVelocity_Secondary		35.0
+#define	fVelocity_Secondary_2		35.0
+
+#define	fVelocity_Thirdary		35.0
+#define	fVelocity_Thirdary_2		35.0
+
+#define	fVelocity_Fourth		50.0
+#define	fVelocity_Fourth_2		45.0
+	
+
+//====================================================================================================
+//	Enable / Disable Primary a/o Primary_Alt, Alt_2, etc... Per-Lenses Depth-Like Motion 
+//	1 to enable, 0 to disable 
+//	Positive = from Sun to Eye, Negative = from Eye to Sun
+//====================================================================================================
+
+#define	USE_LENSMOTION_PRIMARY	1	
+
+#define	fMotionVelocity_Lens26		-60.0	
+#define	fMotionVelocity_Lens27		100.0
+#define	fMotionVelocity_Lens28		-60.0
+#define	fMotionVelocity_Lens29		60.0
+#define	fMotionVelocity_Lens30		-60.0
+#define	fMotionVelocity_Lens31		60.0
+#define	fMotionVelocity_Lens32		-40.0
+#define	fMotionVelocity_Lens33		80.0
+#define	fMotionVelocity_Lens34		-120.0
+#define	fMotionVelocity_Lens35		100.0
+#define	fMotionVelocity_Lens36		-100.0
+
+#define	USE_LENSMOTION_PRIMARY_ALT	1	
+
+#define	fMotionVelocity_Lens59		-60.0	
+#define	fMotionVelocity_Lens60		40.0
+#define	fMotionVelocity_Lens61		-60.0
+#define	fMotionVelocity_Lens62		80.0
+#define	fMotionVelocity_Lens63		-100.0
+#define	fMotionVelocity_Lens64		60.0
+#define	fMotionVelocity_Lens65		-40.0
+#define	fMotionVelocity_Lens66		80.0
+#define	fMotionVelocity_Lens67		-80.0
+#define	fMotionVelocity_Lens68		80.0
+#define	fMotionVelocity_Lens69		-100.0
+#define	fMotionVelocity_Lens70		-60.0	
+#define	fMotionVelocity_Lens71		60.0
+#define	fMotionVelocity_Lens72		-80.0
+#define	fMotionVelocity_Lens73		80.0
+#define	fMotionVelocity_Lens74		-60.0
+#define	fMotionVelocity_Lens75		80.0
+#define	fMotionVelocity_Lens76		-60.0
+
+#define	USE_LENSMOTION_PRIMARY_ALT_2	1
+
+#define	fMotionVelocity_Lens77		-20.0	
+#define	fMotionVelocity_Lens78		20.0
+#define	fMotionVelocity_Lens79		-20.0
+#define	fMotionVelocity_Lens80		20.0	
+
+
+//====================================================================================================
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//	Internal Techniques Parameters - These affect whole lines
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+//====================================================================================================
+//	Scale multiply / compensate
+//	Intensity multiply / compensate
+//	Contrast - More is stronger opacity, also depends on Sun Intensity
+//	Line Horizontal Position - Negative values will displace to left, Positive to right
+//	Line Vertical Position - Negative values will displace to down, Positive to up 
+//	0.0 HPos is neutral, equal to Primaries
+//====================================================================================================
+
+//	PRIMARY 
+
+#define fScalePrimary			0.855		
+#define fIntensityPrimary		1.0		
+#define fContrastPrimary		1.0
+#define fHPosPrimary			0.0
+#define fVPosPrimary			0.0
+
+//	PRIMARY_ALT
+
+#define fScalePrimary_Alt		1.145		
+#define fIntensityPrimary_Alt		0.985		//1.045
+#define fContrastPrimary_Alt		0.9		//1.2
+#define fHPosPrimary_Alt		0.0		
+#define fVPosPrimary_Alt		0.25		//1.0 Displace	//0.25 Slight Displace	
+
+//	PRIMARY_ALT_2
+
+#define fScalePrimary_Alt_2		1.2		
+#define fIntensityPrimary_Alt_2		1.2
+#define fContrastPrimary_Alt_2		1.05
+#define fHPosPrimary_Alt_2		0.0		
+#define fVPosPrimary_Alt_2		0.0
+
+//===========================================
+//	SUNGLARE 
+
+#define fScaleSunglare			1.0	
+#define fIntensitySunglare		0.865	
+#define fContrastSunglare		1.025		//1.1 
+#define fHPosSunglare			0.0
+#define fVPosSunglare			0.0
+
+//===========================================
+//	SECONDARY 
+
+#define fScaleSecondary			0.235  		//0.215		
+#define fIntensitySecondary		0.725		
+#define fContrastSecondary		1.1		
+#define fHPosSecondary			9.0		
+#define fVPosSecondary			-10.0	
+
+//	SECONDARY_2 
+
+#define fScaleSecondary_2		0.215
+#define fIntensitySecondary_2		0.745
+#define fContrastSecondary_2		1.1	
+#define fHPosSecondary_2		-9.0		
+#define fVPosSecondary_2		10.0		
+
+//===========================================
+//	THIRDARY 
+
+#define fScaleThirdary			0.245		
+#define fIntensityThirdary		1.05			
+#define fContrastThirdary		1.2
+#define fHPosThirdary			-50.0		
+#define fVPosThirdary			50.0	
+
+//	THIRDARY_2 
+
+#define fScaleThirdary_2		0.245		
+#define fIntensityThirdary_2		1.135			
+#define fContrastThirdary_2		1.2
+#define fHPosThirdary_2			50.0		
+#define fVPosThirdary_2			50.0	
+
+//===========================================
+//	FOURTH 
+
+#define fScaleFourth			0.625		
+#define fIntensityFourth		0.875			
+#define fContrastFourth			1.0
+#define fHPosFourth			2.65		
+#define fVPosFourth			2.35	
+
+//	FOURTH_2 
+
+#define fScaleFourth_2			1.015		
+#define fIntensityFourth_2		1.025			
+#define fContrastFourth_2		1.0
+#define fHPosFourth_2			-2.0		
+#define fVPosFourth_2			-0.5
+
+
+//====================================================================================================
+//	Internal Individual Parameters for SECONDARY
+//	Offset, Scale, Scale Factor, Color RGB, Color Multiplier
+//	RGB balance will also act as a separate intensity control for each Lens 
+//	1.0, 1.0, 1.0 is full intensity / opacity
+//	If color components are below 1.0, Lens is losing opacity
+//	Counterbalance it by increasing f#_ColorMultiplier over 1.0		
+//====================================================================================================
+
+//Lens #1
+#define f1_LensOffset		-0.8				//Sun to Eye	
+#define f1_LensScale		0.083				//Size
+#define f1_LensFactor		1.0				//Multiplier for Size
+#define	f1_LensColor		float3(0.85, 0.85, 0.50)	//Color in RGB 
+#define	f1_ColorMultiplier	1.0				//Color Multiplier
+
+//Lens #2
+#define f2_LensOffset		-0.47	
+#define f2_LensScale		0.166
+#define f2_LensFactor		1.0	
+#define	f2_LensColor		float3(1.00, 0.95, 0.35)	
+#define	f2_ColorMultiplier	1.0
+
+//Lens #3
+#define f3_LensOffset		-0.14	
+#define f3_LensScale		0.212
+#define f3_LensFactor		1.0
+#define	f3_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f3_ColorMultiplier	1.0
+
+//Lens #4
+#define f4_LensOffset		0.14	
+#define f4_LensScale		0.249
+#define f4_LensFactor		0.75	
+#define	f4_LensColor		float3(0.25, 1.0, 0.75)	
+#define	f4_ColorMultiplier	1.2
+
+//Lens #5
+#define f5_LensOffset		0.47	
+#define f5_LensScale		0.332
+#define f5_LensFactor		1.0	
+#define	f5_LensColor		float3(1.0, 0.75, 0.25)
+#define	f5_ColorMultiplier	1.7
+
+//Lens #6
+#define f6_LensOffset		0.8	
+#define f6_LensScale		0.415
+#define f6_LensFactor		0.75	
+#define	f6_LensColor		float3(0.90, 0.30, 0.75)	
+#define	f6_ColorMultiplier	1.0
+
+//Lens #7
+#define f7_LensOffset		1.13	
+#define f7_LensScale		0.498
+#define f7_LensFactor		1.0	
+#define	f7_LensColor		float3(1.0, 0.70, 0.30)
+#define	f7_ColorMultiplier	1.2
+
+//Lens #8
+#define f8_LensOffset		1.46	
+#define f8_LensScale		0.581
+#define f8_LensFactor		0.5	
+#define	f8_LensColor		float3(0.25, 0.95, 0.45)	
+#define	f8_ColorMultiplier	1.5
+
+//Lens #9
+#define f9_LensOffset		1.79	
+#define f9_LensScale		0.581
+#define f9_LensFactor		0.85	
+#define	f9_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f9_ColorMultiplier	1.1
+
+//Lens #10
+#define f10_LensOffset		2.12	
+#define f10_LensScale		0.581
+#define f10_LensFactor		1.0	
+#define	f10_LensColor		float3(0.85, 0.55, 0.85)	
+#define	f10_ColorMultiplier	1.0
+
+//Lens #11
+#define f11_LensOffset		2.43	
+#define f11_LensScale		0.664
+#define f11_LensFactor		1.11	
+#define	f11_LensColor		float3(0.85, 0.85, 0.32)
+#define	f11_ColorMultiplier	1.1
+
+
+//Add or Remove additional Lenses controls here, as done above
+
+//====================================================================================================
+//	Internal Individual parameters for SUNGLARE 
+//	Time-Related RGB Multipliers
+//	f#_R is Lens red multiplier, f#_G is green, f#_B is blue
+//====================================================================================================
+
+#if (USE_RGB_VARIATIONS_SUNGLARE == 1)
+
+//Lens #12	
+#define	f12_LensScale		0.11
+#define	f12_LensColor		float3(1.0 + abs(frac(Timer.x * f12_R)* 2.0 - 1.0), 0.90 + abs(frac(Timer.x * f12_G)* 2.0 - 1.0), 0.30 + abs(frac(Timer.x * f12_B)* 2.0 - 1.0))
+#define	f12_ColorMultiplier 	1.1
+#define f12_R			2000.0		
+#define f12_G			6000.0
+#define f12_B			200.0
+
+//Lens #13
+#define f13_LensScale		0.33
+#define	f13_LensColor		float3(0.25 + abs(frac(Timer.x * f13_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f13_G)* 2.0 - 1.0), 0.25 + abs(frac(Timer.x * f13_B)* 2.0 - 1.0))	
+#define	f13_ColorMultiplier 	1.0
+#define f13_R			2000.0		
+#define f13_G			600.0
+#define f13_B			200.0
+
+//Lens #14
+#define f14_LensScale		0.66 
+#define	f14_LensColor		float3(0.85 + abs(frac(Timer.x * f14_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f14_G)* 2.0 - 1.0), 0.30 + abs(frac(Timer.x * f14_B)* 2.0 - 1.0))	
+#define	f14_ColorMultiplier 	1.0
+#define f14_R			6000.0		
+#define f14_G			7000.0
+#define f14_B			200.0
+
+
+#else
+
+
+//Lens #12
+#define	f12_LensScale		0.11
+#define	f12_LensColor		float3(1.0, 0.90, 0.30)
+#define	f12_ColorMultiplier 	1.1
+
+//Lens #13
+#define f13_LensScale		0.33
+#define	f13_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f13_ColorMultiplier 	1.0
+
+//Lens #14
+#define f14_LensScale		0.66 
+#define	f14_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f14_ColorMultiplier 	1.0
+
+#endif
+
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for SECONDARY 2
+//====================================================================================================
+
+//Lens #15
+#define f15_LensOffset		-0.8				//Sun to Eye	
+#define f15_LensScale		0.083				//Size 
+#define f15_LensFactor		1.0				//Multiplier for Size	
+#define	f15_LensColor		float3(0.75, 0.75, 0.50)	//Color in RGB 	
+#define	f15_ColorMultiplier	1.0				//Color Multiplier
+
+//Lens #16
+#define f16_LensOffset		-0.47	
+#define f16_LensScale		0.166
+#define f16_LensFactor		1.0	
+#define	f16_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f16_ColorMultiplier	1.0
+
+//Lens #17
+#define f17_LensOffset		-0.14	
+#define f17_LensScale		0.212
+#define f17_LensFactor		1.0
+#define	f17_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f17_ColorMultiplier	1.0
+
+//Lens #18
+#define f18_LensOffset		0.14	
+#define f18_LensScale		0.249
+#define f18_LensFactor		0.75	
+#define	f18_LensColor		float3(0.25, 1.0, 0.75)	
+#define	f18_ColorMultiplier	1.0
+
+//Lens #19
+#define f19_LensOffset		0.47	
+#define f19_LensScale		0.332
+#define f19_LensFactor		1.0	
+#define	f19_LensColor		float3(1.0, 0.85, 0.22)
+#define	f19_ColorMultiplier	2.0
+
+//Lens #20
+#define f20_LensOffset		0.8	
+#define f20_LensScale		0.415
+#define f20_LensFactor		0.75	
+#define	f20_LensColor		float3(0.90, 0.30, 0.75)	
+#define	f20_ColorMultiplier	1.0
+
+//Lens #21
+#define f21_LensOffset		1.13	
+#define f21_LensScale		0.498
+#define f21_LensFactor		1.0	
+#define	f21_LensColor		float3(1.0, 1.0, 1.0)
+#define	f21_ColorMultiplier	1.0
+
+//Lens #22
+#define f22_LensOffset		1.46	
+#define f22_LensScale		0.581
+#define f22_LensFactor		0.5	
+#define	f22_LensColor		float3(0.25, 0.95, 0.45)	
+#define	f22_ColorMultiplier	1.5
+
+//Lens #23
+#define f23_LensOffset		1.79	
+#define f23_LensScale		0.581
+#define f23_LensFactor		0.85	
+#define	f23_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f23_ColorMultiplier	1.0
+
+//Lens #24
+#define f24_LensOffset		2.12	
+#define f24_LensScale		0.581
+#define f24_LensFactor		1.0	
+#define	f24_LensColor		float3(0.95, 0.55, 0.85)	
+#define	f24_ColorMultiplier	1.0
+
+//Lens #25
+#define f25_LensOffset		2.43	
+#define f25_LensScale		0.664
+#define f25_LensFactor		1.11	
+#define	f25_LensColor		float3(0.75, 0.75, 0.42)
+#define	f25_ColorMultiplier	1.0
+
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for PRIMARY
+//	Time-Related RGB Multipliers
+//	f#_R is Lens red multiplier, f#_G is green, f#_B is blue
+//====================================================================================================
+
+#if (USE_RGB_VARIATIONS_PRIMARY == 1)
+
+//Lens #26
+#define f26_LensOffset		-0.8					
+#define f26_LensScale		0.083				
+#define f26_LensFactor		0.8				
+#define	f26_LensColor		float3(0.95  + abs(frac(Timer.x * f26_R)* 2.0 - 1.0), 0.82 + abs(frac(Timer.x * f26_G)* 2.0 - 1.0), 0.30 + abs(frac(Timer.x * f26_B)* 2.0 - 1.0))	
+#define	f26_ColorMultiplier	1.3				
+#define f26_R			2000.0		
+#define f26_G			200.0
+#define f26_B			4000.0
+
+//Lens #27
+#define f27_LensOffset		-0.47	
+#define f27_LensScale		0.166
+#define f27_LensFactor		1.0	
+#define	f27_LensColor		float3(0.85 + abs(frac(Timer.x * f27_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f27_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f27_B)* 2.0 - 1.0))	
+#define	f27_ColorMultiplier	1.0
+#define f27_R			2000.0		
+#define f27_G			200.0
+#define f27_B			200.0
+
+//Lens #28
+#define f28_LensOffset		-0.14	
+#define f28_LensScale		0.212
+#define f28_LensFactor		1.0
+#define	f28_LensColor		float3(1.0 + abs(frac(Timer.x * f28_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f28_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f28_B)* 2.0 - 1.0))	
+#define	f28_ColorMultiplier	1.0
+#define f28_R			200.0		
+#define f28_G			200.0
+#define f28_B			600.0
+
+//Lens #29
+#define f29_LensOffset		0.14	
+#define f29_LensScale		0.249
+#define f29_LensFactor		0.75	
+#define	f29_LensColor		float3(0.25 + abs(frac(Timer.x * f29_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f29_G)* 2.0 - 1.0), 0.55 + abs(frac(Timer.x * f29_B)* 2.0 - 1.0))	
+#define	f29_ColorMultiplier	1.8	
+#define f29_R			2000.0		
+#define f29_G			4000.0
+#define f29_B			6000.0			
+
+//Lens #30
+#define f30_LensOffset		0.47	
+#define f30_LensScale		0.332
+#define f30_LensFactor		1.0	
+#define	f30_LensColor		float3(1.0 + abs(frac(Timer.x * f30_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f30_G)* 2.0 - 1.0), 0.22 + abs(frac(Timer.x * f30_B)* 2.0 - 1.0))
+#define	f30_ColorMultiplier	1.5	
+#define f30_R			2000.0		
+#define f30_G			4000.0
+#define f30_B			200.0			
+
+//Lens #31
+#define f31_LensOffset		0.8	
+#define f31_LensScale		0.415
+#define f31_LensFactor		0.75	
+#define	f31_LensColor		float3(0.60 + abs(frac(Timer.x * f31_R)* 2.0 - 1.0), 0.60 + abs(frac(Timer.x * f31_G)* 2.0 - 1.0), 0.75 + abs(frac(Timer.x * f31_B)* 2.0 - 1.0))	
+#define	f31_ColorMultiplier	1.4
+#define f31_R			200.0		
+#define f31_G			1000.0
+#define f31_B			600.0				
+
+//Lens #32
+#define f32_LensOffset		1.13	
+#define f32_LensScale		0.498
+#define f32_LensFactor		1.0	
+#define	f32_LensColor		float3(1.0 + abs(frac(Timer.x * f32_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f32_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f32_B)* 2.0 - 1.0))
+#define	f32_ColorMultiplier	1.0
+#define f32_R			200.0		
+#define f32_G			2000.0
+#define f32_B			200.0
+
+//Lens #33
+#define f33_LensOffset		1.46	
+#define f33_LensScale		0.581
+#define f33_LensFactor		0.5	
+#define	f33_LensColor		float3(0.25 + abs(frac(Timer.x * f33_R)* 2.0 - 1.0), 0.95 + abs(frac(Timer.x * f33_G)* 2.0 - 1.0), 0.35 + abs(frac(Timer.x * f33_B)* 2.0 - 1.0))	
+#define	f33_ColorMultiplier	1.6	
+#define f33_R			4000.0		
+#define f33_G			200.0
+#define f33_B			200.0			
+
+//Lens #34
+#define f34_LensOffset		1.79	
+#define f34_LensScale		0.581
+#define f34_LensFactor		0.85	
+#define	f34_LensColor		float3(1.0 + abs(frac(Timer.x * f34_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f34_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f34_B)* 2.0 - 1.0))	
+#define	f34_ColorMultiplier	1.0
+#define f34_R			20.0		
+#define f34_G			200.0
+#define f34_B			20.0
+
+//Lens #35
+#define f35_LensOffset		2.12	
+#define f35_LensScale		0.581
+#define f35_LensFactor		1.0	
+#define	f35_LensColor		float3(0.7 + abs(frac(Timer.x * f35_R)* 2.0 - 1.0), 0.7 + abs(frac(Timer.x * f35_G)* 2.0 - 1.0), 0.7 + abs(frac(Timer.x * f35_B)* 2.0 - 1.0))	
+#define	f35_ColorMultiplier	1.0
+#define f35_R			200.0		
+#define f35_G			200.0
+#define f35_B			200.0
+
+//Lens #36
+#define f36_LensOffset		2.43	
+#define f36_LensScale		0.664
+#define f36_LensFactor		1.11	
+#define	f36_LensColor		float3(0.95 + abs(frac(Timer.x * f36_R)* 2.0 - 1.0), 0.95 + abs(frac(Timer.x * f36_G)* 2.0 - 1.0), 0.62 + abs(frac(Timer.x * f36_B)* 2.0 - 1.0))
+#define	f36_ColorMultiplier	1.0
+#define f36_R			200.0		
+#define f36_G			1000.0
+#define f36_B			20.0
+
+#else
+
+//Lens #26
+#define f26_LensOffset		-0.8				//Sun to Eye	
+#define f26_LensScale		0.083				//Size 
+#define f26_LensFactor		0.8				//Multiplier for Size	
+#define	f26_LensColor		float3(0.95, 0.82, 0.30)	//Color in RGB	
+#define	f26_ColorMultiplier	1.5				//Color Multiplier
+
+//Lens #27
+#define f27_LensOffset		-0.47	
+#define f27_LensScale		0.166
+#define f27_LensFactor		1.0	
+#define	f27_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f27_ColorMultiplier	1.0
+
+//Lens #28
+#define f28_LensOffset		-0.14	
+#define f28_LensScale		0.212
+#define f28_LensFactor		1.0
+#define	f28_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f28_ColorMultiplier	1.0
+
+//Lens #29
+#define f29_LensOffset		0.14	
+#define f29_LensScale		0.249
+#define f29_LensFactor		0.75	
+#define	f29_LensColor		float3(0.25, 1.0, 0.55)	
+#define	f29_ColorMultiplier	2.0				
+
+//Lens #30
+#define f30_LensOffset		0.47	
+#define f30_LensScale		0.332
+#define f30_LensFactor		1.0	
+#define	f30_LensColor		float3(1.0, 0.85, 0.22)
+#define	f30_ColorMultiplier	2.5				
+
+//Lens #31
+#define f31_LensOffset		0.8	
+#define f31_LensScale		0.415
+#define f31_LensFactor		0.75	
+#define	f31_LensColor		float3(0.60, 0.60, 0.75)	
+#define	f31_ColorMultiplier	2.0				
+
+//Lens #32
+#define f32_LensOffset		1.13	
+#define f32_LensScale		0.498
+#define f32_LensFactor		1.0	
+#define	f32_LensColor		float3(1.0, 1.0, 1.0)
+#define	f32_ColorMultiplier	1.0
+
+//Lens #33
+#define f33_LensOffset		1.46	
+#define f33_LensScale		0.581
+#define f33_LensFactor		0.5	
+#define	f33_LensColor		float3(0.25, 0.95, 0.35)	
+#define	f33_ColorMultiplier	2.3				
+
+//Lens #34
+#define f34_LensOffset		1.79	
+#define f34_LensScale		0.581
+#define f34_LensFactor		0.85	
+#define	f34_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f34_ColorMultiplier	1.0
+
+//Lens #35
+#define f35_LensOffset		2.12	
+#define f35_LensScale		0.581
+#define f35_LensFactor		1.0	
+#define	f35_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f35_ColorMultiplier	1.0
+
+//Lens #36
+#define f36_LensOffset		2.43	
+#define f36_LensScale		0.664
+#define f36_LensFactor		1.11	
+#define	f36_LensColor		float3(0.95, 0.95, 0.62)
+#define	f36_ColorMultiplier	1.2
+
+#endif
+
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for THIRDARY
+//====================================================================================================
+
+//Lens #37
+#define f37_LensOffset		-0.8				//Sun to Eye	
+#define f37_LensScale		0.083				//Size 
+#define f37_LensFactor		1.0				//Multiplier for Size	
+#define	f37_LensColor		float3(0.75, 0.75, 0.30)	//Color in RGB 	
+#define	f37_ColorMultiplier	1.0				//Color Multiplier
+
+//Lens #38
+#define f38_LensOffset		-0.47	
+#define f38_LensScale		0.166
+#define f38_LensFactor		1.0	
+#define	f38_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f38_ColorMultiplier	1.0
+
+//Lens #39
+#define f39_LensOffset		-0.14	
+#define f39_LensScale		0.212
+#define f39_LensFactor		1.0
+#define	f39_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f39_ColorMultiplier	1.0
+
+//Lens #40
+#define f40_LensOffset		0.14	
+#define f40_LensScale		0.249
+#define f40_LensFactor		0.75	
+#define	f40_LensColor		float3(0.25, 1.0, 0.75)	
+#define	f40_ColorMultiplier	1.0
+
+//Lens #41
+#define f41_LensOffset		0.47	
+#define f41_LensScale		0.332
+#define f41_LensFactor		1.0	
+#define	f41_LensColor		float3(0.0, 0.0, 0.75)
+#define	f41_ColorMultiplier	1.0
+
+//Lens #42
+#define f42_LensOffset		0.8	
+#define f42_LensScale		0.415
+#define f42_LensFactor		0.75	
+#define	f42_LensColor		float3(0.60, 0.60, 0.75)	
+#define	f42_ColorMultiplier	1.0
+
+//Lens #43
+#define f43_LensOffset		1.13	
+#define f43_LensScale		0.498
+#define f43_LensFactor		1.0	
+#define	f43_LensColor		float3(1.0, 1.0, 1.0)
+#define	f43_ColorMultiplier	1.0
+
+//Lens #44
+#define f44_LensOffset		1.46	
+#define f44_LensScale		0.581
+#define f44_LensFactor		0.5	
+#define	f44_LensColor		float3(0.25, 0.95, 0.35)	
+#define	f44_ColorMultiplier	1.0
+
+//Lens #45
+#define f45_LensOffset		1.79	
+#define f45_LensScale		0.581
+#define f45_LensFactor		0.85	
+#define	f45_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f45_ColorMultiplier	1.0
+
+//Lens #46
+#define f46_LensOffset		2.12	
+#define f46_LensScale		0.581
+#define f46_LensFactor		1.0	
+#define	f46_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f46_ColorMultiplier	1.0
+
+//Lens #47
+#define f47_LensOffset		2.43	
+#define f47_LensScale		0.664
+#define f47_LensFactor		1.11	
+#define	f47_LensColor		float3(0.95, 0.95, 0.62)
+#define	f47_ColorMultiplier	1.0
+
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for THIRDARY 2
+//====================================================================================================
+
+//Lens #48
+#define f48_LensOffset		-0.8				//Sun to Eye	
+#define f48_LensScale		0.083				//Size 
+#define f48_LensFactor		1.0				//Multiplier for Size	
+#define	f48_LensColor		float3(0.75, 0.75, 0.50)	//Color in RGB 	
+#define	f48_ColorMultiplier	1.0				//Color Multiplier
+
+//Lens #49
+#define f49_LensOffset		-0.47	
+#define f49_LensScale		0.166
+#define f49_LensFactor		1.0	
+#define	f49_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f49_ColorMultiplier	1.0
+
+//Lens #50
+#define f50_LensOffset		-0.14	
+#define f50_LensScale		0.212
+#define f50_LensFactor		1.0
+#define	f50_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f50_ColorMultiplier	1.0
+
+//Lens #51
+#define f51_LensOffset		0.14	
+#define f51_LensScale		0.249
+#define f51_LensFactor		0.75	
+#define	f51_LensColor		float3(0.25, 1.0, 0.75)	
+#define	f51_ColorMultiplier	1.0
+
+//Lens #52
+#define f52_LensOffset		0.47	
+#define f52_LensScale		0.332
+#define f52_LensFactor		1.0	
+#define	f52_LensColor		float3(0.0, 0.0, 0.75)
+#define	f52_ColorMultiplier	1.0
+
+//Lens #53
+#define f53_LensOffset		0.8	
+#define f53_LensScale		0.415
+#define f53_LensFactor		0.75	
+#define	f53_LensColor		float3(0.60, 0.60, 0.75)	
+#define	f53_ColorMultiplier	1.0
+
+//Lens #54
+#define f54_LensOffset		1.13	
+#define f54_LensScale		0.498
+#define f54_LensFactor		1.0	
+#define	f54_LensColor		float3(1.0, 1.0, 1.0)
+#define	f54_ColorMultiplier	1.0
+
+//Lens #55
+#define f55_LensOffset		1.46	
+#define f55_LensScale		0.581
+#define f55_LensFactor		0.5	
+#define	f55_LensColor		float3(0.25, 0.95, 0.35)	
+#define	f55_ColorMultiplier	1.0
+
+//Lens #56
+#define f56_LensOffset		1.79	
+#define f56_LensScale		0.581
+#define f56_LensFactor		0.85	
+#define	f56_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f56_ColorMultiplier	1.0
+
+//Lens #57
+#define f57_LensOffset		2.12	
+#define f57_LensScale		0.581
+#define f57_LensFactor		1.0	
+#define	f57_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f57_ColorMultiplier	1.0
+
+//Lens #58
+#define f58_LensOffset		2.43	
+#define f58_LensScale		0.664
+#define f58_LensFactor		1.11	
+#define	f58_LensColor		float3(0.95, 0.95, 0.62)
+#define	f58_ColorMultiplier	1.0
+
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for PRIMARY_ALT 
+//	Time-Related Colour Multipliers
+//	f#_R is Lens red multiplier, f#_G is green, f#_B is blue
+//====================================================================================================
+
+#if (USE_RGB_VARIATIONS_PRIMARY_ALT == 1)
+
+//Lens #59
+#define f59_LensOffset		-0.8							
+#define f59_LensScale		0.083		
+#define f59_LensFactor		1.0						
+#define	f59_LensColor		float3(0.95 + abs(frac(Timer.x * f59_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f59_G)* 2.0 - 1.0), 0.30 + abs(frac(Timer.x * f59_B)* 2.0 - 1.0))		
+#define	f59_ColorMultiplier	1.6	
+#define f59_R			200.0		
+#define f59_G			200.0
+#define f59_B			1000.0						
+
+//Lens #60
+#define f60_LensOffset		-0.6	
+#define f60_LensScale		0.103 
+#define f60_LensFactor		1.0	
+#define	f60_LensColor		float3(0.85 + abs(frac(Timer.x * f60_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f60_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f60_B)* 2.0 - 1.0))	
+#define	f60_ColorMultiplier	1.0
+#define f60_R			2000.0		
+#define f60_G			4000.0
+#define f60_B			200.0	
+
+//Lens #61
+#define f61_LensOffset		-0.4	
+#define f61_LensScale		0.123 
+#define f61_LensFactor		1.0	
+#define	f61_LensColor		float3(0.85 + abs(frac(Timer.x * f61_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f61_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f61_B)* 2.0 - 1.0))	
+#define	f61_ColorMultiplier	1.0
+#define f61_R			2000.0		
+#define f61_G			200.0
+#define f61_B			6000.0	
+
+//Lens #62
+#define f62_LensOffset		-0.2	
+#define f62_LensScale		0.143 
+#define f62_LensFactor		1.0
+#define	f62_LensColor		float3(1.0 + abs(frac(Timer.x * f62_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f62_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f62_B)* 2.0 - 1.0))	
+#define	f62_ColorMultiplier	1.0
+#define f62_R			2000.0		
+#define f62_G			5000.0
+#define f62_B			200.0	
+
+//Lens #63
+#define f63_LensOffset		0.0	
+#define f63_LensScale		0.143 
+#define f63_LensFactor		1.0	
+#define	f63_LensColor		float3(0.85 + abs(frac(Timer.x * f63_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f63_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f63_B)* 2.0 - 1.0))	
+#define	f63_ColorMultiplier	1.0
+#define f63_R			2000.0		
+#define f63_G			600.0
+#define f63_B			2000.0	
+
+//Lens #64
+#define f64_LensOffset		0.2	
+#define f64_LensScale		0.163 
+#define f64_LensFactor		1.0	
+#define	f64_LensColor		float3(0.2 + abs(frac(Timer.x * f64_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f64_G)* 2.0 - 1.0), 0.55 + abs(frac(Timer.x * f64_B)* 2.0 - 1.0))	
+#define	f64_ColorMultiplier	2.0	
+#define f64_R			2000.0		
+#define f64_G			600.0
+#define f64_B			2000.0				
+
+//Lens #65
+#define f65_LensOffset		0.4	
+#define f65_LensScale		0.183 
+#define f65_LensFactor		1.0	
+#define	f65_LensColor		float3(1.0 + abs(frac(Timer.x * f65_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f65_G)* 2.0 - 1.0), 0.22 + abs(frac(Timer.x * f65_B)* 2.0 - 1.0))
+#define	f65_ColorMultiplier	2.5	
+#define f65_R			200.0		
+#define f65_G			6000.0
+#define f65_B			2000.0				
+
+//Lens #66
+#define f66_LensOffset		0.6	
+#define f66_LensScale		0.203 
+#define f66_LensFactor		1.0	
+#define	f66_LensColor		float3(0.85 + abs(frac(Timer.x * f66_R)* 2.0 - 1.0), 0.60 + abs(frac(Timer.x * f66_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f66_B)* 2.0 - 1.0))	
+#define	f66_ColorMultiplier	1.0
+#define f66_R			2000.0		
+#define f66_G			1000.0
+#define f66_B			600.0	
+
+//Lens #67
+#define f67_LensOffset		0.8	
+#define f67_LensScale		0.223 
+#define f67_LensFactor		1.0	
+#define	f67_LensColor		float3(0.60 + abs(frac(Timer.x * f67_R)* 2.0 - 1.0), 0.60 + abs(frac(Timer.x * f67_G)* 2.0 - 1.0), 0.75 + abs(frac(Timer.x * f67_B)* 2.0 - 1.0))	
+#define	f67_ColorMultiplier	2.0	
+#define f67_R			200.0		
+#define f67_G			6000.0
+#define f67_B			200.0				
+
+//Lens #68
+#define f68_LensOffset		1.0	
+#define f68_LensScale		0.323 
+#define f68_LensFactor		1.0	
+#define	f68_LensColor		float3(1.0 + abs(frac(Timer.x * f68_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f68_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f68_B)* 2.0 - 1.0))
+#define	f68_ColorMultiplier	1.0
+#define f68_R			2000.0		
+#define f68_G			6000.0
+#define f68_B			200.0	
+
+//Lens #69
+#define f69_LensOffset		1.2	
+#define f69_LensScale		0.263 
+#define f69_LensFactor		1.0	
+#define	f69_LensColor		float3(0.25 + abs(frac(Timer.x * f69_R)* 2.0 - 1.0), 0.95 + abs(frac(Timer.x * f69_G)* 2.0 - 1.0), 0.35 + abs(frac(Timer.x * f69_B)* 2.0 - 1.0))	
+#define	f69_ColorMultiplier	2.3	
+#define f69_R			2000.0		
+#define f69_G			6000.0
+#define f69_B			2000.0			
+
+//Lens #70
+#define f70_LensOffset		1.4	
+#define f70_LensScale		0.333
+#define f70_LensFactor		1.0	
+#define	f70_LensColor		float3(0.85 + abs(frac(Timer.x * f70_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f70_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f70_B)* 2.0 - 1.0))	
+#define	f70_ColorMultiplier	1.0
+#define f70_R			200.0		
+#define f70_G			600.0
+#define f70_B			2000.0	
+
+//Lens #71
+#define f71_LensOffset		1.6
+#define f71_LensScale		0.303 
+#define f71_LensFactor		1.0	
+#define	f71_LensColor		float3(0.85 + abs(frac(Timer.x * f71_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f71_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f71_B)* 2.0 - 1.0))	
+#define	f71_ColorMultiplier	1.0
+#define f71_R			300.0		
+#define f71_G			600.0
+#define f71_B			200.0	
+
+//Lens #72
+#define f72_LensOffset		1.8	
+#define f72_LensScale		0.363 
+#define f72_LensFactor		1.0	
+#define	f72_LensColor		float3(1.0 +  abs(frac(Timer.x * f72_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f72_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f72_B)* 2.0 - 1.0))	
+#define	f72_ColorMultiplier	1.0
+#define f72_R			300.0		
+#define f72_G			6000.0
+#define f72_B			2000.0	
+
+//Lens #73
+#define f73_LensOffset		2.0	
+#define f73_LensScale		0.343
+#define f73_LensFactor		1.0	
+#define	f73_LensColor		float3(0.85 + abs(frac(Timer.x * f73_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f73_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f73_B)* 2.0 - 1.0))	
+#define	f73_ColorMultiplier	1.0
+#define f73_R			3000.0		
+#define f73_G			100.0
+#define f73_B			2000.0	
+
+//Lens #74
+#define f74_LensOffset		2.2	
+#define f74_LensScale		0.363
+#define f74_LensFactor		1.0	
+#define	f74_LensColor		float3(1.0 + abs(frac(Timer.x * f74_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f74_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f74_B)* 2.0 - 1.0))	
+#define	f74_ColorMultiplier	1.0
+#define f74_R			20.0		
+#define f74_G			600.0
+#define f74_B			2000.0	
+
+//Lens #75
+#define f75_LensOffset		2.4	
+#define f75_LensScale		0.383
+#define f75_LensFactor		1.0	
+#define	f75_LensColor		float3(0.95 + abs(frac(Timer.x * f75_R)* 2.0 - 1.0), 0.95 + abs(frac(Timer.x * f75_G)* 2.0 - 1.0), 0.62 + abs(frac(Timer.x * f75_B)* 2.0 - 1.0))
+#define	f75_ColorMultiplier	1.2
+#define f75_R			2000.0		
+#define f75_G			6000.0
+#define f75_B			2000.0	
+
+//Lens #76
+#define f76_LensOffset		2.6	
+#define f76_LensScale		0.403 
+#define f76_LensFactor		1.0	
+#define	f76_LensColor		float3(0.85 + abs(frac(Timer.x * f76_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f76_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f76_B)* 2.0 - 1.0))	
+#define	f76_ColorMultiplier	1.0
+#define f76_R			3000.0		
+#define f76_G			5000.0
+#define f76_B			200.0	
+
+
+#else
+
+
+//Lens #59
+#define f59_LensOffset		-0.8				//Sun to Eye	
+#define f59_LensScale		0.083				//Size 
+#define f59_LensFactor		1.0				//Multiplier for Size
+#define	f59_LensColor		float3(0.95, 0.85, 0.30)	//Color in RGB 	
+#define	f59_ColorMultiplier	1.6				//Color Multiplier
+
+//Lens #60
+#define f60_LensOffset		-0.6	
+#define f60_LensScale		0.103
+#define f60_LensFactor		1.0	
+#define	f60_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f60_ColorMultiplier	1.0
+
+//Lens #61
+#define f61_LensOffset		-0.4	
+#define f61_LensScale		0.123
+#define f61_LensFactor		1.0	
+#define	f61_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f61_ColorMultiplier	1.0
+
+//Lens #62
+#define f62_LensOffset		-0.2	
+#define f62_LensScale		0.143
+#define f62_LensFactor		1.0
+#define	f62_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f62_ColorMultiplier	1.0
+
+//Lens #63
+#define f63_LensOffset		0.0	
+#define f63_LensScale		0.143
+#define f63_LensFactor		1.0	
+#define	f63_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f63_ColorMultiplier	1.0
+
+//Lens #64
+#define f64_LensOffset		0.2	
+#define f64_LensScale		0.163
+#define f64_LensFactor		1.0	
+#define	f64_LensColor		float3(0.25, 1.0, 0.55)	
+#define	f64_ColorMultiplier	2.0			
+
+//Lens #65
+#define f65_LensOffset		0.4	
+#define f65_LensScale		0.183
+#define f65_LensFactor		1.0	
+#define	f65_LensColor		float3(1.0, 0.85, 0.22)
+#define	f65_ColorMultiplier	2.5				
+
+//Lens #66
+#define f66_LensOffset		0.6	
+#define f66_LensScale		0.203
+#define f66_LensFactor		1.0	
+#define	f66_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f66_ColorMultiplier	1.0
+
+//Lens #67
+#define f67_LensOffset		0.8	
+#define f67_LensScale		0.223
+#define f67_LensFactor		1.0	
+#define	f67_LensColor		float3(0.60, 0.60, 0.75)	
+#define	f67_ColorMultiplier	2.0				
+
+//Lens #68
+#define f68_LensOffset		1.0	
+#define f68_LensScale		0.243
+#define f68_LensFactor		1.0	
+#define	f68_LensColor		float3(1.0, 1.0, 1.0)
+#define	f68_ColorMultiplier	1.0
+
+//Lens #69
+#define f69_LensOffset		1.2	
+#define f69_LensScale		0.263
+#define f69_LensFactor		1.0	
+#define	f69_LensColor		float3(0.25, 0.95, 0.35)	
+#define	f69_ColorMultiplier	2.3				
+
+//Lens #70
+#define f70_LensOffset		1.4	
+#define f70_LensScale		0.283
+#define f70_LensFactor		1.0	
+#define	f70_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f70_ColorMultiplier	1.0
+
+//Lens #71
+#define f71_LensOffset		1.6
+#define f71_LensScale		0.303
+#define f71_LensFactor		1.0	
+#define	f71_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f71_ColorMultiplier	1.0
+
+//Lens #72
+#define f72_LensOffset		1.8	
+#define f72_LensScale		0.323
+#define f72_LensFactor		1.0	
+#define	f72_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f72_ColorMultiplier	1.0
+
+//Lens #73
+#define f73_LensOffset		2.0	
+#define f73_LensScale		0.343
+#define f73_LensFactor		1.0	
+#define	f73_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f73_ColorMultiplier	1.0
+
+//Lens #74
+#define f74_LensOffset		2.2	
+#define f74_LensScale		0.363
+#define f74_LensFactor		1.0	
+#define	f74_LensColor		float3(1.0, 1.0, 1.0)	
+#define	f74_ColorMultiplier	1.0
+
+//Lens #75
+#define f75_LensOffset		2.4	
+#define f75_LensScale		0.383
+#define f75_LensFactor		1.0	
+#define	f75_LensColor		float3(0.95, 0.95, 0.62)
+#define	f75_ColorMultiplier	1.2
+
+//Lens #76
+#define f76_LensOffset		2.6	
+#define f76_LensScale		0.403
+#define f76_LensFactor		1.0	
+#define	f76_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f76_ColorMultiplier	1.0
+
+#endif 
+
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for PRIMARY_ALT_2
+//	Time-Related Colour Multipliers
+//	f#_R is Lens red multiplier, f#_G is green, f#_B is blue
+//====================================================================================================
+
+#if (USE_RGB_VARIATIONS_PRIMARY_ALT_2 == 1)
+
+//Lens #77
+#define f77_LensOffset		-0.5							
+#define f77_LensScale		0.1		
+#define f77_LensFactor		1.0						
+#define	f77_LensColor		float3(0.95 + abs(frac(Timer.x * f77_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f77_G)* 2.0 - 1.0), 0.30 + abs(frac(Timer.x * f77_B)* 2.0 - 1.0))		
+#define	f77_ColorMultiplier	1.6	
+#define f77_R			200.0		
+#define f77_G			200.0
+#define f77_B			1000.0						
+
+//Lens #78
+#define f78_LensOffset		0.5	
+#define f78_LensScale		0.333 
+#define f78_LensFactor		1.0	
+#define	f78_LensColor		float3(0.85 + abs(frac(Timer.x * f78_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f78_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f78_B)* 2.0 - 1.0))	
+#define	f78_ColorMultiplier	1.0
+#define f78_R			2000.0		
+#define f78_G			4000.0
+#define f78_B			200.0	
+
+//Lens #79
+#define f79_LensOffset		1.0	
+#define f79_LensScale		0.665
+#define f79_LensFactor		1.0	
+#define	f79_LensColor		float3(0.85 + abs(frac(Timer.x * f79_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f79_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f79_B)* 2.0 - 1.0))	
+#define	f79_ColorMultiplier	1.0
+#define f79_R			2000.0		
+#define f79_G			200.0
+#define f79_B			6000.0	
+
+//Lens #80
+#define f80_LensOffset		1.8	
+#define f80_LensScale		0.885 
+#define f80_LensFactor		1.0
+#define	f80_LensColor		float3(1.0 + abs(frac(Timer.x * f80_R)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f80_G)* 2.0 - 1.0), 1.0 + abs(frac(Timer.x * f80_B)* 2.0 - 1.0))	
+#define	f80_ColorMultiplier	1.0
+#define f80_R			2000.0		
+#define f80_G			5000.0
+#define f80_B			200.0	
+
+
+#else
+
+
+//Lens #77
+#define f77_LensOffset		-0.5							
+#define f77_LensScale		0.1	
+#define f77_LensFactor		1.0						
+#define	f77_LensColor		float3(0.95, 0.65, 0.30)		
+#define	f77_ColorMultiplier	1.6						
+
+//Lens #78
+#define f78_LensOffset		0.5	
+#define f78_LensScale		0.333
+#define f78_LensFactor		1.0	
+#define	f78_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f78_ColorMultiplier	1.0
+
+//Lens #79
+#define f79_LensOffset		1.0	
+#define f79_LensScale		0.665
+#define f79_LensFactor		1.0	
+#define	f79_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f79_ColorMultiplier	1.0
+
+//Lens #80
+#define f80_LensOffset		1.8	
+#define f80_LensScale		0.885 
+#define f80_LensFactor		1.0
+#define	f80_LensColor		float3(1.0, 1.0, 1.0)
+#define	f80_ColorMultiplier	1.0
+
+#endif
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for FOURTH
+//	Time-Related Colour Multipliers
+//	f#_R is Lens red multiplier, f#_G is green, f#_B is blue
+//====================================================================================================
+
+#if (USE_RGB_VARIATIONS_FOURTH == 1)
+
+//Lens #81
+#define f81_LensOffset		-0.5							
+#define f81_LensScale		0.1		
+#define f81_LensFactor		1.0						
+#define	f81_LensColor		float3(0.95 + abs(frac(Timer.x * f81_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f81_G)* 2.0 - 1.0), 0.30 + abs(frac(Timer.x * f81_B)* 2.0 - 1.0))		
+#define	f81_ColorMultiplier	1.6	
+#define f81_R			200.0		
+#define f81_G			200.0
+#define f81_B			1000.0						
+
+//Lens #82
+#define f82_LensOffset		0.5	
+#define f82_LensScale		0.455
+#define f82_LensFactor		1.0	
+#define	f82_LensColor		float3(0.85 + abs(frac(Timer.x * f82_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f82_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f82_B)* 2.0 - 1.0))	
+#define	f82_ColorMultiplier	1.0
+#define f82_R			2000.0		
+#define f82_G			4000.0
+#define f82_B			200.0	
+
+//Lens #83
+#define f83_LensOffset		1.0	
+#define f83_LensScale		0.665
+#define f83_LensFactor		1.5	
+#define	f83_LensColor		float3(0.85 + abs(frac(Timer.x * f83_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f83_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f83_B)* 2.0 - 1.0))	
+#define	f83_ColorMultiplier	1.3
+#define f83_R			2000.0		
+#define f83_G			200.0
+#define f83_B			6000.0	
+
+
+#else
+
+
+//Lens #81
+#define f81_LensOffset		-0.5							
+#define f81_LensScale		0.1	
+#define f81_LensFactor		1.0						
+#define	f81_LensColor		float3(0.95, 0.65, 0.30)		
+#define	f81_ColorMultiplier	1.6						
+
+//Lens #82
+#define f82_LensOffset		0.5	
+#define f82_LensScale		0.455
+#define f82_LensFactor		1.0	
+#define	f82_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f82_ColorMultiplier	1.0
+
+//Lens #83
+#define f83_LensOffset		1.5	
+#define f83_LensScale		0.665
+#define f83_LensFactor		1.3	
+#define	f83_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f83_ColorMultiplier	1.0
+
+#endif
+
+//KYO : add a/o remove passes of technique below
+
+//====================================================================================================
+//	Internal Individual parameters for FOURTH_2
+//	Time-Related Colour Multipliers
+//	f#_R is Lens red multiplier, f#_G is green, f#_B is blue
+//====================================================================================================
+
+#if (USE_RGB_VARIATIONS_FOURTH_2 == 1)
+
+//Lens #84
+#define f84_LensOffset		-0.5							
+#define f84_LensScale		0.2		
+#define f84_LensFactor		0.85						
+#define	f84_LensColor		float3(0.95 + abs(frac(Timer.x * f84_R)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f84_G)* 2.0 - 1.0), 0.30 + abs(frac(Timer.x * f84_B)* 2.0 - 1.0))		
+#define	f84_ColorMultiplier	1.2	
+#define f84_R			200.0		
+#define f84_G			200.0
+#define f84_B			1000.0						
+
+//Lens #85
+#define f85_LensOffset		0.5	
+#define f85_LensScale		0.333
+#define f85_LensFactor		1.0	
+#define	f85_LensColor		float3(0.85 + abs(frac(Timer.x * f85_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f85_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f85_B)* 2.0 - 1.0))	
+#define	f85_ColorMultiplier	1.0
+#define f85_R			2000.0		
+#define f85_G			4000.0
+#define f85_B			200.0	
+
+//Lens #86
+#define f86_LensOffset		1.5	
+#define f86_LensScale		0.665
+#define f86_LensFactor		1.5	
+#define	f86_LensColor		float3(0.85 + abs(frac(Timer.x * f86_R)* 2.0 - 1.0), 0.65 + abs(frac(Timer.x * f86_G)* 2.0 - 1.0), 0.85 + abs(frac(Timer.x * f86_B)* 2.0 - 1.0))	
+#define	f86_ColorMultiplier	1.0
+#define f86_R			2000.0		
+#define f86_G			200.0
+#define f86_B			6000.0	
+
+
+#else
+
+
+//Lens #84
+#define f84_LensOffset		-0.5							
+#define f84_LensScale		0.3	
+#define f84_LensFactor		0.85						
+#define	f84_LensColor		float3(0.95, 0.65, 0.30)		
+#define	f84_ColorMultiplier	1.2						
+
+//Lens #85
+#define f85_LensOffset		0.5	
+#define f85_LensScale		0.333
+#define f85_LensFactor		1.0	
+#define	f85_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f85_ColorMultiplier	1.0
+
+//Lens #86
+#define f86_LensOffset		1.5	
+#define f86_LensScale		0.665
+#define f86_LensFactor		1.0	
+#define	f86_LensColor		float3(0.85, 0.65, 0.85)	
+#define	f86_ColorMultiplier	1.0
+
+#endif
+
+//===================================================================================================
+//===================================================================================================
+//	External parameters
+//===================================================================================================
+//===================================================================================================
+float4	tempF1; //0,1,2,3
+float4	tempF2; //5,6,7,8
+float4	tempF3; //9,0
+//x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
+float4	ScreenSize;
+//x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
+float4	Timer;
+//xy=sun position on screen, w=visibility
+float4	LightParameters;
+//textures
+texture2D texColor;
+texture2D texMask;
+
+sampler2D SamplerColor = sampler_state
+{
+	Texture   = <texColor>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;				
+	MipMapLodBias=0;
+};
+
+sampler2D SamplerMask = sampler_state
+{
+	Texture   = <texMask>;
+	MinFilter = LINEAR;
+	MagFilter = LINEAR;
+	MipFilter = NONE;
+	AddressU  = Clamp;
+	AddressV  = Clamp;
+	SRGBTexture=FALSE;
+	MaxMipLevel=0;
+	MipMapLodBias=0;
+};
+
+struct VS_OUTPUT_POST
+{
+	float4 vpos  : POSITION;
+	float2 txcoord : TEXCOORD0;
+};
+
+struct VS_INPUT_POST
+{
+	float3 pos  : POSITION;
+	float2 txcoord : TEXCOORD0;
+};
+
+/**
+ * Pseudo-random number generator - returns a number generated according to the provided vector
+ */
+float Random(float2 co)
+{
+    return frac(sin(dot(co.xy, float2(12.9898, 78.233))) * 43758.5453);
+}
+
+/**
+ * Timer Formulas
+ */
+/**
+	float timepassed=Timer.x* Value;		
+	timepassed=frac(timepassed_Light) * 2.0 - 1.0;
+	timepassed=abs(timepassed_Light);
+
+-1.0 - 1.0
+	float amplitude = 1.0;
+	float frequency = 1.0;
+	float Value= sin(2 * PI * frequency * Timer.x) * amplitude;
+
+0.0 - 1.0
+	float amplitude = 1.0;
+	float frequency = 1.0;
+	float Value = (0.5 * sin(2 * PI * frequency * Timer.x) + 0.5) * amplitude;
+*/
+/**
+ * Several Lens moving similar to Lens effect
+ * Transformed in vertex shader and drawed separately 
+ * Offset is set in passes of technique
+ */
+
+VS_OUTPUT_POST VS_Secondary(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_SECONDARY == 1)
+	float timepassed_1=Timer.x* fVelocity_Secondary;			
+	timepassed_1=frac(timepassed_1) * 2.0 - 1.0;
+	timepassed_1=abs(timepassed_1);
+	float4 pos = float4(IN.pos.x + fHPosSecondary,IN.pos.y + fVPosSecondary,IN.pos.z,1.0) + timepassed_1;
+#else
+	float4 pos = float4(IN.pos.x + fHPosSecondary,IN.pos.y + fVPosSecondary,IN.pos.z,1.0);
+#endif
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Secondary=(Timer.x* (fScaleTimeFactor_Secondary * 8.0));			
+	timepassed_Scale_Secondary=frac(timepassed_Scale_Secondary) * 2.0 - 1.0;
+	timepassed_Scale_Secondary=abs(timepassed_Scale_Secondary);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_SECONDARY == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScaleSecondary + timepassed_Scale_Secondary))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScaleSecondary)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Secondary(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask, fContrastSecondary);				
+	clip(sunmask-0.02);		
+	
+	float timepassed_Scale_Secondary=(Timer.x* (fScaleTimeFactor_Secondary * 8.0));			
+	timepassed_Scale_Secondary=frac(timepassed_Scale_Secondary) * 2.0 - 1.0;
+	timepassed_Scale_Secondary=abs(timepassed_Scale_Secondary);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+	
+#if (USE_LENS_DISTORTIONS_SECONDARY == 1)
+#if (USE_CHROMA_FORMULA_SECONDARY == 1)
+	float3 eta_Secondary = float3(1.0+fChromaticAmount_Secondary*0.9,1.0+fChromaticAmount_Secondary*0.6,1.0+fChromaticAmount_Secondary*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY == 2)
+	float3 eta_Secondary = float3(1.0+fChromaticAmount_Secondary*0.6,1.0+fChromaticAmount_Secondary*0.9,1.0+fChromaticAmount_Secondary*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY == 3)
+	float3 eta_Secondary = float3(1.0+fChromaticAmount_Secondary*0.3,1.0+fChromaticAmount_Secondary*0.6,1.0+fChromaticAmount_Secondary*0.9);
+#elif (USE_CHROMA_FORMULA_SECONDARY == 4)
+	float3 eta_Secondary = float3(1.0+fChromaticAmount_Secondary*0.3,1.0+fChromaticAmount_Secondary*0.9,1.0+fChromaticAmount_Secondary*0.6);
+#elif (USE_CHROMA_FORMULA_SECONDARY == 5)
+	float3 eta_Secondary = float3(1.0+fChromaticAmount_Secondary*0.3,1.0+fChromaticAmount_Secondary*0.3,1.0+fChromaticAmount_Secondary*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY == 6)
+	float3 eta_Secondary = float3(1.0+fChromaticAmount_Secondary*0.9,1.0+fChromaticAmount_Secondary*0.3,1.0+fChromaticAmount_Secondary*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY == 7)
+	float3 eta_Secondary = float3(1.0+fChromaticAmount_Secondary*0.9,1.0+fChromaticAmount_Secondary*0.9,1.0+fChromaticAmount_Secondary*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_SECONDARY == 1)
+	float LensZoom_Secondary = (1.0 / fLensSize_Secondary) * (fLensScaleFactor * (fScaleSecondary + timepassed_Scale_Secondary));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Secondary = 1.0 / fLensSize_Secondary;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Secondary == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Secondary;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Secondary + fLensDistortionCubic_Secondary * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Secondary*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Secondary*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Secondary.r)*LensZoom_Secondary*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Secondary.g)*LensZoom_Secondary*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Secondary.b)*LensZoom_Secondary*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif	
+
+	float amplitudeSecondary = 1.0;
+	float frequencySecondary = 1.0;
+	float TimeFactorSecondary=(0.5 * sin(2 * PI * frequencySecondary * Timer.x * (8.0 * fIntTimeFactor_Secondary)) + 0.75) * amplitudeSecondary;	//+ 0.5 Non-Limiter
+	float timepassed_Light=Timer.x* fLightVelocity_Secondary;		
+	timepassed_Light=frac(timepassed_Light) * 2.0 - 1.0;
+	timepassed_Light=abs(timepassed_Light);
+
+#if (USE_LIGHT_SECONDARY == 1)
+	sunmask*=(LightParameters.w + timepassed_Light) * (fLensIntensity * (fIntensitySecondary - timepassed_Light * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensitySecondary);
+#endif
+#if (USE_INTENSITY_VARIATIONS_SECONDARY == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensitySecondary) * TimeFactorSecondary );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensitySecondary);
+#endif
+
+#if (USE_LENS_DISTORTIONS_SECONDARY == 1)
+	res.xyz=origcolor.xyz * sunmask;
+#else
+	res.xyz=origcolor * sunmask;
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=(colorfilter * colormultiplier);
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	SUNGLARE
+ */
+
+VS_OUTPUT_POST VS_Sunglare(VS_INPUT_POST IN, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_SUNGLARE == 1)
+	float timepassed_2=Timer.x* fVelocity_Sunglare;			
+	timepassed_2=frac(timepassed_2) * 2.0 - 1.0;
+	timepassed_2=abs(timepassed_2);
+	float4 pos = float4(IN.pos.x + fHPosSunglare,IN.pos.y + fVPosSunglare,IN.pos.z,1.0) + timepassed_2;
+#else
+	float4 pos = float4(IN.pos.x + fHPosSunglare,IN.pos.y + fVPosSunglare,IN.pos.z,1.0);
+#endif
+	pos.y *= ScreenSize.z;
+
+#if (USE_DISPERSION_BOOST == 1)
+	float timepassed_Dispersion=Timer.x* fBoost_Sunglare;			
+	timepassed_Dispersion=frac(timepassed_Dispersion) * 2.0 - 1.0;
+	timepassed_Dispersion=abs(timepassed_Dispersion);
+	float l = length(LightParameters.xy)  + timepassed_Dispersion;
+#else
+	float l = length(LightParameters.xy);
+#endif
+	float timepassed_Scale_Sunglare=(Timer.x* (fScaleTimeFactor_Sunglare * 8.0));			
+	timepassed_Scale_Sunglare=frac(timepassed_Scale_Sunglare) * 2.0 - 1.0;
+	timepassed_Scale_Sunglare=abs(timepassed_Scale_Sunglare);
+	float scaleFactor = (2.0 - 1.0 / (l * l + 1.0)) * scale;
+	float2 shift = LightParameters.xy;
+
+#if (USE_SCALE_VARIATIONS_SUNGLARE == 1)
+	pos.xy=pos.xy*(scaleFactor * (fScaleSunglare + timepassed_Scale_Sunglare))  + shift;
+ #else
+	pos.xy=pos.xy * (scaleFactor *  fScaleSunglare) + shift;
+#endif
+	OUT.vpos = pos;
+	OUT.txcoord.xy = IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Sunglare(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask, fContrastSunglare);
+	clip(sunmask-0.02);					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+
+	float amplitudeSunglare = 1.0;
+	float frequencySunglare = 1.0;
+	float TimeFactorSunglare=(0.5 * sin(2 * PI * frequencySunglare * Timer.x * (8.0 * fIntTimeFactor_Sunglare)) + 0.75) * amplitudeSunglare;	//+ 0.5 Non-Limiter
+
+#if (USE_LIGHT_SUNGLARE == 1)
+	float timepassed_Light2=Timer.x* fLightVelocity_Sunglare;
+	timepassed_Light2=frac(timepassed_Light2) * 2.0 - 1.0;
+	timepassed_Light2=abs(timepassed_Light2);
+	float timepassed_Pulse=(Timer.x* timepassed_Light2)* 20.0;		//KYO : Timer in Timer :P
+	timepassed_Pulse=frac(timepassed_Pulse) * 2.0 - 1.0;
+	timepassed_Pulse=abs(timepassed_Pulse);
+	sunmask*=(LightParameters.w + timepassed_Light2) * (fLensIntensity * (fIntensitySunglare - timepassed_Light2 * 1.1));
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensitySunglare);
+#endif
+
+#if (USE_INTENSITY_VARIATIONS_SUNGLARE == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensitySunglare) * TimeFactorSunglare );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensitySunglare);
+#endif
+	res.xyz=origcolor.a * sunmask;
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	SECONDARY_2
+ */
+
+VS_OUTPUT_POST VS_Secondary_2(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_SECONDARY_2 == 1)
+	float timepassed_3=Timer.x* fVelocity_Secondary_2;			
+	timepassed_3=frac(timepassed_3) * 2.0 - 1.0;
+	timepassed_3=abs(timepassed_3);
+	float4 pos = float4(IN.pos.x + fHPosSecondary_2,IN.pos.y + fVPosSecondary_2,IN.pos.z,1.0) + timepassed_3;
+#else
+	float4 pos = float4(IN.pos.x + fHPosSecondary_2,IN.pos.y + fVPosSecondary_2,IN.pos.z,1.0);
+#endif		
+	pos.y*=ScreenSize.z;
+
+	float timepassed_Scale_Secondary_2=(Timer.x* (fScaleTimeFactor_Secondary_2 * 8.0));			
+	timepassed_Scale_Secondary_2=frac(timepassed_Scale_Secondary_2) * 2.0 - 1.0;
+	timepassed_Scale_Secondary_2=abs(timepassed_Scale_Secondary_2);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_SECONDARY_2 == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScaleSecondary_2 + timepassed_Scale_Secondary_2))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScaleSecondary_2)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Secondary_2(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask, fContrastSecondary_2);				
+	clip(sunmask-0.02);							
+
+	float timepassed_Scale_Secondary_2=(Timer.x* (fScaleTimeFactor_Secondary_2 * 8.0));			
+	timepassed_Scale_Secondary_2=frac(timepassed_Scale_Secondary_2) * 2.0 - 1.0;
+	timepassed_Scale_Secondary_2=abs(timepassed_Scale_Secondary_2);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+	
+#if (USE_LENS_DISTORTIONS_SECONDARY_2 == 1)
+#if (USE_CHROMA_FORMULA_SECONDARY_2 == 1)
+	float3 eta_Secondary_2 = float3(1.0+fChromaticAmount_Secondary_2*0.9,1.0+fChromaticAmount_Secondary_2*0.6,1.0+fChromaticAmount_Secondary_2*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY_2 == 2)
+	float3 eta_Secondary_2 = float3(1.0+fChromaticAmount_Secondary_2*0.6,1.0+fChromaticAmount_Secondary_2*0.9,1.0+fChromaticAmount_Secondary_2*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY_2 == 3)
+	float3 eta_Secondary_2 = float3(1.0+fChromaticAmount_Secondary_2*0.3,1.0+fChromaticAmount_Secondary_2*0.6,1.0+fChromaticAmount_Secondary_2*0.9);
+#elif (USE_CHROMA_FORMULA_SECONDARY_2 == 4)
+	float3 eta_Secondary_2 = float3(1.0+fChromaticAmount_Secondary_2*0.3,1.0+fChromaticAmount_Secondary_2*0.9,1.0+fChromaticAmount_Secondary_2*0.6);
+#elif (USE_CHROMA_FORMULA_SECONDARY_2 == 5)
+	float3 eta_Secondary_2 = float3(1.0+fChromaticAmount_Secondary_2*0.3,1.0+fChromaticAmount_Secondary_2*0.3,1.0+fChromaticAmount_Secondary_2*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY_2 == 6)
+	float3 eta_Secondary_2 = float3(1.0+fChromaticAmount_Secondary_2*0.9,1.0+fChromaticAmount_Secondary_2*0.3,1.0+fChromaticAmount_Secondary_2*0.3);
+#elif (USE_CHROMA_FORMULA_SECONDARY_2 == 7)
+	float3 eta_Secondary_2 = float3(1.0+fChromaticAmount_Secondary_2*0.9,1.0+fChromaticAmount_Secondary_2*0.9,1.0+fChromaticAmount_Secondary_2*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_SECONDARY_2 == 1)
+	float LensZoom_Secondary_2 = (1.0 / fLensSize_Secondary_2) * (fLensScaleFactor * (fScaleSecondary_2 + timepassed_Scale_Secondary_2));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Secondary_2 = 1.0 / fLensSize_Secondary_2;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Secondary_2 == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Secondary_2;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Secondary_2 + fLensDistortionCubic_Secondary_2 * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Secondary_2*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Secondary_2*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Secondary_2.r)*LensZoom_Secondary_2*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Secondary_2.g)*LensZoom_Secondary_2*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Secondary_2.b)*LensZoom_Secondary_2*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif	
+
+	float amplitudeSecondary_2 = 1.0;
+	float frequencySecondary_2 = 1.0;
+	float TimeFactorSecondary_2=(0.5 * sin(2 * PI * frequencySecondary_2 * Timer.x * (8.0 * fIntTimeFactor_Secondary_2)) + 0.75) * amplitudeSecondary_2;	//+ 0.5 Non-Limiter
+	float timepassed_Light3=Timer.x* fLightVelocity_Secondary_2;		
+	timepassed_Light3=frac(timepassed_Light3) * 2.0 - 1.0;
+	timepassed_Light3=abs(timepassed_Light3);
+
+#if (USE_LIGHT_SECONDARY_2 == 1)
+	sunmask*=(LightParameters.w + timepassed_Light3) * (fLensIntensity * (fIntensitySecondary_2 - timepassed_Light3 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensitySecondary_2);
+#endif
+#if (USE_INTENSITY_VARIATIONS_SECONDARY_2 == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensitySecondary_2) * TimeFactorSecondary_2 );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensitySecondary_2);
+#endif
+
+#if (USE_LENS_DISTORTIONS_SECONDARY_2 == 1)
+	res.xyz=origcolor.xyz * sunmask;
+#else
+	res.xyz=origcolor * sunmask;
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	PRIMARY
+ */
+
+VS_OUTPUT_POST VS_Primary(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_PRIMARY == 1)
+	float timepassed_4=Timer.x* fVelocity_Primary;			
+	timepassed_4=frac(timepassed_4) * 2.0 - 1.0;
+	timepassed_4=abs(timepassed_4);
+	float4 pos = float4(IN.pos.x + fHPosPrimary,IN.pos.y + fVPosPrimary,IN.pos.z,1.0) + timepassed_4;
+#else
+	float4 pos = float4(IN.pos.x + fHPosPrimary,IN.pos.y + fVPosPrimary,IN.pos.z,1.0);
+#endif
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Primary=(Timer.x* (fScaleTimeFactor_Primary * 8.0));			
+	timepassed_Scale_Primary=frac(timepassed_Scale_Primary) * 2.0 - 1.0;
+	timepassed_Scale_Primary=abs(timepassed_Scale_Primary);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_PRIMARY == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScalePrimary + timepassed_Scale_Primary))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScalePrimary)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Primary(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask, fContrastPrimary);					
+	clip(sunmask-0.02);	
+						
+	float timepassed_Scale_Primary=(Timer.x* (fScaleTimeFactor_Primary * 8.0));			
+	timepassed_Scale_Primary=frac(timepassed_Scale_Primary) * 2.0 - 1.0;
+	timepassed_Scale_Primary=abs(timepassed_Scale_Primary);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+
+#if (USE_LENS_DISTORTIONS_PRIMARY == 1)
+#if (USE_CHROMA_FORMULA_PRIMARY == 1)
+	float3 eta_Primary = float3(1.0+fChromaticAmount_Primary*0.9,1.0+fChromaticAmount_Primary*0.6,1.0+fChromaticAmount_Primary*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY == 2)
+	float3 eta_Primary = float3(1.0+fChromaticAmount_Primary*0.6,1.0+fChromaticAmount_Primary*0.9,1.0+fChromaticAmount_Primary*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY == 3)
+	float3 eta_Primary = float3(1.0+fChromaticAmount_Primary*0.3,1.0+fChromaticAmount_Primary*0.6,1.0+fChromaticAmount_Primary*0.9);
+#elif (USE_CHROMA_FORMULA_PRIMARY == 4)
+	float3 eta_Primary = float3(1.0+fChromaticAmount_Primary*0.3,1.0+fChromaticAmount_Primary*0.9,1.0+fChromaticAmount_Primary*0.6);
+#elif (USE_CHROMA_FORMULA_PRIMARY == 5)
+	float3 eta_Primary = float3(1.0+fChromaticAmount_Primary*0.3,1.0+fChromaticAmount_Primary*0.3,1.0+fChromaticAmount_Primary*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY == 6)
+	float3 eta_Primary = float3(1.0+fChromaticAmount_Primary*0.9,1.0+fChromaticAmount_Primary*0.3,1.0+fChromaticAmount_Primary*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY == 7)
+	float3 eta_Primary = float3(1.0+fChromaticAmount_Primary*0.9,1.0+fChromaticAmount_Primary*0.9,1.0+fChromaticAmount_Primary*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_PRIMARY == 1)
+	float LensZoom_Primary = (1.0 / fLensSize_Primary) * (fLensScaleFactor * (fScalePrimary + timepassed_Scale_Primary));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Primary = 1.0 / fLensSize_Primary;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Primary == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Primary;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Primary + fLensDistortionCubic_Primary * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Primary*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Primary*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Primary.r)*LensZoom_Primary*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Primary.g)*LensZoom_Primary*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Primary.b)*LensZoom_Primary*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif	
+
+	float amplitudePrimary = 1.0;
+	float frequencyPrimary = 1.0;
+	float TimeFactorPrimary=(0.5 * sin(2 * PI * frequencyPrimary * Timer.x * (8.0 * fIntTimeFactor_Primary)) + 0.75) * amplitudePrimary;	//+ 0.5 Non-Limiter
+	float timepassed_Light4=Timer.x* fLightVelocity_Primary;		
+	timepassed_Light4=frac(timepassed_Light4) * 2.0 - 1.0;
+	timepassed_Light4=abs(timepassed_Light4);
+
+#if (USE_LIGHT_PRIMARY == 1)
+	sunmask*=(LightParameters.w + timepassed_Light4) * (fLensIntensity * (fIntensityPrimary - timepassed_Light4 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensityPrimary);
+#endif
+#if (USE_INTENSITY_VARIATIONS_PRIMARY == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensityPrimary) * TimeFactorPrimary );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensityPrimary);
+#endif
+
+#if (USE_LENS_DISTORTIONS_PRIMARY == 1)
+	res.xyz=origcolor.xyz * sunmask;
+#else
+	res.xyz=origcolor * sunmask; 
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	THIRDARY
+ */
+
+VS_OUTPUT_POST VS_Thirdary(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_THIRDARY == 1)
+	float timepassed_5=Timer.x* fVelocity_Thirdary;			
+	timepassed_5=frac(timepassed_5) * 2.0 - 1.0;
+	timepassed_5=abs(timepassed_5);
+	float4 pos = float4(IN.pos.x + fHPosThirdary,IN.pos.y + fVPosThirdary,IN.pos.z,1.0) + timepassed_5;
+#else
+	float4 pos = float4(IN.pos.x + fHPosThirdary,IN.pos.y + fVPosThirdary,IN.pos.z,1.0);
+#endif		
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Thirdary=(Timer.x* (fScaleTimeFactor_Thirdary * 8.0));			
+	timepassed_Scale_Thirdary=frac(timepassed_Scale_Thirdary) * 2.0 - 1.0;
+	timepassed_Scale_Thirdary=abs(timepassed_Scale_Thirdary);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_THIRDARY == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScaleThirdary + timepassed_Scale_Thirdary))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScaleThirdary)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Thirdary(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+
+	//read sun visibility as amount of effect
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask, fContrastThirdary);					
+	clip(sunmask-0.02);		
+	
+	float timepassed_Scale_Thirdary=(Timer.x* (fScaleTimeFactor_Thirdary * 8.0));			
+	timepassed_Scale_Thirdary=frac(timepassed_Scale_Thirdary) * 2.0 - 1.0;
+	timepassed_Scale_Thirdary=abs(timepassed_Scale_Thirdary);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+
+#if (USE_LENS_DISTORTIONS_THIRDARY == 1)
+#if (USE_CHROMA_FORMULA_THIRDARY == 1)
+	float3 eta_Thirdary = float3(1.0+fChromaticAmount_Thirdary*0.9,1.0+fChromaticAmount_Thirdary*0.6,1.0+fChromaticAmount_Thirdary*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY == 2)
+	float3 eta_Thirdary = float3(1.0+fChromaticAmount_Thirdary*0.6,1.0+fChromaticAmount_Thirdary*0.9,1.0+fChromaticAmount_Thirdary*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY == 3)
+	float3 eta_Thirdary = float3(1.0+fChromaticAmount_Thirdary*0.3,1.0+fChromaticAmount_Thirdary*0.6,1.0+fChromaticAmount_Thirdary*0.9);
+#elif (USE_CHROMA_FORMULA_THIRDARY == 4)
+	float3 eta_Thirdary = float3(1.0+fChromaticAmount_Thirdary*0.3,1.0+fChromaticAmount_Thirdary*0.9,1.0+fChromaticAmount_Thirdary*0.6);
+#elif (USE_CHROMA_FORMULA_THIRDARY == 5)
+	float3 eta_Thirdary = float3(1.0+fChromaticAmount_Thirdary*0.3,1.0+fChromaticAmount_Thirdary*0.3,1.0+fChromaticAmount_Thirdary*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY == 6)
+	float3 eta_Thirdary = float3(1.0+fChromaticAmount_Thirdary*0.9,1.0+fChromaticAmount_Thirdary*0.3,1.0+fChromaticAmount_Thirdary*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY == 7)
+	float3 eta_Thirdary = float3(1.0+fChromaticAmount_Thirdary*0.9,1.0+fChromaticAmount_Thirdary*0.9,1.0+fChromaticAmount_Thirdary*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_THIRDARY == 1)
+	float LensZoom_Thirdary = (1.0 / fLensSize_Thirdary) * (fLensScaleFactor * (fScaleThirdary + timepassed_Scale_Thirdary));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Thirdary = 1.0 / fLensSize_Thirdary;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Thirdary == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Thirdary;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Thirdary + fLensDistortionCubic_Thirdary * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Thirdary*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Thirdary*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Thirdary.r)*LensZoom_Thirdary*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Thirdary.g)*LensZoom_Thirdary*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Thirdary.b)*LensZoom_Thirdary*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif	
+
+	float amplitudeThirdary = 1.0;
+	float frequencyThirdary = 1.0;
+	float TimeFactorThirdary=(0.5 * sin(2 * PI * frequencyThirdary * Timer.x * (8.0 * fIntTimeFactor_Thirdary)) + 0.75) * amplitudeThirdary;	//+ 0.5 Non-Limiter
+	float timepassed_Light5=Timer.x* fLightVelocity_Thirdary;		
+	timepassed_Light5=frac(timepassed_Light5) * 2.0 - 1.0;
+	timepassed_Light5=abs(timepassed_Light5);
+
+#if (USE_LIGHT_THIRDARY == 1)
+	sunmask*=(LightParameters.w + timepassed_Light5) * (fLensIntensity * (fIntensityThirdary - timepassed_Light5 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensityThirdary);
+#endif
+#if (USE_INTENSITY_VARIATIONS_THIRDARY == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensityThirdary) * TimeFactorThirdary );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensityThirdary);
+#endif
+
+#if (USE_LENS_DISTORTIONS_THIRDARY == 1)
+	res.xyz=origcolor.xyz * sunmask;
+#else
+	res.xyz=origcolor * sunmask;
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	THIRDARY_2
+ */
+
+VS_OUTPUT_POST VS_Thirdary_2(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_THIRDARY_2 == 1)
+	float timepassed_6=Timer.x* fVelocity_Thirdary_2;			
+	timepassed_6=frac(timepassed_6) * 2.0 - 1.0;
+	timepassed_6=abs(timepassed_6);
+	float4 pos = float4(IN.pos.x + fHPosThirdary_2,IN.pos.y + fVPosThirdary_2,IN.pos.z,1.0) + timepassed_6;
+#else
+	float4 pos = float4(IN.pos.x + fHPosThirdary_2,IN.pos.y + fVPosThirdary_2,IN.pos.z,1.0);
+#endif
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Thirdary_2=(Timer.x* (fScaleTimeFactor_Thirdary_2 * 8.0));			
+	timepassed_Scale_Thirdary_2=frac(timepassed_Scale_Thirdary_2) * 2.0 - 1.0;
+	timepassed_Scale_Thirdary_2=abs(timepassed_Scale_Thirdary_2);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_THIRDARY_2 == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScaleThirdary_2 + timepassed_Scale_Thirdary_2))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScaleThirdary_2)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Thirdary_2(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask, fContrastThirdary_2);					
+	clip(sunmask-0.02);		
+	
+	float timepassed_Scale_Thirdary_2=(Timer.x* (fScaleTimeFactor_Thirdary_2 * 8.0));			
+	timepassed_Scale_Thirdary_2=frac(timepassed_Scale_Thirdary_2) * 2.0 - 1.0;
+	timepassed_Scale_Thirdary_2=abs(timepassed_Scale_Thirdary_2);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+
+#if (USE_LENS_DISTORTIONS_THIRDARY_2 == 1)
+#if (USE_CHROMA_FORMULA_THIRDARY_2 == 1)
+	float3 eta_Thirdary_2 = float3(1.0+fChromaticAmount_Thirdary_2*0.9,1.0+fChromaticAmount_Thirdary_2*0.6,1.0+fChromaticAmount_Thirdary_2*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY_2 == 2)
+	float3 eta_Thirdary_2 = float3(1.0+fChromaticAmount_Thirdary_2*0.6,1.0+fChromaticAmount_Thirdary_2*0.9,1.0+fChromaticAmount_Thirdary_2*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY_2 == 3)
+	float3 eta_Thirdary_2 = float3(1.0+fChromaticAmount_Thirdary_2*0.3,1.0+fChromaticAmount_Thirdary_2*0.6,1.0+fChromaticAmount_Thirdary_2*0.9);
+#elif (USE_CHROMA_FORMULA_THIRDARY_2 == 4)
+	float3 eta_Thirdary_2 = float3(1.0+fChromaticAmount_Thirdary_2*0.3,1.0+fChromaticAmount_Thirdary_2*0.9,1.0+fChromaticAmount_Thirdary_2*0.6);
+#elif (USE_CHROMA_FORMULA_THIRDARY_2 == 5)
+	float3 eta_Thirdary_2 = float3(1.0+fChromaticAmount_Thirdary_2*0.3,1.0+fChromaticAmount_Thirdary_2*0.3,1.0+fChromaticAmount_Thirdary_2*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY_2 == 6)
+	float3 eta_Thirdary_2 = float3(1.0+fChromaticAmount_Thirdary_2*0.9,1.0+fChromaticAmount_Thirdary_2*0.3,1.0+fChromaticAmount_Thirdary_2*0.3);
+#elif (USE_CHROMA_FORMULA_THIRDARY_2 == 7)
+	float3 eta_Thirdary_2 = float3(1.0+fChromaticAmount_Thirdary_2*0.9,1.0+fChromaticAmount_Thirdary_2*0.9,1.0+fChromaticAmount_Thirdary_2*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_THIRDARY_2 == 1)
+	float LensZoom_Thirdary_2 = (1.0 / fLensSize_Thirdary_2) * (fLensScaleFactor * (fScaleThirdary_2 + timepassed_Scale_Thirdary_2));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Thirdary_2 = 1.0 / fLensSize_Thirdary_2;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Thirdary_2 == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Thirdary_2;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Thirdary_2 + fLensDistortionCubic_Thirdary_2 * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Thirdary_2*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Thirdary_2*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Thirdary_2.r)*LensZoom_Thirdary_2*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Thirdary_2.g)*LensZoom_Thirdary_2*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Thirdary_2.b)*LensZoom_Thirdary_2*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif	
+
+	float amplitudeThirdary_2 = 1.0;
+	float frequencyThirdary_2 = 1.0;
+	float TimeFactorThirdary_2=(0.5 * sin(2 * PI * frequencyThirdary_2 * Timer.x * (8.0 * fIntTimeFactor_Thirdary_2)) + 0.75) * amplitudeThirdary_2;	//+ 0.5 Non-Limiter
+	float timepassed_Light6=Timer.x* fLightVelocity_Thirdary_2;		
+	timepassed_Light6=frac(timepassed_Light6) * 2.0 - 1.0;
+	timepassed_Light6=abs(timepassed_Light6);
+
+#if (USE_LIGHT_THIRDARY_2 == 1)
+	sunmask*=(LightParameters.w + timepassed_Light6) * (fLensIntensity * (fIntensityThirdary_2 - timepassed_Light6 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensityThirdary_2);
+#endif
+#if (USE_INTENSITY_VARIATIONS_THIRDARY_2 == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensityThirdary_2) * TimeFactorThirdary_2 );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensityThirdary_2);
+#endif
+
+#if (USE_LENS_DISTORTIONS_THIRDARY_2 == 1)
+	res.xyz=origcolor.xyz * sunmask;
+#else
+	res.xyz=origcolor * sunmask;
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	PRIMARY_ALT
+ */
+
+VS_OUTPUT_POST VS_Primary_Alt(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_PRIMARY_ALT == 1)
+	float timepassed_7=Timer.x* fVelocity_Primary_Alt;			
+	timepassed_7=frac(timepassed_7) * 2.0 - 1.0;
+	timepassed_7=abs(timepassed_7);
+	float4 pos = float4(IN.pos.x + fHPosPrimary_Alt,IN.pos.y + fVPosPrimary_Alt,IN.pos.z,1.0) + timepassed_7;
+#else
+	float4 pos = float4(IN.pos.x + fHPosPrimary_Alt,IN.pos.y + fVPosPrimary_Alt,IN.pos.z,1.0);
+#endif
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Primary_Alt=(Timer.x* (fScaleTimeFactor_Primary_Alt * 80.0));			
+	timepassed_Scale_Primary_Alt=frac(timepassed_Scale_Primary_Alt) * 2.0 - 1.0;
+	timepassed_Scale_Primary_Alt=abs(timepassed_Scale_Primary_Alt);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_PRIMARY_ALT == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScalePrimary_Alt + timepassed_Scale_Primary_Alt))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScalePrimary_Alt)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Primary_Alt(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask,fContrastPrimary_Alt);					
+	clip(sunmask-0.02);
+
+	float timepassed_Scale_Primary_Alt=(Timer.x* (fScaleTimeFactor_Primary_Alt * 8.0));			
+	timepassed_Scale_Primary_Alt=frac(timepassed_Scale_Primary_Alt) * 2.0 - 1.0;
+	timepassed_Scale_Primary_Alt=abs(timepassed_Scale_Primary_Alt);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+
+#if (USE_LENS_DISTORTIONS_PRIMARY_ALT == 1)
+#if (USE_CHROMA_FORMULA_PRIMARY_ALT == 1)
+	float3 eta_Primary_Alt = float3(1.0+fChromaticAmount_Primary_Alt*0.9,1.0+fChromaticAmount_Primary_Alt*0.6,1.0+fChromaticAmount_Primary_Alt*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT == 2)
+	float3 eta_Primary_Alt = float3(1.0+fChromaticAmount_Primary_Alt*0.6,1.0+fChromaticAmount_Primary_Alt*0.9,1.0+fChromaticAmount_Primary_Alt*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT == 3)
+	float3 eta_Primary_Alt = float3(1.0+fChromaticAmount_Primary_Alt*0.3,1.0+fChromaticAmount_Primary_Alt*0.6,1.0+fChromaticAmount_Primary_Alt*0.9);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT == 4)
+	float3 eta_Primary_Alt = float3(1.0+fChromaticAmount_Primary_Alt*0.3,1.0+fChromaticAmount_Primary_Alt*0.9,1.0+fChromaticAmount_Primary_Alt*0.6);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT == 5)
+	float3 eta_Primary_Alt = float3(1.0+fChromaticAmount_Primary_Alt*0.3,1.0+fChromaticAmount_Primary_Alt*0.3,1.0+fChromaticAmount_Primary_Alt*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT == 6)
+	float3 eta_Primary_Alt = float3(1.0+fChromaticAmount_Primary_Alt*0.9,1.0+fChromaticAmount_Primary_Alt*0.3,1.0+fChromaticAmount_Primary_Alt*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT == 7)
+	float3 eta_Primary_Alt = float3(1.0+fChromaticAmount_Primary_Alt*0.9,1.0+fChromaticAmount_Primary_Alt*0.9,1.0+fChromaticAmount_Primary_Alt*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_PRIMARY_ALT == 1)
+	float LensZoom_Primary_Alt = (1.0 / fLensSize_Primary_Alt) * (fLensScaleFactor * (fScalePrimary_Alt + timepassed_Scale_Primary_Alt));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Primary_Alt = 1.0 / fLensSize_Primary_Alt;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Primary_Alt == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Primary_Alt;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Primary_Alt + fLensDistortionCubic_Primary_Alt * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Primary_Alt*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Primary_Alt*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Primary_Alt.r)*LensZoom_Primary_Alt*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Primary_Alt.g)*LensZoom_Primary_Alt*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Primary_Alt.b)*LensZoom_Primary_Alt*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif
+	float amplitudePrimary_Alt = 1.0;
+	float frequencyPrimary_Alt = 1.0;
+	float TimeFactorPrimary_Alt=(0.5 * sin(2 * PI * frequencyPrimary_Alt * Timer.x * (8.0 * fIntTimeFactor_Primary_Alt)) + 0.75) * amplitudePrimary_Alt;	//+ 0.5 Non-Limiter
+	float timepassed_Light7=Timer.x* fLightVelocity_Primary_Alt;		
+	timepassed_Light7=frac(timepassed_Light7) * 2.0 - 1.0;
+	timepassed_Light7=abs(timepassed_Light7);
+
+#if (USE_LIGHT_PRIMARY_ALT == 1)
+	sunmask*=(LightParameters.w + timepassed_Light7) * (fLensIntensity * (fIntensityPrimary_Alt - timepassed_Light7 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensityPrimary_Alt);
+#endif
+#if (USE_INTENSITY_VARIATIONS_PRIMARY_ALT == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensityPrimary_Alt) * TimeFactorPrimary_Alt );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensityPrimary_Alt);
+#endif
+
+#if (USE_LENS_DISTORTIONS_PRIMARY_ALT == 1)
+	res.xyz=origcolor.xyz * sunmask; 
+#else
+	res.xyz=origcolor * sunmask; 
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	PRIMARY_ALT_2
+ */
+
+VS_OUTPUT_POST VS_Primary_Alt_2(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_PRIMARY_ALT_2 == 1)
+	float timepassed_9=Timer.x* fVelocity_Primary_Alt_2;			
+	timepassed_9=frac(timepassed_9) * 2.0 - 1.0;
+	timepassed_9=abs(timepassed_9);
+	float4 pos = float4(IN.pos.x + fHPosPrimary_Alt_2,IN.pos.y + fVPosPrimary_Alt_2,IN.pos.z,1.0) + timepassed_9;
+#else
+	float4 pos = float4(IN.pos.x + fHPosPrimary_Alt_2,IN.pos.y + fVPosPrimary_Alt_2,IN.pos.z,1.0);
+#endif
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Primary_Alt_2=(Timer.x* (fScaleTimeFactor_Primary_Alt_2 * 8.0));			
+	timepassed_Scale_Primary_Alt_2=frac(timepassed_Scale_Primary_Alt_2) * 2.0 - 1.0;
+	timepassed_Scale_Primary_Alt_2=abs(timepassed_Scale_Primary_Alt_2);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_PRIMARY_ALT_2 == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScalePrimary_Alt_2 + timepassed_Scale_Primary_Alt_2))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScalePrimary_Alt_2)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Primary_Alt_2(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask,fContrastPrimary_Alt_2);					
+	clip(sunmask-0.02);
+
+	float timepassed_Scale_Primary_Alt_2=(Timer.x* (fScaleTimeFactor_Primary_Alt_2 * 8.0));			
+	timepassed_Scale_Primary_Alt_2=frac(timepassed_Scale_Primary_Alt_2) * 2.0 - 1.0;
+	timepassed_Scale_Primary_Alt_2=abs(timepassed_Scale_Primary_Alt_2);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+
+#if (USE_LENS_DISTORTIONS_PRIMARY_ALT_2 == 1)
+#if (USE_CHROMA_FORMULA_PRIMARY_ALT_2 == 1)
+	float3 eta_Primary_Alt_2 = float3(1.0+fChromaticAmount_Primary_Alt_2*0.9,1.0+fChromaticAmount_Primary_Alt_2*0.6,1.0+fChromaticAmount_Primary_Alt_2*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT_2 == 2)
+	float3 eta_Primary_Alt_2 = float3(1.0+fChromaticAmount_Primary_Alt_2*0.6,1.0+fChromaticAmount_Primary_Alt_2*0.9,1.0+fChromaticAmount_Primary_Alt_2*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT_2 == 3)
+	float3 eta_Primary_Alt_2 = float3(1.0+fChromaticAmount_Primary_Alt_2*0.3,1.0+fChromaticAmount_Primary_Alt_2*0.6,1.0+fChromaticAmount_Primary_Alt_2*0.9);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT_2 == 4)
+	float3 eta_Primary_Alt_2 = float3(1.0+fChromaticAmount_Primary_Alt_2*0.3,1.0+fChromaticAmount_Primary_Alt_2*0.9,1.0+fChromaticAmount_Primary_Alt_2*0.6);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT_2 == 5)
+	float3 eta_Primary_Alt_2 = float3(1.0+fChromaticAmount_Primary_Alt_2*0.3,1.0+fChromaticAmount_Primary_Alt_2*0.3,1.0+fChromaticAmount_Primary_Alt_2*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT_2 == 6)
+	float3 eta_Primary_Alt_2 = float3(1.0+fChromaticAmount_Primary_Alt_2*0.9,1.0+fChromaticAmount_Primary_Alt_2*0.3,1.0+fChromaticAmount_Primary_Alt_2*0.3);
+#elif (USE_CHROMA_FORMULA_PRIMARY_ALT_2 == 7)
+	float3 eta_Primary_Alt_2 = float3(1.0+fChromaticAmount_Primary_Alt_2*0.9,1.0+fChromaticAmount_Primary_Alt_2*0.9,1.0+fChromaticAmount_Primary_Alt_2*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_PRIMARY_ALT_2 == 1)
+	float LensZoom_Primary_Alt_2 = (1.0 / fLensSize_Primary_Alt_2) * (fLensScaleFactor * (fScalePrimary_Alt_2 + timepassed_Scale_Primary_Alt_2));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Primary_Alt_2 = 1.0 / fLensSize_Primary_Alt_2;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Primary_Alt_2 == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Primary_Alt_2;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Primary_Alt_2 + fLensDistortionCubic_Primary_Alt_2 * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Primary_Alt_2*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Primary_Alt_2*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Primary_Alt_2.r)*LensZoom_Primary_Alt_2*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Primary_Alt_2.g)*LensZoom_Primary_Alt_2*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Primary_Alt_2.b)*LensZoom_Primary_Alt_2*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif							
+
+	float amplitudePrimary_Alt_2 = 1.0;
+	float frequencyPrimary_Alt_2 = 1.0;
+	float TimeFactorPrimary_Alt_2=(0.5 * sin(2 * PI * frequencyPrimary_Alt_2 * Timer.x * (8.0 * fIntTimeFactor_Primary_Alt_2)) + 0.75) * amplitudePrimary_Alt_2;	//+ 0.5 Non-Limiter
+	float timepassed_Light9=Timer.x* fLightVelocity_Primary_Alt_2;		
+	timepassed_Light9=frac(timepassed_Light9) * 2.0 - 1.0;
+	timepassed_Light9=abs(timepassed_Light9);
+
+#if (USE_LIGHT_PRIMARY_ALT_2 == 1)
+	sunmask*=(LightParameters.w + timepassed_Light9) * (fLensIntensity * (fIntensityPrimary_Alt_2 - timepassed_Light9 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensityPrimary_Alt_2);
+#endif
+#if (USE_INTENSITY_VARIATIONS_PRIMARY_ALT_2 == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensityPrimary_Alt_2) * TimeFactorPrimary_Alt_2 );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensityPrimary_Alt_2);
+#endif
+
+#if (USE_LENS_DISTORTIONS_PRIMARY_ALT_2 == 1)
+	res.xyz=origcolor.xyz * sunmask; 
+#else
+	res.xyz=origcolor * sunmask; 
+#endif 
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	FOURTH
+ */
+
+VS_OUTPUT_POST VS_Fourth(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_FOURTH == 1)
+	float timepassed_10=Timer.x* fVelocity_Fourth;			
+	timepassed_10=frac(timepassed_10) * 2.0 - 1.0;
+	timepassed_10=abs(timepassed_10);
+	float4 pos = float4(IN.pos.x + fHPosFourth,IN.pos.y + fVPosFourth,IN.pos.z,1.0) + timepassed_10;
+#else
+	float4 pos = float4(IN.pos.x + fHPosFourth,IN.pos.y + fVPosFourth,IN.pos.z,1.0);
+#endif
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Fourth=(Timer.x* (fScaleTimeFactor_Fourth * 8.0));			
+	timepassed_Scale_Fourth=frac(timepassed_Scale_Fourth) * 2.0 - 1.0;
+	timepassed_Scale_Fourth=abs(timepassed_Scale_Fourth);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_FOURTH == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScaleFourth + timepassed_Scale_Fourth))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScaleFourth)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Fourth(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask,fContrastFourth);					
+	clip(sunmask-0.02);	
+	
+	float timepassed_Scale_Fourth=(Timer.x* (fScaleTimeFactor_Fourth * 8.0));			
+	timepassed_Scale_Fourth=frac(timepassed_Scale_Fourth) * 2.0 - 1.0;
+	timepassed_Scale_Fourth=abs(timepassed_Scale_Fourth);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+
+#if (USE_LENS_DISTORTIONS_FOURTH == 1)
+#if (USE_CHROMA_FORMULA_FOURTH == 1)
+	float3 eta_Fourth = float3(1.0+fChromaticAmount_Fourth*0.9,1.0+fChromaticAmount_Fourth*0.6,1.0+fChromaticAmount_Fourth*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH == 2)
+	float3 eta_Fourth = float3(1.0+fChromaticAmount_Fourth*0.6,1.0+fChromaticAmount_Fourth*0.9,1.0+fChromaticAmount_Fourth*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH == 3)
+	float3 eta_Fourth = float3(1.0+fChromaticAmount_Fourth*0.3,1.0+fChromaticAmount_Fourth*0.6,1.0+fChromaticAmount_Fourth*0.9);
+#elif (USE_CHROMA_FORMULA_FOURTH == 4)
+	float3 eta_Fourth = float3(1.0+fChromaticAmount_Fourth*0.3,1.0+fChromaticAmount_Fourth*0.9,1.0+fChromaticAmount_Fourth*0.6);
+#elif (USE_CHROMA_FORMULA_FOURTH == 5)
+	float3 eta_Fourth = float3(1.0+fChromaticAmount_Fourth*0.3,1.0+fChromaticAmount_Fourth*0.3,1.0+fChromaticAmount_Fourth*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH == 6)
+	float3 eta_Fourth = float3(1.0+fChromaticAmount_Fourth*0.9,1.0+fChromaticAmount_Fourth*0.3,1.0+fChromaticAmount_Fourth*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH == 7)
+	float3 eta_Fourth = float3(1.0+fChromaticAmount_Fourth*0.9,1.0+fChromaticAmount_Fourth*0.9,1.0+fChromaticAmount_Fourth*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_FOURTH == 1)
+	float LensZoom_Fourth = (1.0 / fLensSize_Fourth) * (fLensScaleFactor * (fScaleFourth + timepassed_Scale_Fourth));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Fourth = 1.0 / fLensSize_Fourth;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Fourth == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Fourth;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Fourth + fLensDistortionCubic_Fourth * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Fourth*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Fourth*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Fourth.r)*LensZoom_Fourth*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Fourth.g)*LensZoom_Fourth*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Fourth.b)*LensZoom_Fourth*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif	
+
+	float amplitudeFourth = 1.0;
+	float frequencyFourth = 1.0;
+	float TimeFactorFourth=(0.5 * sin(2 * PI * frequencyFourth * Timer.x * (8.0 * fIntTimeFactor_Fourth)) + 0.75) * amplitudeFourth;	//+ 0.5 Non-Limiter
+	float timepassed_Light10=Timer.x* fLightVelocity_Fourth;		
+	timepassed_Light10=frac(timepassed_Light10) * 2.0 - 1.0;
+	timepassed_Light10=abs(timepassed_Light10);
+
+#if (USE_LIGHT_FOURTH == 1)
+	sunmask*=(LightParameters.w + timepassed_Light10) * (fLensIntensity * (fIntensityFourth - timepassed_Light10 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensityFourth);
+#endif
+#if (USE_INTENSITY_VARIATIONS_FOURTH == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensityFourth) * TimeFactorFourth );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensityFourth);
+#endif
+
+#if (USE_LENS_DISTORTIONS_FOURTH == 1)
+	res.xyz=origcolor.xyz * sunmask; 
+#else
+	res.xyz=origcolor * sunmask; 
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+/**
+ *	FOURTH_2
+ */
+
+VS_OUTPUT_POST VS_Fourth_2(VS_INPUT_POST IN, uniform float offset, uniform float scale)
+{
+	VS_OUTPUT_POST OUT;
+#if (USE_MOTION_FOURTH_2 == 1)
+	float timepassed_11=Timer.x* fVelocity_Fourth_2;			
+	timepassed_11=frac(timepassed_11) * 2.0 - 1.0;
+	timepassed_11=abs(timepassed_11);
+	float4 pos = float4(IN.pos.x + fHPosFourth_2,IN.pos.y + fVPosFourth_2,IN.pos.z,1.0) + timepassed_11;
+#else
+	float4 pos = float4(IN.pos.x + fHPosFourth_2,IN.pos.y + fVPosFourth_2,IN.pos.z,1.0);
+#endif
+	pos.y*=ScreenSize.z;
+	float timepassed_Scale_Fourth_2=(Timer.x* (fScaleTimeFactor_Fourth_2 * 8.0));			
+	timepassed_Scale_Fourth_2=frac(timepassed_Scale_Fourth_2) * 2.0 - 1.0;
+	timepassed_Scale_Fourth_2=abs(timepassed_Scale_Fourth_2);
+
+	//TO DO : create own parameters instead of this, including uv offsets
+	float2 shift=LightParameters.xy * offset;
+
+#if (USE_SCALE_VARIATIONS_FOURTH_2 == 1)
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * (fScaleFourth_2 + timepassed_Scale_Fourth_2))  - shift;
+ #else
+	pos.xy=pos.xy*((scale * fLensScaleFactor) * fScaleFourth_2)  - shift;
+#endif
+	OUT.vpos=pos;
+	OUT.txcoord.xy=IN.txcoord.xy;
+	return OUT;
+}
+
+float4 PS_Fourth_2(VS_OUTPUT_POST IN, float2 vPos : VPOS, uniform float3 colorfilter, uniform float colormultiplier) : COLOR
+{
+	float4 res;
+	float2 coord=IN.txcoord.xy;
+	float sunmask=tex2D(SamplerMask, float2(0.5, 0.5)).x;
+	sunmask=pow(sunmask,fContrastFourth_2);					
+	clip(sunmask-0.02);	
+	
+	float timepassed_Scale_Fourth_2=(Timer.x* (fScaleTimeFactor_Fourth_2 * 8.0));			
+	timepassed_Scale_Fourth_2=frac(timepassed_Scale_Fourth_2) * 2.0 - 1.0;
+	timepassed_Scale_Fourth_2=abs(timepassed_Scale_Fourth_2);
+
+	float2 invscreensize=ScreenSize.x;
+	invscreensize.y=invscreensize.y/ScreenSize.z;
+
+#if (USE_LENS_DISTORTIONS_FOURTH_2 == 1)
+#if (USE_CHROMA_FORMULA_FOURTH_2 == 1)
+	float3 eta_Fourth_2 = float3(1.0+fChromaticAmount_Fourth_2*0.9,1.0+fChromaticAmount_Fourth_2*0.6,1.0+fChromaticAmount_Fourth_2*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH_2 == 2)
+	float3 eta_Fourth_2 = float3(1.0+fChromaticAmount_Fourth_2*0.6,1.0+fChromaticAmount_Fourth_2*0.9,1.0+fChromaticAmount_Fourth_2*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH_2 == 3)
+	float3 eta_Fourth_2 = float3(1.0+fChromaticAmount_Fourth_2*0.3,1.0+fChromaticAmount_Fourth_2*0.6,1.0+fChromaticAmount_Fourth_2*0.9);
+#elif (USE_CHROMA_FORMULA_FOURTH_2 == 4)
+	float3 eta_Fourth_2 = float3(1.0+fChromaticAmount_Fourth_2*0.3,1.0+fChromaticAmount_Fourth_2*0.9,1.0+fChromaticAmount_Fourth_2*0.6);
+#elif (USE_CHROMA_FORMULA_FOURTH_2 == 5)
+	float3 eta_Fourth_2 = float3(1.0+fChromaticAmount_Fourth_2*0.3,1.0+fChromaticAmount_Fourth_2*0.3,1.0+fChromaticAmount_Fourth_2*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH_2 == 6)
+	float3 eta_Fourth_2 = float3(1.0+fChromaticAmount_Fourth_2*0.9,1.0+fChromaticAmount_Fourth_2*0.3,1.0+fChromaticAmount_Fourth_2*0.3);
+#elif (USE_CHROMA_FORMULA_FOURTH_2 == 7)
+	float3 eta_Fourth_2 = float3(1.0+fChromaticAmount_Fourth_2*0.9,1.0+fChromaticAmount_Fourth_2*0.9,1.0+fChromaticAmount_Fourth_2*0.3);
+#endif
+	float2 center;
+	center.x = coord.x-0.5;
+	center.y = coord.y-0.5;
+
+#if (USE_SCALE_VARIATIONS_FOURTH_2 == 1)
+	float LensZoom_Fourth_2 = (1.0 / fLensSize_Fourth_2) * (fLensScaleFactor * (fScaleFourth_2 + timepassed_Scale_Fourth_2));	//Index on Timed-Size Vars
+#else
+	float LensZoom_Fourth_2 = 1.0 / fLensSize_Fourth_2;
+#endif
+
+	float r2 = (IN.txcoord.x-0.5) * (IN.txcoord.x-0.5) + (IN.txcoord.y-0.5) * (IN.txcoord.y-0.5);     
+	float f = 0;
+	if( fLensDistortionCubic_Fourth_2 == 0.0){
+ 	f = 1 + r2 * fLensDistortion_Fourth_2;
+	}else{
+      	f = 1 + r2 * (fLensDistortion_Fourth_2 + fLensDistortionCubic_Fourth_2 * sqrt(r2));
+	};
+
+	float x = (f*LensZoom_Fourth_2*(coord.x-0.5)+0.5);
+	float y = (f*LensZoom_Fourth_2*(coord.y-0.5)+0.5);
+	float2 rCoords = (f*eta_Fourth_2.r)*LensZoom_Fourth_2*(center.xy*0.5)+0.5;
+	float2 gCoords = (f*eta_Fourth_2.g)*LensZoom_Fourth_2*(center.xy*0.5)+0.5;
+	float2 bCoords = (f*eta_Fourth_2.b)*LensZoom_Fourth_2*(center.xy*0.5)+0.5;
+	float4 inputDistord = float4(tex2D(SamplerColor,rCoords).r, tex2D(SamplerColor,gCoords).g, tex2D(SamplerColor,bCoords).b, tex2D(SamplerColor,float2(x,y)).a);
+	float4 origcolor = float4(inputDistord.r,inputDistord.g,inputDistord.b,1);
+	float4 tcol=origcolor;	
+#else					
+	float4 origcolor=tex2D(SamplerColor, coord.xy);
+#endif	
+
+	float amplitudeFourth_2 = 1.0;
+	float frequencyFourth_2 = 1.0;
+	float TimeFactorFourth_2=(0.5 * sin(2 * PI * frequencyFourth_2 * Timer.x * (8.0 * fIntTimeFactor_Fourth_2)) + 0.75) * amplitudeFourth_2;	//+ 0.5 Non-Limiter
+	float timepassed_Light11=Timer.x* fLightVelocity_Fourth_2;		
+	timepassed_Light11=frac(timepassed_Light11) * 2.0 - 1.0;
+	timepassed_Light11=abs(timepassed_Light11);
+
+#if (USE_LIGHT_FOURTH_2 == 1)
+	sunmask*=(LightParameters.w + timepassed_Light11) * (fLensIntensity * (fIntensityFourth_2 - timepassed_Light11 * 1.1));		
+#else
+	sunmask*=LightParameters.w * (fLensIntensity * fIntensityFourth_2);
+#endif
+#if (USE_INTENSITY_VARIATIONS_FOURTH_2 == 1) 
+	sunmask*=LightParameters.w* ((fLensIntensity * fIntensityFourth_2) * TimeFactorFourth_2 );
+#else
+	sunmask*=LightParameters.w* (fLensIntensity * fIntensityFourth_2);
+#endif
+
+#if (USE_LENS_DISTORTIONS_FOURTH_2 == 1)
+	res.xyz=origcolor.xyz * sunmask; 
+#else
+	res.xyz=origcolor * sunmask; 
+#endif
+	float clipper=dot(res.xyz, 0.333);
+	clip(clipper-0.0003);//skip draw if black
+	res.xyz*=colorfilter * colormultiplier;
+	res.w=1.0;
+	return res;
+}
+
+//==================================================================================
+//==================================================================================
+//==================================================================================
+
+/**
+ *	TECHNIQUES
+ */
+
+technique Draw
+{
+#if (USE_SECONDARY == 1)
+	pass P0
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f1_LensOffset, (f1_LensScale * f1_LensFactor));	//offset, scale, scale factor
+		PixelShader  = compile ps_3_0 PS_Secondary(f1_LensColor, f1_ColorMultiplier);			//Color RGB
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P1
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f2_LensOffset, (f2_LensScale * f2_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f2_LensColor, f2_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P2
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f3_LensOffset, (f3_LensScale * f3_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f3_LensColor, f3_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P3
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f4_LensOffset, (f4_LensScale * f4_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f4_LensColor, f4_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P4
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f5_LensOffset, (f5_LensScale * f5_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f5_LensColor, f5_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P5
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f6_LensOffset, (f6_LensScale * f6_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f6_LensColor, f6_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P6
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f7_LensOffset, (f7_LensScale * f7_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f7_LensColor, f7_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P7
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f8_LensOffset, (f8_LensScale * f8_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f8_LensColor, f8_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P8
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f9_LensOffset, (f9_LensScale * f9_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f9_LensColor, f9_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P9
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f10_LensOffset, (f10_LensScale * f10_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f10_LensColor, f10_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P10
+	{
+		VertexShader = compile vs_3_0 VS_Secondary(f11_LensOffset, (f11_LensScale * f11_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary(f11_LensColor, f11_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+// Add or Remove passes here, then renumber passes below
+	
+#if (USE_SUNGLARE == 1)
+	pass P11
+	{
+		VertexShader = compile vs_3_0 VS_Sunglare(f12_LensScale);
+		PixelShader  = compile ps_3_0 PS_Sunglare(f12_LensColor, f12_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P12
+	{
+		VertexShader = compile vs_3_0 VS_Sunglare(f13_LensScale);	
+		PixelShader  = compile ps_3_0 PS_Sunglare(f13_LensColor, f13_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P13
+	{
+		VertexShader = compile vs_3_0 VS_Sunglare(f14_LensScale);	
+		PixelShader  = compile ps_3_0 PS_Sunglare(f14_LensColor, f14_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+//Add or Remove passes here, then renumber passes below
+
+#if (USE_SECONDARY_2 == 1)
+	pass P14
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f15_LensOffset, (f15_LensScale * f15_LensFactor));	//offset, scale, scale factor
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f15_LensColor, f15_ColorMultiplier);			//Color RGB
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P15
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f16_LensOffset, (f16_LensScale * f16_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f16_LensColor, f16_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P16
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f17_LensOffset, (f17_LensScale * f17_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f17_LensColor, f17_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P17
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f18_LensOffset, (f18_LensScale * f18_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f18_LensColor, f18_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P18
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f19_LensOffset, (f19_LensScale * f19_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f19_LensColor, f19_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P19
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f20_LensOffset, (f20_LensScale * f20_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f20_LensColor, f20_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P20
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f21_LensOffset, (f21_LensScale * f21_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f21_LensColor, f21_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P21
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f22_LensOffset, (f22_LensScale * f22_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f22_LensColor, f22_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P22
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f23_LensOffset, (f23_LensScale * f23_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f23_LensColor, f23_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P23
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f24_LensOffset, (f24_LensScale * f24_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f24_LensColor, f24_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P24
+	{
+		VertexShader = compile vs_3_0 VS_Secondary_2(f25_LensOffset, (f25_LensScale * f25_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Secondary_2(f25_LensColor, f25_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+//Add or Remove passes here, then renumber passes below
+
+#if (USE_PRIMARY == 1)
+	pass P25
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f26_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens26)* 2.0 - 1.0), (f26_LensScale * f26_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f26_LensOffset, (f26_LensScale * f26_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f26_LensColor, f26_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P26
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f27_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens27)* 2.0 - 1.0), (f27_LensScale * f27_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f27_LensOffset, (f27_LensScale * f27_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f27_LensColor, f27_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P27
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f28_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens28)* 2.0 - 1.0), (f28_LensScale * f28_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f28_LensOffset, (f28_LensScale * f28_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f28_LensColor, f28_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P28
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f29_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens29)* 2.0 - 1.0), (f29_LensScale * f29_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f29_LensOffset, (f29_LensScale * f29_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f29_LensColor, f29_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P29
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f30_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens30)* 2.0 - 1.0), (f30_LensScale * f30_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f30_LensOffset, (f30_LensScale * f30_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f30_LensColor, f30_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P30
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f31_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens31)* 2.0 - 1.0), (f31_LensScale * f31_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f31_LensOffset, (f31_LensScale * f31_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f31_LensColor, f31_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P31
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f32_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens32)* 2.0 - 1.0), (f32_LensScale * f32_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f32_LensOffset, (f32_LensScale * f32_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f32_LensColor, f32_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P32
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f33_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens33)* 2.0 - 1.0), (f33_LensScale * f33_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f33_LensOffset, (f33_LensScale * f33_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f33_LensColor, f33_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P33
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f34_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens34)* 2.0 - 1.0), (f34_LensScale * f34_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f34_LensOffset, (f34_LensScale * f34_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f34_LensColor, f34_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P34
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f35_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens35)* 2.0 - 1.0), (f35_LensScale * f35_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f35_LensOffset, (f35_LensScale * f35_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f35_LensColor, f35_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P35
+	{
+#if (USE_LENSMOTION_PRIMARY == 1)
+		VertexShader = compile vs_3_0 VS_Primary(f36_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens36)* 2.0 - 1.0), (f36_LensScale * f36_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary(f36_LensOffset, (f36_LensScale * f36_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary(f36_LensColor, f36_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+//Add or Remove passes here, then renumber passes below
+
+#if (USE_THIRDARY == 1)
+	pass P36
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f37_LensOffset, (f37_LensScale * f37_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f37_LensColor, f37_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P37
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f38_LensOffset, (f38_LensScale * f38_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f38_LensColor, f38_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P38
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f39_LensOffset, (f39_LensScale * f39_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f39_LensColor, f39_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P39
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f40_LensOffset, (f40_LensScale * f40_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f40_LensColor, f40_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P40
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f41_LensOffset, (f41_LensScale * f41_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f41_LensColor, f41_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P41
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f42_LensOffset, (f42_LensScale * f42_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f42_LensColor, f42_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P42
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f43_LensOffset, (f43_LensScale * f43_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f43_LensColor, f43_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P43
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f44_LensOffset, (f44_LensScale * f44_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f44_LensColor, f44_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P44
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f45_LensOffset, (f45_LensScale * f45_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f45_LensColor, f45_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P45
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f46_LensOffset, (f46_LensScale * f46_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f46_LensColor, f46_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P46
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary(f47_LensOffset, (f47_LensScale * f47_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary(f47_LensColor, f47_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+//Add or Remove passes here, then renumber passes below
+
+#if (USE_THIRDARY_2 == 1)
+	pass P47
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f48_LensOffset, (f48_LensScale * f48_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f48_LensColor, f48_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P48
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f49_LensOffset, (f49_LensScale * f49_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f49_LensColor, f49_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P49
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f50_LensOffset, (f50_LensScale * f50_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f50_LensColor, f50_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P50
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f51_LensOffset, (f51_LensScale * f51_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f51_LensColor, f51_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P51
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f52_LensOffset, (f52_LensScale * f52_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f52_LensColor, f52_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P52
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f53_LensOffset, (f53_LensScale * f53_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f53_LensColor, f53_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P53
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f54_LensOffset, (f54_LensScale * f54_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f54_LensColor, f54_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P54
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f55_LensOffset, (f55_LensScale * f55_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f55_LensColor, f55_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P55
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f56_LensOffset, (f56_LensScale * f56_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f56_LensColor, f56_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P56
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f57_LensOffset, (f57_LensScale * f57_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f57_LensColor, f57_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P57
+	{
+		VertexShader = compile vs_3_0 VS_Thirdary_2(f58_LensOffset, (f58_LensScale * f58_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Thirdary_2(f58_LensColor, f58_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+//Add or Remove passes here, then renumber passes below
+
+#if (USE_PRIMARY_ALT == 1)
+	pass P58
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f59_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens59)* 2.0 - 1.0), (f59_LensScale * f59_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f59_LensOffset, (f59_LensScale * f59_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f59_LensColor, f59_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P59
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f60_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens60)* 2.0 - 1.0), (f60_LensScale * f60_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f60_LensOffset, (f60_LensScale * f60_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f60_LensColor, f60_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P60
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f61_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens61)* 2.0 - 1.0), (f61_LensScale * f61_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f61_LensOffset, (f61_LensScale * f61_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f61_LensColor, f61_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P61
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f62_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens62)* 2.0 - 1.0), (f62_LensScale * f62_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f62_LensOffset, (f62_LensScale * f62_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f62_LensColor, f62_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P62
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f63_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens63)* 2.0 - 1.0), (f63_LensScale * f63_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f63_LensOffset, (f63_LensScale * f63_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f63_LensColor, f63_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P63
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f64_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens64)* 2.0 - 1.0), (f64_LensScale * f64_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f64_LensOffset, (f64_LensScale * f64_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f64_LensColor, f64_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P64
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f65_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens65)* 2.0 - 1.0), (f65_LensScale * f65_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f65_LensOffset, (f65_LensScale * f65_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f65_LensColor, f65_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P65
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f66_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens66)* 2.0 - 1.0), (f66_LensScale * f66_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f66_LensOffset, (f66_LensScale * f66_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f66_LensColor, f66_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P66
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f67_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens67)* 2.0 - 1.0), (f67_LensScale * f67_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f67_LensOffset, (f67_LensScale * f67_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f67_LensColor, f67_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P67
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f68_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens68)* 2.0 - 1.0), (f68_LensScale * f68_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f68_LensOffset, (f68_LensScale * f68_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f68_LensColor, f68_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P68
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f69_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens69)* 2.0 - 1.0), (f69_LensScale * f69_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f69_LensOffset, (f69_LensScale * f69_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f69_LensColor, f69_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P69
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f70_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens70)* 2.0 - 1.0), (f70_LensScale * f70_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f70_LensOffset, (f70_LensScale * f70_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f70_LensColor, f70_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P70
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f71_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens71)* 2.0 - 1.0), (f71_LensScale * f71_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f71_LensOffset, (f71_LensScale * f71_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f71_LensColor, f71_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P71
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f72_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens72)* 2.0 - 1.0), (f72_LensScale * f72_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f72_LensOffset, (f72_LensScale * f72_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f72_LensColor, f72_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P72
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f73_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens73)* 2.0 - 1.0), (f73_LensScale * f73_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f73_LensOffset, (f73_LensScale * f73_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f73_LensColor, f73_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P73
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f74_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens74)* 2.0 - 1.0), (f74_LensScale * f74_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f74_LensOffset, (f74_LensScale * f74_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f74_LensColor, f74_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P74
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f75_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens75)* 2.0 - 1.0), (f75_LensScale * f75_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f75_LensOffset, (f75_LensScale * f75_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f75_LensColor, f75_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P75
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f76_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens76)* 2.0 - 1.0), (f76_LensScale * f76_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt(f76_LensOffset, (f76_LensScale * f76_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt(f76_LensColor, f76_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+#endif
+
+//Add or Remove passes here, then renumber passes below
+#if (USE_PRIMARY_ALT_2 == 1)
+	pass P76
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT_2 == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f77_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens77)* 2.0 - 1.0), (f77_LensScale * f77_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f77_LensOffset, (f77_LensScale * f77_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt_2(f77_LensColor, f77_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P77
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT_2 == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f78_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens78)* 2.0 - 1.0), (f78_LensScale * f78_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f78_LensOffset, (f78_LensScale * f78_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt_2(f78_LensColor, f78_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P78
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT_2 == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f79_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens79)* 2.0 - 1.0), (f79_LensScale * f79_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f79_LensOffset, (f79_LensScale * f79_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt_2(f79_LensColor, f79_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P79
+	{
+#if (USE_LENSMOTION_PRIMARY_ALT_2 == 1)
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f80_LensOffset + abs(frac(Timer.x * fMotionVelocity_Lens80)* 2.0 - 1.0), (f80_LensScale * f80_LensFactor));
+#else
+		VertexShader = compile vs_3_0 VS_Primary_Alt_2(f80_LensOffset, (f80_LensScale * f80_LensFactor));
+#endif
+		PixelShader  = compile ps_3_0 PS_Primary_Alt_2(f80_LensColor, f80_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+#endif
+
+//Add or Remove passes here, then renumber passes below
+#if (USE_FOURTH == 1)
+	pass P80
+	{
+		VertexShader = compile vs_3_0 VS_Fourth(f81_LensOffset, (f81_LensScale * f81_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Fourth(f81_LensColor, f81_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P81
+	{
+		VertexShader = compile vs_3_0 VS_Fourth(f82_LensOffset, (f82_LensScale * f82_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Fourth(f82_LensColor, f82_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P82
+	{
+		VertexShader = compile vs_3_0 VS_Fourth(f83_LensOffset, (f83_LensScale * f83_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Fourth(f83_LensColor, f83_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+//Add or Remove passes here, then renumber passes below
+#if (USE_FOURTH_2 == 1)
+	pass P83
+	{
+		VertexShader = compile vs_3_0 VS_Fourth_2(f84_LensOffset, (f84_LensScale * f84_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Fourth_2(f84_LensColor, f84_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P84
+	{
+		VertexShader = compile vs_3_0 VS_Fourth_2(f85_LensOffset, (f85_LensScale * f85_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Fourth_2(f85_LensColor, f85_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+
+	pass P85
+	{
+		VertexShader = compile vs_3_0 VS_Fourth_2(f86_LensOffset, (f86_LensScale * f86_LensFactor));
+		PixelShader  = compile ps_3_0 PS_Fourth_2(f86_LensColor, f86_ColorMultiplier);
+
+		AlphaBlendEnable=TRUE;
+		SrcBlend=ONE;
+		DestBlend=ONE;
+
+		ColorWriteEnable = ALPHA|RED|GREEN|BLUE;
+		DitherEnable=FALSE;
+		ZEnable=FALSE;
+		CullMode=NONE;
+		ALPHATESTENABLE=FALSE;
+		SEPARATEALPHABLENDENABLE=FALSE;
+		StencilEnable=FALSE;
+		FogEnable=FALSE;
+		SRGBWRITEENABLE=FALSE;
+	}
+#endif
+
+//Add or Remove passes here, then renumber passes below
+
+}

BIN
Game Folder/enbsunsprite.tga


+ 22 - 0
Game Folder/injector.ini

@@ -0,0 +1,22 @@
+[injector]
+; See the following URL to find out what keycode a key has:
+; http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes
+
+;toggle shader keycode
+key_toggle = 145 ; 145 = the SCROLL_LOCK key
+
+;make screenshot keycode
+key_screenshot = 44 ; 44 = PRINTSCREEN
+
+;reload shader files keycode
+key_reload = 19 ; 19 = the PAUSE key
+
+
+[smaa]
+;smaa preset one of {SMAA_PRESET_LOW, SMAA_PRESET_MEDIUM, SMAA_PRESET_HIGH, SMAA_PRESET_ULTRA}
+;keep it set to SMAA_PRESET_CUSTOM to allow for custom settings
+preset = SMAA_PRESET_CUSTOM
+
+[misc]
+;set to 1 to improve steam overlay compatibility
+weird_steam_hack = 1

BIN
Game Folder/sweetfx_d3d9.dll


+ 36 - 0
README.md

@@ -0,0 +1,36 @@
+#### Íàñòðîéêè ãðàôèêè â èãðå
+
+* Brightness/ßðêîñòü: 0%
+* Texture Size/Ðàçìåð òåêñòóð: Large/Áîëüøîé
+
+* Tree Fade/Äåðåâüÿ: 40%
+* Actor Fade/Ïåðñîíàæè: 100%
+* Item Fade/Ïðåäìåòû: 100%
+* Object Fade/Îáúåêòû: 100%
+* Grass Distance: 100%
+* View Distance: 100%
+
+* Distant Land/Îòäàëåííûé ëàíäøàôò: On/Âêë.
+* Distant Buildings/Îòäàëåííûå çäàíèÿ: On/Âêë.
+* Distant Tree/Îòäàëåííûå äåðåâüÿ: On/Âêë.
+
+* Int. Shadows/Âíóòð. òåíè: 4
+* Ext. Shadows/Âíåøí. òåíè: 3
+
+* Self Shadows/Ñâîÿ òåíü: Off/Îòêë.
+* Shadows on Grass/Òåíè îò òðàâû: Off/Îòêë.
+* Tree Canopy Shadows/Òåíè îò êðîí äåðåâüåâ: On/Âêë.
+* Shadow Filtering/Ôèëüòðàöèÿ òåíåé: Low/Íèçê.
+
+* Specular Dist/Îòðàæå. ñâåò: 85%
+
+* HDR Lighting/HDR-îñâåùåíèå: On/Âêë.
+* Bloom Lighting/Ñèÿíèå: Off/Îòêë.
+
+* Water Detail/Äåòàëèçàöèÿ âîäû: High/Âûñîê.
+* Water Reflections/Îòðàæåíèÿ íà âîäå: On/Âêë.
+* Water Ripples/Âîëíû íà âîäå: Off/Îòêë.
+* Window Reflections/Îòðàæåíèÿ â îêíàõ: On/Âêë.
+* Blood decals/Ñëåäû êðîâè: High/Âûñîê.
+
+* Anti-aliasing/Ñãëàæèâàíèå: Off/Îòêë.