Advertisement
midhras

Kermles enbeffect.fx

Jul 1st, 2013
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 93.14 KB | None | 0 0
  1. //++++++++++++++++++++++++++++++++++++++++++++//
  2. // ENBSeries Effect file                      //
  3. // visit http://enbdev.com for updates        //
  4. // Copyright (c) 2007-2012 Boris Vorontsov    //
  5. // Modified by Michael Tichenor (IndigoNeko)  //
  6. //++++++++++++++++++++++++++++++++++++++++++++//
  7.  
  8. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
  9. // --JawZ-- Mixed enbeffect.fx                                  //
  10. // Code blend between Boris, HD6 and ENB Evolved enbeffect.fx   //
  11. // Nexus profile - http://skyrim.nexusmods.com/users/196978     //
  12. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
  13.  
  14. /****************************************************************/
  15. /***Kermles' Post Processing 6 based on work/ideas by --Jawz--,**/
  16. /*******HeliosDoubleSix, saltr, IndigoNeko, dpeasant, and *******/
  17. /************************Boris Vorontsov*************************/
  18. /****************************************************************/
  19. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  20. //PS If I accidentally have left code in here that you think is yours and you have not been credited//////
  21. //please let me know! I can be found on ENB forums and Skyrim Nexus under the name Kermles :) Please//////
  22. //don't hesitate to contact me for anything you need! Or just to say hi! :D///////////////////////////////
  23. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  24.  
  25. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  26. // MAIN EFFECT ACTIVATION
  27.     #define POSTPROCESS 2               // Choose which post-processing effect to use
  28.     //#define APPLYGAMECOLORCORRECTION  // This only applies to the PP 5 effects
  29.     //#define ENB_FLIPTECHNIQUE         // This will tunr every effect in here off.
  30. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  31.  
  32. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  33. // SECONDARY EFFECT ACTIVATION
  34.  
  35. // Dammit how do I flip it? Why don't all floats and defines use the same DNI calls? Raaaage!
  36.  
  37.     //#define ENABLE_FLIP_INT_EXT_FACTOR    // Flips the interior and exterior factor, so that interior settings affect exteriors and vice versa.
  38.     #define ENABLE_FLIP_NITE_DAY_FACTOR     // Flips the day and night factor, so that day settings affect nights and vice versa.
  39.  
  40.     #define HD6_BLOOM_DEBLUEIFY         // Removes blue tint from bloom, most apparent in distant fog
  41.     #define HD6_BLOOM_DEFUZZ            // Old weird serendipitous code to defuzz bloom
  42.     #define ENABLE_ENB_PALETTE          // Enable ENB Palette Mapping. "UsePaletteTexture" must be enabled in enbseries.ini
  43. //  #define ENABLE_ENB_BLOOM            // Enable ENB Bloom.
  44.     #define DIFFUSE_BLOOM               // More precise bloom that doesn't bloom the whole screen as HD6 bloom tends to do.
  45. //  #define COMBINE_BLOOM               // If enabled ENB will use both the ENB bloom and Vanilla bloom together.
  46. //  #define HD6_BLOOM_CRISP             // HD6 - BLOOM v1 - alternate crisp bloom, no hazey mud.
  47. //  #define HD6_BLOOM_SCREEN            // HD6 - BLOOM v2 - alternate bloom (using screen mode) I have abadoned this code.
  48.     #define USE_BLOOM_HSV               // Use HSV color correction for bloom. See ENB Bloom settings below.
  49. //  #define USE_BLOOM_LERP              // Use interpolation for bloom, shifting the final colors towards the bloom colors.
  50. //  #define USE_BLOOM_ADD               // Use addition for bloom, adding it to final color. WARNING: EXPERIMENTAL.
  51.     #define JZ_BLOOM_COLORIZATION       // With this enabled you can adjust the colorization of the bloom.
  52.  
  53.  
  54.     #define ENABLE_HSV                  // Enable HSV color correction. See HSV Color Correction settings below.
  55.     #define USE_HSV_SMOOTH              // Use smoothstep color controls for overall color control.
  56.     #define USE_HSV_CURVE               // Use power curve color controls for overall color control.
  57.     #define USE_HSV_EQUALIZER           // Use Color Equalizer system for specific color control.
  58.     #define JZ_COLOR_FILTER             // Adjusts the RGB values seperately, Red, Green and Blue.
  59.  
  60. //  #define ENABLE_LETTERBOX_BARS       // Enable cinematic bars (black bars at top and bottom).
  61. //  #define ENABLE_INTERLACE_VERTICAL   // Enable vertical interlacing (vertical striping).
  62. //  #define ENABLE_INTERLACE_HORIZONTAL // Enable horizontal interlacing (horizontal striping).
  63. //  #define ENABLE_VIGNETTE             // Enable vignette effect (black ring around screen).
  64. //  #define ENABLE_SEPIATONE            // Enable sepia tone effect (turns everything orange).
  65. //  #define ENABLE_GRAIN                // Enable grain effect (puts speckles on screen).
  66. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 
  67.  
  68. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  69. // INTERNAL PARAMETERS BEGINS HERE, CAN BE MODIFIED
  70. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  71.  
  72. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  73. // HD6_BLOOM_DEBLUEIFY
  74. //            Red, Green, Blue
  75. float3 bsatd = float3( 1.0, 0.74, 0.64 );   // Daytime Deblueify
  76. //                     Red, Green, Blue
  77. float3 bsatn = float3( 1.0, 0.74, 0.64 );   // Nighttime Deblueify
  78. //            Red, Green, Blue
  79. float3 bsati = float3( 1.0, 0.74, 0.64 );   // Interior Deblueify
  80. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  81.  
  82. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  83. // Palette mixer settings - Must have "UsePaletteTexture" enabled in the enbseries.ini file for these settings have an effect.
  84. float   palmixDay=1.0;          // Controls the intensity of the enbpalette.bmp
  85. float   palmixNight=0.7;        // Controls the intensity of the enbpalette.bmp
  86. float   palmixInterior=1.0;     // Controls the intensity of the enbpalette.bmp
  87. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  88.  
  89. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  90. // COLOR SETTINGS
  91. //NOTE; IF YOU SET BOTH RED, GREEN AND BLUE AT THE SAME VALUE IT WILL ACT AS AN BRIGHTNESS COMMAND. SAME GOES FOR MAGENTA, CYAN AND YELLOW.
  92. //                                     Red, Green, Blue
  93. float3  EColorFilterDay      = float3 ( 1.0, 1.0, 1.0 );    // Adjusts the RGB values seperately, Red, Green and Blue.
  94. float3  EColorFilterNight    = float3 ( 0.95, 1.05, 1.1 );  // Adjusts the RGB values seperately, Red, Green and Blue.
  95. float3  EColorFilterInterior = float3 ( 1.0, 1.0, 1.0 );    // Adjusts the RGB values seperately, Red, Green and Blue.
  96.  
  97. float3  EColorFilterSubDay      = float3 ( 0.0, 0.0, 0.0 ); // Subtract the RGB values seperately, Red, Green and Blue.
  98. float3  EColorFilterSubNight    = float3 ( 0.0, 0.0, 0.0 ); // Subtract the RGB values seperately, Red, Green and Blue.
  99. float3  EColorFilterSubInterior = float3 ( 0.0, 0.0, 0.0 ); // Subtract the RGB values seperately, Red, Green and Blue
  100.  
  101. // DAY
  102.     float   MAGENTADay          = 1.0;      // Adds specified amount of magenta color
  103.     float   MAGENTAsubDay       = 0.0;      // Subtracts specified amount of magenta color
  104.     float   CYANDay             = 1.0;      // Adds specified amount of cyan color
  105.     float   CYANsubDay          = 0.0;      // Subtracts specified amount of cyan color
  106.     float   YELLOWDay           = 1.0;      // Adds specified amount of yellow color
  107.     float   YELLOWsubDay        = 0.0;      // Subtracts specified amount of yellow color
  108. // NIGHT
  109.     float   MAGENTANight        = 1.0;      // Adds specified amount of magenta color
  110.     float   MAGENTAsubNight     = 0.0;      // Subtracts specified amount of magenta color
  111.     float   CYANNight           = 1.0;      // Adds specified amount of cyan color
  112.     float   CYANsubNight        = 0.0;      // Subtracts specified amount of cyan color
  113.     float   YELLOWNight         = 1.0;      // Adds specified amount of yellow color
  114.     float   YELLOWsubNight      = 0.0;      // Subtracts specified amount of yellow color
  115. // INTERIOR
  116.     float   MAGENTAInterior     = 1.0;      // Adds specified amount of magenta color
  117.     float   MAGENTAsubInterior  = 0.0;      // Subtracts specified amount of magenta color
  118.     float   CYANInterior        = 1.0;      // Adds specified amount of cyan color
  119.     float   CYANsubInterior     = 0.0;      // Subtracts specified amount of cyan color
  120.     float   YELLOWInterior      = 1.0;      // Adds specified amount of yellow color
  121.     float   YELLOWsubInterior   = 0.0;      // Subtracts specified amount of yellow color
  122. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  123.  
  124.  
  125. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  126. // ENB Bloom Day settings.
  127. float fBloomIntensityMultDay = 1.0;         // Controls brightness of bloom. Higher values are brighter.
  128. float fBloomIntensityModDay = 0.0;          // Controls brightness of bloom. Higher values are brighter.
  129. float fBloomIntensityCurveDay = 1.0;        // Controls brightness curve of bloom. Higher values make midranges darker.
  130. float fBloomIntensitySmoothDay = 0.0;       // Controls brightness contrast of bloom. Makes darks darker and brights brighter.
  131. float fBloomIntensityMaxDay = 10.0;         // Controls brightness maximum of bloom.
  132. float fBloomSaturationMultDay = 1.0;        // Controls the saturation of bloom. Higher values are more colorful.
  133. float fBloomSaturationCurveDay = 1.0;       // Controls the saturation curve of bloom. Higher values reduce midrange colors.
  134. float fBloomSaturationSmoothDay = 0.0;      // Controls the saturation contrast of bloom. Reduces subtle coloring.
  135.  
  136. // ENB Bloom Night settings.
  137. float fBloomIntensityMultNight = 1.0;       // Controls brightness of bloom. Higher values are brighter.
  138. float fBloomIntensityModNight = 0.0;        // Controls brightness of bloom. Higher values are brighter.
  139. float fBloomIntensityCurveNight = 1.0;      // Controls brightness curve of bloom. Higher values make midranges darker.
  140. float fBloomIntensitySmoothNight = 0.0;     // Controls brightness contrast of bloom. Makes darks darker and brights brighter.
  141. float fBloomIntensityMaxNight = 10.0;       // Controls brightness maximum of bloom.
  142. float fBloomSaturationMultNight = 1.0;      // Controls the saturation of bloom. Higher values are more colorful.
  143. float fBloomSaturationCurveNight = 1.0;     // Controls the saturation curve of bloom. Higher values reduce midrange colors.
  144. float fBloomSaturationSmoothNight = 0.0;    // Controls the saturation contrast of bloom. Reduces subtle coloring.
  145.  
  146. // ENB Bloom Interior settings.
  147. float fBloomIntensityMultInterior = 1.0;    // Controls brightness of bloom. Higher values are brighter.
  148. float fBloomIntensityModInterior = 0.0;     // Controls brightness of bloom. Higher values are brighter.
  149. float fBloomIntensityCurveInterior = 1.0;   // Controls brightness curve of bloom. Higher values make midranges darker.
  150. float fBloomIntensitySmoothInterior = 0.0;  // Controls brightness contrast of bloom. Makes darks darker and brights brighter.
  151. float fBloomIntensityMaxInterior = 10.0;    // Controls brightness maximum of bloom.
  152. float fBloomSaturationMultInterior = 1.0;   // Controls the saturation of bloom. Higher values are more colorful.
  153. float fBloomSaturationCurveInterior = 1.0;  // Controls the saturation curve of bloom. Higher values reduce midrange colors.
  154. float fBloomSaturationSmoothInterior = 0.0; // Controls the saturation contrast of bloom. Reduces subtle coloring.
  155. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  156.  
  157. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  158. // BLOOM COLORIZATION SETTINGS
  159. //NOTE; IF YOU SET BOTH RED, GREEN AND BLUE AT THE SAME VALUE IT WILL ACT AS AN AMOUNT COMMAND. SAME GOES FOR MAGENTA, CYAN AND YELLOW VALUES.
  160.  
  161. // DAY                           Red, Green, Blue
  162.     float3 bloommultDay = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue bloom colors seperately
  163.     float3 bloomsubDay  = float3( 0.0, 0.0, 0.0 ); // Alters appearance of the Red, Green and Blue bloom colors
  164.     float   MAGENTAbloomDay = 1.0;                 // Increases the amount of magenta color there is in bloom
  165.     float   CYANbloomDay    = 1.0;                 // Increases the amount of cyan color there is in bloom
  166.     float   YELLOWbloomDay  = 1.0;                 // Increases the amount of yellow color there is in bloom
  167.  
  168. // NIGHT                          Red, Green, Blue
  169.     float3 bloommultNight = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue bloom colors seperately
  170.     float3 bloomsubNight  = float3( 0.0, 0.0, 0.0 ); // Alters appearance of the Red, Green and Blue bloom colors
  171.     float   MAGENTAbloomNight = 1.0;                 // Increases the amount of magenta color there is in bloom
  172.     float   CYANbloomNight    = 1.0;                 // Increases the amount of cyan color there is in bloom
  173.     float   YELLOWbloomNight  = 1.0;                 // Increases the amount of yellow color there is in bloom
  174.  
  175. // INTERIOR                           Red, Green, Blue
  176.     float3 bloommultInterior = float3( 1.0, 0.9, 2.6 ); // Increase Red, Green and Blue bloom colors seperately
  177.     float3 bloomsubInterior  = float3( 0.0, 0.0, -0.02 ); // Alters appearance of the Red, Green and Blue bloom colors
  178.     float   MAGENTAbloomInterior = 1.0;                 // Increases the amount of magenta color there is in bloom
  179.     float   CYANbloomInterior    = 1.0;                 // Increases the amount of cyan color there is in bloom
  180.     float   YELLOWbloomInterior  = 1.0;                 // Increases the amount of yellow color there is in bloom
  181. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  182.  
  183. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  184. // Diffuse Bloom Day settings.
  185.     float REDDay = 0.8;             // Controls the red level in the diffuse bloom
  186.     float GREENDay = 0.8;           // Controls the green level in the diffuse bloom
  187.     float BLUEDay = 0.8;            // Controls the blue level in the diffuse bloom
  188.  
  189.     float SatDay = 1.2;             // Controls the saturation of the diffuse bloom
  190.     float LumaDay = 1.1;            // Controls the Luminosity/brightness of the diffuse bloom
  191.     float PowDay = 3.0;             // Dampens the bloom, making it less visible
  192.     float Pow2Day = 0.0001;         // Dampens the bloom, making it less visible
  193.        
  194. // Diffuse Bloom Night settings.
  195.     float REDNight = 1.0;           // Controls the red level in the diffuse bloom
  196.     float GREENNight = 1.0;         // Controls the green level in the diffuse bloom
  197.     float BLUENight = 1.0;          // Controls the blue level in the diffuse bloom
  198.  
  199.     float SatNight = 1.0;           // Controls the saturation of the diffuse bloom
  200.     float LumaNight = 1.0;          // Controls the Luminosity/brightness of the diffuse bloom
  201.     float PowNight = 4.0;           // Dampens the bloom, making it less visible
  202.     float Pow2Night = 0.0001;       // Dampens the bloom, making it less visible
  203.        
  204. // Diffuse Bloom Interior settings.
  205.     float REDInterior = 1.0;         // Controls the red level in the diffuse bloom
  206.     float GREENInterior = 1.0;       // Controls the green level in the diffuse bloom
  207.     float BLUEInterior = 1.0;        // Controls the blue level in the diffuse bloom
  208.  
  209.     float SatInterior = 1.0;         // Controls the saturation of the diffuse bloom
  210.     float LumaInterior = 1.0;        // Controls the Luminosity/brightness of the diffuse bloom
  211.     float PowInterior = 1.0;         // Dampens the bloom, making it less visible
  212.     float Pow2Interior = 0.0001;     // Dampens the bloom, making it less visible
  213. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  214.  
  215. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  216. // HD6 BLOOM CRISP - Alternate crisp bloom, no hazey mud.
  217.  
  218. //DAY
  219.     float3 LumCoeffDay = ( 0.2125, 0.7154, 0.0721 );    // Increases brightness around "bloomy" spots
  220.     float3 AvgLuminDay = ( 0.5, 0.5, 0.5 );             // Increases contrast around "bloomy" spots
  221.    
  222.     float TrigDay = 0.0;                // Limits what triggers a bloom
  223.     float SBrightDay = 0.5;             // Limits bloom to superbright spots only
  224.  
  225.     float CBrightnessDay = 1.0;         // Adjust the bloom brightness
  226.     float CContrastDay = 1.1;           // Adjust the bloom contrast
  227.     float CSaturationDay = 1.0;         // Adjust the bloom saturation
  228.  
  229.     float BrightnessModDay = 0.0;       // Compensate the brightness when no bloom is used
  230.     float BrightnessMultDay = 1.0;      // Compensate the brightness when no bloom is used
  231.  
  232.     float CompSBDay = 1.0;              // Limits where the bloom will "bloom"
  233.     float BloomStrDay = 1.0;            // How strong the bloom will be
  234.  
  235.     float BloomBlendDay = 0.5;          // How much blend there will be between ENB and Vanilla bloom
  236.     float BlendCompDay = 1.0;           // Compensate for brightening caused by above bloom blend
  237.        
  238. //NIGHT
  239.     float3 LumCoeffNight = ( 0.2125, 0.7154, 0.0721 );  // Increases brightness around "bloomy" spots
  240.     float3 AvgLuminNight = ( 0.5, 0.5, 0.5 );           // Increases contrast around "bloomy" spots
  241.    
  242.     float TrigNight = 0.0;              // Limits what triggers a bloom
  243.     float SBrightNight = 0.7;           // Limits bloom to superbright spots only
  244.  
  245.     float CBrightnessNight = 1.0;       // Adjust the bloom brightness
  246.     float CContrastNight = 1.1;         // Adjust the bloom contrast
  247.     float CSaturationNight = 1.0;       // Adjust the bloom saturation
  248.  
  249.     float BrightnessModNight = 0.0;     // Compensate the brightness when no bloom is used
  250.     float BrightnessMultNight = 1.0;    // Compensate the brightness when no bloom is used
  251.  
  252.     float CompSBNight = 1.0;            // Limits where the bloom will "bloom"
  253.     float BloomStrNight = 1.0;          // How strong the bloom will be
  254.  
  255.     float BloomBlendNight = 0.5;        // How much blend there will be between ENB and Vanilla bloom
  256.     float BlendCompNight = 1.0;         // Compensate for brightening caused by above bloom blend
  257.        
  258. //INTERIOR
  259.     float3 LumCoeffInterior = ( 0.2125, 0.7154, 0.0721 );   // Increases brightness around "bloomy" spots
  260.     float3 AvgLuminInterior = ( 0.5, 0.5, 0.5 );            // Increases contrast around "bloomy" spots
  261.    
  262.     float TrigInterior = 0.18;              // Limits what triggers a bloom
  263.     float SBrightInterior = 0.7;            // Limits bloom to superbright spots only
  264.  
  265.     float CBrightnessInterior = 1.0;        // Adjust the bloom brightness
  266.     float CContrastInterior = 1.1;          // Adjust the bloom contrast
  267.     float CSaturationInterior = 0.8;        // Adjust the bloom saturation
  268.  
  269.     float BrightnessModInterior = 0.0;      // Compensate the brightness when no bloom is used
  270.     float BrightnessMultInterior = 1.0;     // Compensate the brightness when no bloom is used
  271.  
  272.     float CompSBInterior = 1.0;             // Limits where the bloom will "bloom"
  273.     float BloomStrInterior = 1.0;           // How strong the bloom will be
  274.  
  275.     float BloomBlendInterior = 0.5;         // How much blend there will be between ENB and Vanilla bloom
  276.     float BlendCompInterior = 1.0;          // Compensate for brightening caused by above bloom blend
  277. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  278.  
  279. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  280. // HSV Color Correction settings.
  281.  
  282. // HSV Daytime Settings
  283. float fColorSaturationMultDay = 0.9;        // Controls the color saturation multiplier. Range: 0.0 (greyscale) to 2.0 (hypercolor).
  284. float fColorSaturationModDay = 0.0;         // Controls the color saturation. Range: -1 to 1. Default: 0.0
  285. float fColorSaturationCurveDay = 1.0;       // Controls the color saturation curve. Default: 1.0.
  286. float fColorSaturationSmoothDay = 0.0;      // Controls the color saturation contrast. Default: 0.0.
  287.  
  288. float fColorIntensityMultDay = 1.0;         // Controls the color intensity multiplier. Default: 1.0
  289. float fColorIntensityModDay = 0.0;          // Controls the color brightness. Range: -1 to 1. Default: 0.0
  290. float fColorIntensityCurveDay = 1.0;        // Controls the color intensity curve. Default: 1.0
  291. float fColorIntensitySmoothDay = 0.0;       // Controls the color intensity contrast. Default: 0.0.
  292.  
  293. float fColorHueMultDay = 1.0;               // Controls the color hue multiplier. Default: 1.0
  294. float fColorHueModDay = 0.0;                // Controls the color hue. Range: -1 to 1. Default: 0.0
  295. float fColorHueCurveDay = 1.0;              // Controls the color hue curve. Default: 1.0.
  296. float fColorHueSmoothDay = 0.0;             // Controls the color hue contrast. Default: 0.0.
  297.  
  298. // HSV Nighttime Settings
  299. float fColorSaturationMultNight = 1.0;      // Controls the color saturation multiplier. Range: 0.0 (greyscale) to 2.0 (hypercolor).
  300. float fColorSaturationModNight = 0.0;       // Controls the color saturation. Range: -1 to 1. Default: 0.0
  301. float fColorSaturationCurveNight = 1.0;     // Controls the color saturation curve. Default: 1.0.
  302. float fColorSaturationSmoothNight = 0.0;    // Controls the color saturation contrast. Default: 0.0.
  303.  
  304. float fColorIntensityMultNight = 1.0;       // Controls the color intensity multiplier. Default: 1.0
  305. float fColorIntensityModNight = 0.0;        // Controls the color brightness. Range: -1 to 1. Default: 0.0
  306. float fColorIntensityCurveNight = 1.0;      // Controls the color intensity curve. Default: 1.0
  307. float fColorIntensitySmoothNight = 0.0;     // Controls the color intensity contrast. Default: 0.0.
  308.  
  309. float fColorHueMultNight = 1.0;             // Controls the color hue multiplier. Default: 1.0
  310. float fColorHueModNight = 0.0;              // Controls the color hue. Range: -1 to 1. Default: 0.0
  311. float fColorHueCurveNight = 1.0;            // Controls the color hue curve. Default: 1.0.
  312. float fColorHueSmoothNight = 0.0;           // Controls the color hue contrast. Default: 0.0.
  313.  
  314. // HSV Interior Settings
  315. float fColorSaturationMultInterior = 1.0;   // Controls the color saturation multiplier. Range: 0.0 (greyscale) to 2.0 (hypercolor).
  316. float fColorSaturationModInterior = 0.0;    // Controls the color saturation. Range: -1 to 1. Default: 0.0
  317. float fColorSaturationCurveInterior = 1.0;  // Controls the color saturation curve. Default: 1.0.
  318. float fColorSaturationSmoothInterior = 0.0; // Controls the color saturation contrast. Default: 0.0.
  319.  
  320. float fColorIntensityMultInterior = 1.0;    // Controls the color intensity multiplier. Default: 1.0
  321. float fColorIntensityModInterior = 0.0;     // Controls the color brightness. Range: -1 to 1. Default: 0.0
  322. float fColorIntensityCurveInterior = 1.0;   // Controls the color intensity curve. Default: 1.0
  323. float fColorIntensitySmoothInterior = 0.0;  // Controls the color intensity contrast. Default: 0.0.
  324.  
  325. float fColorHueMultInterior = 1.0;          // Controls the color hue multiplier. Default: 1.0
  326. float fColorHueModInterior = 0.0;           // Controls the color hue. Range: -1 to 1. Default: 0.0
  327. float fColorHueCurveInterior = 1.0;         // Controls the color hue curve. Default: 1.0.
  328. float fColorHueSmoothInterior = 0.0;        // Controls the color hue contrast. Default: 0.0.
  329. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  330.  
  331. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  332. // HSV Equalizer settings.
  333. // Adjust multiplier and modifier of specific color saturations. Default: 0.0
  334.  
  335. float fColorSaturationMultRed = 0.0;
  336. float fColorSaturationMultOrange = 0.0;
  337. float fColorSaturationMultYellow = 0.0;
  338. float fColorSaturationMultGreen = 0.0;
  339. float fColorSaturationMultCyan = 0.0;
  340. float fColorSaturationMultBlue = 0.0;
  341. float fColorSaturationMultMagenta = 0.0;
  342.  
  343. float fColorSaturationModRed = 0.0;
  344. float fColorSaturationModOrange = 0.0;
  345. float fColorSaturationModYellow = 0.0;
  346. float fColorSaturationModGreen = 0.0;
  347. float fColorSaturationModCyan = 0.0;
  348. float fColorSaturationModBlue = 0.0;
  349. float fColorSaturationModMagenta = 0.0;
  350. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  351.  
  352. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  353. // Letterbox settings.
  354. float fLetterboxBarHeightDay = 0.02;            // Controls the height of cinematic bars. Default: 0.1.
  355. float fLetterboxBarHeightNight = 0.02;          // Controls the height of cinematic bars. Default: 0.1.
  356. float fLetterboxBarHeightInterior = 0.02;       // Controls the height of cinematic bars. Default: 0.1.
  357. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  358.  
  359. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  360. // Vertical Interlace settings.
  361. float fInterlaceVerticalWidthDay = 1.0;         // Controls the width of interlace bars in pixels. Default: 1.0.
  362. float fInterlaceVerticalWidthNight = 1.0;       // Controls the width of interlace bars in pixels. Default: 1.0.
  363. float fInterlaceVerticalWidthInterior = 1.0;    // Controls the width of interlace bars in pixels. Default: 1.0.
  364.  
  365. // Horizontal Interlace settings.
  366. float fInterlaceHorizontalWidthDay = 1.0;       // Controls the width of interlace bars in pixels. Default: 1.0.
  367. float fInterlaceHorizontalWidthNight = 1.0;     // Controls the width of interlace bars in pixels. Default: 1.0.
  368. float fInterlaceHorizontalWidthInterior = 1.0;  // Controls the width of interlace bars in pixels. Default: 1.0.
  369. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  370.  
  371. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  372. // Vignette settings Day.
  373. float fVignetteRadiusDay = 0.25;                    // Controls how large the radius of the vignette is. Larger numbers make the ring larger.
  374. float fVignetteSharpnessDay = 0.025;                // Controls how sharp the edge of the vignette is. Larger numbers make edge of the ring sharper.
  375. float fVignetteCurveDay = 2.0;                      // Controls the blending of the vignette.
  376. float2 fVignetteCenterDay = float2( 0.5, 0.5 );     // Controls the position of the vignette center on the screen.
  377. float2 fVignetteScaleDay = float2( 1.0, 1.0 );      // Controls the horizontal and vertical scaling of vignette.
  378.  
  379. // Vignette settings Night.
  380. float fVignetteRadiusNight = 0.25;                  // Controls how large the radius of the vignette is. Larger numbers make the ring larger.
  381. float fVignetteSharpnessNight = 0.025;              // Controls how sharp the edge of the vignette is. Larger numbers make edge of the ring sharper.
  382. float fVignetteCurveNight = 2.0;                    // Controls the blending of the vignette.
  383. float2 fVignetteCenterNight = float2( 0.5, 0.5 );   // Controls the position of the vignette center on the screen.
  384. float2 fVignetteScaleNight = float2( 1.0, 1.0 );    // Controls the horizontal and vertical scaling of vignette.
  385.  
  386. // Vignette settings Interior.
  387. float fVignetteRadiusInterior = 0.25;                   // Controls how large the radius of the vignette is. Larger numbers make the ring larger.
  388. float fVignetteSharpnessInterior = 0.025;               // Controls how sharp the edge of the vignette is. Larger numbers make edge of the ring sharper.
  389. float fVignetteCurveInterior = 2.0;                     // Controls the blending of the vignette.
  390. float2 fVignetteCenterInterior = float2( 0.5, 0.5 );    // Controls the position of the vignette center on the screen.
  391. float2 fVignetteScaleInterior = float2( 1.0, 1.0 );     // Controls the horizontal and vertical scaling of vignette.
  392. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  393.  
  394. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  395. // Sepia Tone settings Day.
  396. float3 fSepiaColorDay = float3( 1.0, 0.85 , 0.7 );  // Controls color of sepia tone.
  397. float fSepiaDesaturationDay = 0.5;                  // Controls amount of sepia color applied to image.
  398. float fSepiaExposureDay = 1.2;                      // Controls exposure of sepia tone.
  399.  
  400. // Sepia Tone settings Night.
  401. float3 fSepiaColorNight = float3( 1.0, 0.85 , 0.7 );    // Controls color of sepia tone.
  402. float fSepiaDesaturationNight = 0.5;                    // Controls amount of sepia color applied to image.
  403. float fSepiaExposureNight = 1.2;                        // Controls exposure of sepia tone.
  404.  
  405. // Sepia Tone settings Interior.
  406. float3 fSepiaColorInterior = float3( 1.0, 0.85 , 0.7 ); // Controls color of sepia tone.
  407. float fSepiaDesaturationInterior = 0.5;                 // Controls amount of sepia color applied to image.
  408. float fSepiaExposureInterior = 1.2;                     // Controls exposure of sepia tone.
  409. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  410.  
  411. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  412. // Grain settings Day.
  413. float fGrainIntensityDay = 0.1;         // Controls the intensity of the grain effect.
  414. float fGrainSaturationDay = 0.25;       // Controls the color saturation of the grain effect.
  415. float fGrainMotionDay = 0.05;           // Controls how rapidly the grain effect changes over time.
  416.  
  417. // Grain settings Night.
  418. float fGrainIntensityNight = 0.1;       // Controls the intensity of the grain effect.
  419. float fGrainSaturationNight = 0.25;     // Controls the color saturation of the grain effect.
  420. float fGrainMotionNight = 0.05;         // Controls how rapidly the grain effect changes over time.
  421.  
  422. // Grain settings Interior.
  423. float fGrainIntensityInterior = 0.025;  // Controls the intensity of the grain effect.
  424. float fGrainSaturationInterior = 0.05;  // Controls the color saturation of the grain effect.
  425. float fGrainMotionInterior = 0.025;     // Controls how rapidly the grain effect changes over time.
  426. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  427.  
  428. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  429. // MODIFY THESE VALUES BELOW TO TWEAK VARIOUS COLOR PROCESSING OPTIONS
  430. // SET ALL VALUES TO 1.0 AND IT WILL GETA "VANILLA LOOKING" COLOR PROCESSING.
  431. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  432.  
  433. //POSTPROCESS v1 by ENB
  434. #if POSTPROCESS == 1
  435. //DAY
  436.     float   EAdaptationMinV1Day = 0.01;
  437.     float   EAdaptationMaxV1Day = 0.07;
  438.  
  439.     float   EContrastV1Day = 0.95;
  440.     float   EColorSaturationV1Day = 1.2;
  441.     float   EToneMappingCurveV1Day = 6.0;
  442.  
  443. //NIGHT
  444.     float   EAdaptationMinV1Night = 0.01;
  445.     float   EAdaptationMaxV1Night = 0.15;
  446.  
  447.     float   EContrastV1Night = 0.95;
  448.     float   EColorSaturationV1Night = 1.0;
  449.     float   EToneMappingCurveV1Night = 6.0;
  450.  
  451. //INTERIOR
  452.     float   EAdaptationMinV1Interior = 0.01;
  453.     float   EAdaptationMaxV1Interior = 0.15;
  454.  
  455.     float   EContrastV1Interior = 0.95;
  456.     float   EColorSaturationV1Interior = 1.0;
  457.     float   EToneMappingCurveV1Interior = 6.0;
  458. #endif
  459. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  460.  
  461. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  462. //POSTPROCESS v2 by ENB (modifications and tweaks by Bronze316)
  463. #if POSTPROCESS == 2
  464. //DAY
  465.     float   EBrightnessV2Day=1.00;
  466.     float   EAdaptationMinV2Day=0.23;
  467.     float   EAdaptationMaxV2Day=0.52;
  468.     float   EToneMappingCurveV2Day=1.250;
  469.     float   EIntensityContrastV2Day=1.125;
  470.     float   EColorSaturationV2Day=0.85;
  471.     float   EToneMappingOversaturationV2Day=1060.0;
  472.  
  473.     float   HCompensateSatV2Day = 0.80;
  474.        
  475. //NIGHT
  476.     float   EBrightnessV2Night=1.0;
  477.     float   EAdaptationMinV2Night=0.04;
  478.     float   EAdaptationMaxV2Night=0.06;
  479.     float   EToneMappingCurveV2Night=2.0;
  480.     float   EIntensityContrastV2Night=1.475;
  481.     float   EColorSaturationV2Night=1;
  482.     float   EToneMappingOversaturationV2Night=1650.0;
  483.  
  484.     float   HCompensateSatV2Night = 0.1;
  485.    
  486. //INTERIOR
  487.     float   EBrightnessV2Interior=1.0;
  488.     float   EAdaptationMinV2Interior=0.02;
  489.     float   EAdaptationMaxV2Interior=0.06;
  490.     float   EToneMappingCurveV2Interior=22.0;
  491.     float   EIntensityContrastV2Interior=1.3;
  492.     float   EColorSaturationV2Interior=1.2;
  493.     float   EToneMappingOversaturationV2Interior=1650.0;
  494.  
  495.     float   HCompensateSatV2Interior = 1.3;
  496.  
  497. #endif
  498. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  499.  
  500. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  501. //POSTPROCESS v3 by ENB
  502. #if POSTPROCESS == 3
  503. //DAY
  504.     float   EAdaptationMinV3Day = 0.08;
  505.     float   EAdaptationMaxV3Day = 0.125;
  506.  
  507.     float   EToneMappingCurveV3Day = 1.75;
  508.     float   EToneMappingOversaturationV3Day = 260.0;
  509.  
  510. //NIGHT
  511.     float   EAdaptationMinV3Night = 0.05;
  512.     float   EAdaptationMaxV3Night = 0.125;
  513.  
  514.     float   EToneMappingCurveV3Night = 4.0;
  515.     float   EToneMappingOversaturationV3Night = 60.0;
  516.  
  517. //Interior
  518. //  float   EAdaptationMinV3Interior = 0.04;
  519. //  float   EAdaptationMaxV3Interior = 0.06;
  520.     float   EAdaptationMinV3Interior = 0.08;
  521.     float   EAdaptationMaxV3Interior = 0.10;   
  522. //  float   EAdaptationMinV3Interior = 0.10;
  523. //  float   EAdaptationMaxV3Interior = 0.125;
  524.  
  525.    
  526.     float   EToneMappingCurveV3Interior = 4.0;
  527.     float   EToneMappingOversaturationV3Interior = 60.0;
  528. #endif
  529. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  530.  
  531. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  532. //POSTPROCESS v4 by ENB
  533. #if POSTPROCESS == 4
  534. //DAY
  535.     float   EAdaptationMinV4Day = 0.2;
  536.     float   EAdaptationMaxV4Day = 0.125;
  537.  
  538.     float   EBrightnessCurveV4Day = 0.7;
  539.     float   EBrightnessMultiplierV4Day = 0.45;
  540.     float   EBrightnessToneMappingCurveV4Day = 0.5;
  541.  
  542. //NIGHT
  543.     float   EAdaptationMinV4Night = 0.2;
  544.     float   EAdaptationMaxV4Night = 0.125;
  545.  
  546.     float   EBrightnessCurveV4Night = 0.7;
  547.     float   EBrightnessMultiplierV4Night = 0.45;
  548.     float   EBrightnessToneMappingCurveV4Night = 0.5;
  549.  
  550. //Interior
  551.     float   EAdaptationMinV4Interior = 0.2;
  552.     float   EAdaptationMaxV4Interior = 0.125;
  553.  
  554.     float   EBrightnessCurveV4Interior = 0.7;
  555.     float   EBrightnessMultiplierV4Interior = 0.45;
  556.     float   EBrightnessToneMappingCurveV4Interior = 0.5;
  557. #endif
  558. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  559.  
  560. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  561. //POSTPROCESS v5 by HD6 based on Post-process v2
  562. #if POSTPROCESS == 5
  563. //DAY
  564.     float   EAdaptationMinV5Day = 0.12;
  565.     float   EAdaptationMaxV5Day = 0.29;
  566.    
  567.     float   EToneMappingCurveV5Day = 1.0;
  568.     float   EIntensityContrastV5Day = 1.0;
  569.     float   EColorSaturationV5Day = 1.0;
  570.     float   HCompensateSatV5Day = 1.0;
  571.  
  572. //NIGHT
  573.     float   EAdaptationMinV5Night = 0.12;
  574.     float   EAdaptationMaxV5Night = 0.29;
  575.    
  576.     float   EToneMappingCurveV5Night = 1.0;
  577.     float   EIntensityContrastV5Night = 1.0;
  578.     float   EColorSaturationV5Night = 1.0;
  579.     float   HCompensateSatV5Night = 1.0;
  580.  
  581. //Interior
  582.     float   EAdaptationMinV5Interior = 0.12;
  583.     float   EAdaptationMaxV5Interior = 0.29;
  584.  
  585.     float   EToneMappingCurveV5Interior = 1.0;
  586.     float   EIntensityContrastV5Interior = 1.0;
  587.     float   EColorSaturationV5Interior = 1.0;
  588.     float   HCompensateSatV5Interior = 1.0;
  589. #endif
  590. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  591.  
  592. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  593. //Improved Tonemapping post processing effects Copyright (c) 2012 Brodiggan Gale edited by Kermles
  594. #if POSTPROCESS == 6
  595. //DAY
  596.     float   EBrightnessV6Day = 2.0;                         //higher than normal values needed for shadow and brightspot to work correctly
  597.     float   EIntensityContrastV6Day = 1.7;                  //very powerful, be careful of high values
  598.     float   EColorSaturationV6Day = 1.15;                   //very powerful, be careful of high values
  599.     float   HCompensateSatV6Day = 5.0;                      //higher than normal values needed for shadow and brightspot to work correctly
  600.     float   EAdaptationMinV6Day = 0.54;                     //works differently than usual, be careful with too high/too low values
  601.     float   EAdaptationMaxV6Day = 0.554;                    //works differently than usual, be careful with too high/too low values
  602.     float   EAdaptationCompensateV6Day = 0.9;               //darkening that happens after adaptation, higher is darker
  603.     float   EBrightnessMinV6Day = 0.0;                      //clamps rgb brightness, range 0-1
  604.     float   EBrightnessMaxV6Day = 1.0;                      //clamps rgb brightness, range 0-1
  605.     float   EToneMappingCurveV6Day = 12;
  606.     float   EToneMappingOversaturationV6Day = 500.0;       
  607.     float   EHSVDesatCurveDay = 1.0444444;                  //intelligent desaturation, idea credit goes to saltr. higher is less saturated
  608. ///////////////////////////////////Red Green Blue
  609.     float3  EMoodColorDay = float3(0.55, 0.3, 0.1);        
  610.     float   EMoodAmountDay = 1.0;                           //higher is stronger, range 0-1
  611.     float   EMoodCurveDay = 4.0;                            //lower is stronger, be careful of going under 1.0
  612. /////////////////////////////////////Red Green Blue
  613.     float3  EShadowColorDay = float3(0.0, 0.0, 0.55);       //unlike other two color controls, colors shadows/dark spots only. max is 2.55
  614.     float   EShadowThresholdDay = 1.0;                      //lower is stronger, be careful of low values under 0.4
  615.     float   EShadowCurveDay = 16.0;                         //lower is stronger, be careful of low values under 4
  616. //////////////////////////////////////////Red Green Blue
  617.     float3  EBrightSpotColorDay = float3(0.0, 0.25, 2.55);
  618.     float   EBrightSpotThresholdDay = 0.8;                  //lower is stronger, be careful of low values under 0.4
  619.     float   EBrightSpotCurveDay = 38.0;                     //lower is stronger, be careful of low values under 4
  620.  
  621. //NIGHT
  622.     float   EBrightnessV6Night=3.8;
  623.     float   EIntensityContrastV6Night=1.5;
  624.     float   EColorSaturationV6Night = 1.3;
  625.     float   HCompensateSatV6Night = 3.5;
  626.     float   EAdaptationMinV6Night = 0.58;
  627.     float   EAdaptationMaxV6Night = 0.24;
  628.     float   EAdaptationCompensateV6Night = 1.0;
  629.     float   EBrightnessMinV6Night = 0.00;
  630.     float   EBrightnessMaxV6Night = 7.0;
  631.     float   EToneMappingCurveV6Night = 18.0;
  632.     float   EToneMappingOversaturationV6Night = 500.0;
  633.     float   EHSVDesatCurveNight = 1.244444;
  634. /////////////////////////////////////Red Green Blue
  635.     float3  EMoodColorNight = float3(0.5, 0.2, 0.85);
  636.     float   EMoodAmountNight = 0.0;
  637.     float   EMoodCurveNight = 2.0;
  638. ///////////////////////////////////////Red Green Blue
  639.     float3  EShadowColorNight = float3(0.0, 0.0, 0.55);
  640.     float   EShadowThresholdNight = 1.0;
  641.     float   EShadowCurveNight = 18.0;
  642. ////////////////////////////////////////////Red Green Blue
  643.     float3  EBrightSpotColorNight = float3(2.55, 1.75, 1.0);
  644.     float   EBrightSpotThresholdNight = 0.6;
  645.     float   EBrightSpotCurveNight = 48.0;
  646.  
  647. //Interior
  648.     float   EBrightnessV6Interior=4.5;
  649.     float   EIntensityContrastV6Interior=1.7;
  650.     float   EColorSaturationV6Interior = 1.35;
  651.     float   HCompensateSatV6Interior = 5.0;
  652.     float   EAdaptationMinV6Interior = 0.64;
  653.     float   EAdaptationMaxV6Interior = 0.14;
  654.     float   EAdaptationCompensateV6Interior =1.6;
  655.     float   EBrightnessMinV6Interior = 0.0;
  656.     float   EBrightnessMaxV6Interior = 5.0;
  657.     float   EToneMappingCurveV6Interior =18.0;
  658.     float   EToneMappingOversaturationV6Interior = 4500.0;
  659.     float   EHSVDesatCurveInt = 1.144444;
  660. ///////////////////////////////////Red Green Blue
  661.     float3  EMoodColorInt = float3(0.3, 0.0, 1.55);
  662.     float   EMoodAmountInt = 1.0;
  663.     float   EMoodCurveInt = 4.0;
  664. /////////////////////////////////////Red Green Blue
  665.     float3  EShadowColorInt = float3(0.0, 0.0, 2.55);
  666.     float   EShadowThresholdInt = 1.0;
  667.     float   EShadowCurveInt = 18.0;
  668. /////////////////////////////////////////Red Green Blue
  669.     float3  EBrightSpotColorInt = float3(2.55, 0.4, 0.0);
  670.     float   EBrightSpotThresholdInt = 1.0;
  671.     float   EBrightSpotCurveInt = 36.0;
  672. #endif
  673.         //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  674.         // Improved Tonemapping Functions
  675.         //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  676.         // fitRange: Take an input value (x) on the range [a, b] and return a value mapped to the range [c, d].
  677.         float fitRange (float a, float b, float x, float c, float d) {
  678.         //  if ( a == b ) return (c + d)/2; //Invalid input range, there is no 1 to 1 mapping of the range [a,b] to [c,d]. Since no particular value is valid, return the average of [c,d].
  679.         //  if ( c == d ) return c; //Invalid output range, there is no 1 to 1 mapping of the range [a,b] to [c,d]. Regardless of the input value (x), the output will be equal to (c) when mapped to this invalid range.
  680.             return ((d - c) * (x - a) / (b - a)) + c;
  681.         }
  682.  
  683.         // pCurve: Takes an input value (x) on the range [-1, 1] and a curve depth (n), fits values to a bell (ish) curve (actually a portion of the Lorentz curve if (n) is equal to pi, but close enough).
  684.         // Returns values for x=[-1, 1] ranging from 0 to 1, peeking at 1 where x = 0 (and falling to 0 at x=-1 and x=1). Values outside this range are negative.
  685.         // Note: (n) must be positive and non-zero. This function must not be passed any value for n <= 0.0.
  686.         float pCurve (float x, float n) {
  687.             return ((n + 1) / (n * (1 + (n * pow(x, 2))))) - (1/n);
  688.         }
  689.  
  690.         // sCurve: Takes an input value (x) on the range [-1, 1] and a curve depth (n), fits values to a smooth s-curve.
  691.         // Returns values for x=(-1, 1] ranging from 0 to 1, peeking at 1.0 where x = 1. Values outside this range are invalid.
  692.         // Note: The range (-1, 1] for (x) does not include -1.0. This function must not be passed x = -1.0.
  693.         float sCurve (float x, float n) {
  694.             return 1 / (1 + pow((1 - x)/(1 + x), n));
  695.         }
  696.  
  697.         // peakCurve: Wrapper for pCurve, takes an input value (x) on the range [a,b], along with a curve depth (n),
  698.         // Checks for invalid values, fits (x) to the appropriate range, then calls pCurve.
  699.         float peakCurve (float a, float b, float x, float n) {
  700.             if (n <= 0.0) return -1.0; // check for invalid curve depth (n)
  701.             x = fitRange(a, b, x, -1.0, 1.0);
  702.             return pCurve(x, n);
  703.         }
  704.  
  705.         // smoothCurve: Wrapper for sCurve, takes an input value (x) on the range [a,b], along with a curve depth (n).
  706.         // Checks for invalid values, fits (x) to the appropriate range, then calls sCurve.
  707.         float smoothCurve (float a, float b, float x, float n) {
  708.             if (x <= a) return 0.0; //return 0.0 if x is below the range.
  709.             if (x >= b) return 1.0; //return 1.0 if x is below the range.
  710.             x = fitRange(a, b, x,  -1.0, 1.0);
  711.             return sCurve(x, n);
  712.         }
  713.  
  714.         // compoundCurve: Wrapper for sCurve, take an input value (x) and a crossover point (c) on the range [a,b], along with a curve depth (n).
  715.         // Check for invalid values, fit x < c to the range (-1, 0] and x > c to the range [0, 1), call sCurve, then scale the result to the appropriate range based on c.
  716.         float compoundCurve (float a, float b, float x, float n, float c) {
  717.             if (x <= a) return 0.0; //return 0.0 if x is below the range.
  718.             if (x >= b) return 1.0; //return 1.0 if x is below the range.
  719.  
  720.             if (c <= a) return -1.0; //invalid crossover point
  721.             if (c >= b) return -1.0; //invalid crossover point
  722.  
  723.             float cMult = fitRange(a, b, c, 0.0, 2.0);
  724.            
  725.             if (x <= c) {
  726.                 return cMult * sCurve(fitRange(a, c, x, -1.0, 0.0), n);
  727.             } else {
  728.                 return ((2.0 - cMult) * sCurve(fitRange(c, b, x, 0.0, 1.0), n)) + (cMult - 1);
  729.             }
  730.         }
  731.  
  732. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  733.  
  734. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  735. // EXTERNAL PARAMETERS BEGINS HERE, SHOULD NOT BE MODIFIED UNLESS YOU KNOW WHAT YOU ARE DOING!!!
  736. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  737.  
  738. // List of floating point values for hues, used in equalizer.
  739. float   fHueRed = 0.0;
  740. float   fHueOrange = 0.08333333;
  741. float   fHueYellow = 0.16666667;
  742. float   fHueGreen = 0.33333333;
  743. float   fHueCyan = 0.5;
  744. float   fHueBlue = 0.66666667;
  745. float   fHueMagenta = 0.83333333;
  746. float   fHueRed2 = 1.0;
  747.  
  748. ///////////////
  749. // FUNCTIONS //
  750. ///////////////
  751. float ColorEqualizerMult(in float H)
  752. {
  753.  
  754.     float SMult = 1.0;
  755.     SMult += fColorSaturationMultRed * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) );
  756.     SMult += fColorSaturationMultOrange * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) );
  757.     SMult += fColorSaturationMultYellow * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) );
  758.     SMult += fColorSaturationMultGreen * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) );
  759.     SMult += fColorSaturationMultCyan * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) );
  760.     SMult += fColorSaturationMultBlue * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) );
  761.     SMult += fColorSaturationMultMagenta * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) );
  762.     SMult += fColorSaturationMultRed * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) );
  763.     return SMult;
  764. }
  765.  
  766. float ColorEqualizerMod(in float H)
  767. {
  768.  
  769.  
  770.     float SMod = 0.0;
  771.     SMod += fColorSaturationModRed * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) );
  772.     SMod += fColorSaturationModOrange * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) );
  773.     SMod += fColorSaturationModYellow * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) );
  774.     SMod += fColorSaturationModGreen * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) );
  775.     SMod += fColorSaturationModCyan * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) );
  776.     SMod += fColorSaturationModBlue * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) );
  777.     SMod += fColorSaturationModMagenta * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) );
  778.     SMod += fColorSaturationModRed * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) );
  779.     return SMod;
  780. }
  781.  
  782. float3 HUEtoRGB(in float H)
  783. {
  784.     float R = abs(H * 6.0 - 3.0) - 1.0;
  785.     float G = 2.0 - abs(H * 6.0 - 2.0);
  786.     float B = 2.0 - abs(H * 6.0 - 4.0);
  787.     return saturate(float3(R,G,B));
  788. }
  789.  
  790. float RGBCVtoHUE(in float3 RGB, in float C, in float V)
  791. {
  792.       float3 Delta = (V - RGB) / C;
  793.       Delta.rgb -= Delta.brg;
  794.       Delta.rgb += float3(2.0,4.0,6.0);
  795.       Delta.brg = step(V, RGB) * Delta.brg;
  796.       float H;
  797.       H = max(Delta.r, max(Delta.g, Delta.b));
  798.       return frac(H / 6.0);
  799. }
  800.  
  801. float3 HSVtoRGB(in float3 HSV)
  802. {
  803.     float3 RGB = HUEtoRGB(HSV.x);
  804.     return ((RGB - 1) * HSV.y + 1) * HSV.z;
  805. }
  806.  
  807. float3 RGBtoHSV(in float3 RGB)
  808. {
  809.     float3 HSV = 0.0;
  810.     HSV.z = max(RGB.r, max(RGB.g, RGB.b));
  811.     float M = min(RGB.r, min(RGB.g, RGB.b));
  812.     float C = HSV.z - M;
  813.     if (C != 0.0)
  814.     {
  815.       HSV.x = RGBCVtoHUE(RGB, C, HSV.z);
  816.       HSV.y = C / HSV.z;
  817.     }
  818.     return HSV;
  819. }
  820.  
  821. float random(in float2 uv)
  822. {
  823.     float2 noise = (frac(sin(dot(uv , float2(12.9898,78.233) * 2.0)) * 43758.5453));
  824.     return abs(noise.x + noise.y) * 0.5;
  825. }
  826.  
  827. float smootherstep(float edge0, float edge1, float x)
  828. {
  829.     x = saturate((x - edge0)/(edge1 - edge0));
  830.     return x*x*(3 - 2*x);
  831. }
  832.  
  833.  
  834. //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
  835. float4   tempF1;     //0,1,2,3
  836. float4   tempF2;     //5,6,7,8
  837. float4   tempF3;     //9,0
  838. float4   Timer;      //x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
  839. float4   ScreenSize;     //x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
  840. float   ENightDayFactor; //changes in range 0..1, 0 means that night time, 1 - day time
  841. float   EInteriorFactor; //changes 0 or 1. 0 means that exterior, 1 - interior
  842. float   EBloomAmount;    //enb version of bloom applied, ignored if original post processing used
  843.  
  844.  
  845. texture2D texs0;//color
  846. texture2D texs1;//bloom skyrim
  847. texture2D texs2;//adaptation skyrim
  848. texture2D texs3;//bloom enb
  849. texture2D texs4;//adaptation enb
  850. texture2D texs7;//palette enb
  851.  
  852. sampler2D _s0 = sampler_state
  853. {
  854.    Texture   = <texs0>;
  855.    MinFilter = POINT;//
  856.    MagFilter = POINT;//
  857.    MipFilter = NONE;//LINEAR;
  858.    AddressU  = Clamp;
  859.    AddressV  = Clamp;
  860.    SRGBTexture=FALSE;
  861.    MaxMipLevel=0;
  862.    MipMapLodBias=0;
  863. };
  864.  
  865. sampler2D _s1 = sampler_state
  866. {
  867.    Texture   = <texs1>;
  868.    MinFilter = LINEAR;//
  869.    MagFilter = LINEAR;//
  870.    MipFilter = NONE;//LINEAR;
  871.    AddressU  = Clamp;
  872.    AddressV  = Clamp;
  873.    SRGBTexture=FALSE;
  874.    MaxMipLevel=0;
  875.    MipMapLodBias=0;
  876. };
  877.  
  878. sampler2D _s2 = sampler_state
  879. {
  880.    Texture   = <texs2>;
  881.    MinFilter = LINEAR;//
  882.    MagFilter = LINEAR;//
  883.    MipFilter = NONE;//LINEAR;
  884.    AddressU  = Clamp;
  885.    AddressV  = Clamp;
  886.    SRGBTexture=FALSE;
  887.    MaxMipLevel=0;
  888.    MipMapLodBias=0;
  889. };
  890.  
  891. sampler2D _s3 = sampler_state
  892. {
  893.    Texture   = <texs3>;
  894.    MinFilter = LINEAR;//
  895.    MagFilter = LINEAR;//
  896.    MipFilter = NONE;//LINEAR;
  897.    AddressU  = Clamp;
  898.    AddressV  = Clamp;
  899.    SRGBTexture=FALSE;
  900.    MaxMipLevel=0;
  901.    MipMapLodBias=0;
  902. };
  903.  
  904. sampler2D _s4 = sampler_state
  905. {
  906.    Texture   = <texs4>;
  907.    MinFilter = LINEAR;//
  908.    MagFilter = LINEAR;//
  909.    MipFilter = NONE;//LINEAR;
  910.    AddressU  = Clamp;
  911.    AddressV  = Clamp;
  912.    SRGBTexture=FALSE;
  913.    MaxMipLevel=0;
  914.    MipMapLodBias=0;
  915. };
  916.  
  917. sampler2D _s7 = sampler_state
  918. {
  919.    Texture   = <texs7>;
  920.    MinFilter = LINEAR;
  921.    MagFilter = LINEAR;
  922.    MipFilter = NONE;
  923.    AddressU  = Clamp;
  924.    AddressV  = Clamp;
  925.    SRGBTexture=FALSE;
  926.    MaxMipLevel=0;
  927.    MipMapLodBias=0;
  928. };
  929.  
  930. struct VS_OUTPUT_POST
  931. {
  932.    float4 vpos  : POSITION;
  933.    float2 txcoord0 : TEXCOORD0;
  934. };
  935. struct VS_INPUT_POST
  936. {
  937.    float3 pos  : POSITION;
  938.    float2 txcoord0 : TEXCOORD0;
  939. };
  940.  
  941.  
  942.  
  943. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  944. //
  945. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  946. VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
  947. {
  948.    VS_OUTPUT_POST OUT;
  949.  
  950.    OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  951.  
  952.    OUT.txcoord0.xy=IN.txcoord0.xy;
  953.  
  954.    return OUT;
  955. }
  956.  
  957.  
  958. //skyrim shader specific externals, do not modify
  959. float4   _c1 : register(c1);
  960. float4   _c2 : register(c2);
  961. float4   _c3 : register(c3);
  962. float4   _c4 : register(c4);
  963. float4   _c5 : register(c5);
  964.  
  965. float4 PS_D6EC7DD1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
  966. {
  967.    float4 _oC0=0.0; //output
  968.  
  969.    float4 _c6=float4(0, 0, 0, 0);
  970.    float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
  971.  
  972.    float4 r0;
  973.    float4 r1;
  974.    float4 r2;
  975.    float4 r3;
  976.    float4 r4;
  977.    float4 r5;
  978.    float4 r6;
  979.    float4 r7;
  980.    float4 r8;
  981.    float4 r9;
  982.    float4 r10;
  983.    float4 r11;
  984.  
  985.     ////////////////////
  986.     // LETTERBOX CODE //
  987.     ////////////////////
  988.  
  989.     #ifdef ENABLE_LETTERBOX_BARS
  990.    
  991.         float LBInteriorFactor = EInteriorFactor;
  992.         float LBNightDayFactor = ENightDayFactor;
  993.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  994.             LBInteriorFactor = 1 - EInteriorFactor;
  995.         #endif
  996.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  997.             LBNightDayFactor = 1 - ENightDayFactor;
  998.         #endif
  999.        
  1000.         float fLetterboxBarHeight =lerp( lerp( fLetterboxBarHeightDay, fLetterboxBarHeightNight, LBNightDayFactor ), fLetterboxBarHeightInterior, LBInteriorFactor );
  1001.    
  1002.     if( IN.txcoord0.y > 1.0 - fLetterboxBarHeight || IN.txcoord0.y  < fLetterboxBarHeight )
  1003.     {
  1004.         return _c6;
  1005.     }
  1006.     #endif
  1007.    
  1008.     ////////////////////
  1009.     // INTERLACE CODE //
  1010.     ////////////////////
  1011.     #ifdef ENABLE_INTERLACE_VERTICAL
  1012.  
  1013.         float InVInteriorFactor = EInteriorFactor;
  1014.         float InVNightDayFactor = ENightDayFactor;
  1015.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1016.             InVInteriorFactor = 1 - EInteriorFactor;
  1017.         #endif
  1018.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1019.             InVNightDayFactor = 1 - ENightDayFactor;
  1020.         #endif
  1021.        
  1022.         float fInterlaceVerticalWidth =lerp( lerp( fInterlaceVerticalWidthDay, fInterlaceVerticalWidthNight, InVNightDayFactor ), fInterlaceVerticalWidthInterior, InVInteriorFactor );
  1023.  
  1024.     float InterlaceVerticalScalar = 0.5 / max( 1.0, floor( fInterlaceVerticalWidth ) );
  1025.     if( frac( IN.txcoord0.x * ScreenSize.x * InterlaceVerticalScalar ) > 0.5 )
  1026.     {
  1027.         return _c6;
  1028.     }
  1029.     #endif
  1030.  
  1031.     #ifdef ENABLE_INTERLACE_HORIZONTAL
  1032.  
  1033.         float InHInteriorFactor = EInteriorFactor;
  1034.         float InHNightDayFactor = ENightDayFactor;
  1035.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1036.             InHInteriorFactor = 1 - EInteriorFactor;
  1037.         #endif
  1038.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1039.             InHNightDayFactor = 1 - ENightDayFactor;
  1040.         #endif
  1041.        
  1042.         float fInterlaceHorizontalWidth =lerp( lerp( fInterlaceHorizontalWidthDay, fInterlaceHorizontalWidthNight, InHNightDayFactor ), fInterlaceHorizontalWidthInterior, InHInteriorFactor );
  1043.  
  1044.     float InterlaceHorizontalScalar = 0.5 / max( 1.0, floor( fInterlaceHorizontalWidth ) );
  1045.     if( frac( IN.txcoord0.y * ScreenSize.x * ScreenSize.w * InterlaceHorizontalScalar ) > 0.5 )
  1046.     {
  1047.         return _c6;
  1048.     }
  1049.     #endif
  1050.  
  1051.    float4 _v0=0.0;
  1052.  
  1053.    _v0.xy=IN.txcoord0.xy;
  1054.    r1=tex2D(_s0, _v0.xy); //color
  1055.  
  1056.    r11=r1; //my bypass
  1057.    _oC0.xyz=r1.xyz; //for future use without game color corrections
  1058.  
  1059. #ifdef APPLYGAMECOLORCORRECTION
  1060.    //apply original
  1061.     r0.x=1.0/_c2.y;
  1062.     r1=tex2D(_s2, _v0);
  1063.     r0.yz=r1.xy * _c1.y;
  1064.     r0.w=1.0/r0.y;
  1065.     r0.z=r0.w * r0.z;
  1066.     r1=tex2D(_s0, _v0);
  1067.     r1.xyz=r1 * _c1.y;
  1068.     r0.w=dot(_c7.xyz, r1.xyz);
  1069.     r1.w=r0.w * r0.z;
  1070.     r0.z=r0.z * r0.w + _c7.w;
  1071.     r0.z=1.0/r0.z;
  1072.     r0.x=r1.w * r0.x + _c7.w;
  1073.     r0.x=r0.x * r1.w;
  1074.     r0.x=r0.z * r0.x;
  1075.     if (r0.w<0) r0.x=_c6.x;
  1076.     r0.z=1.0/r0.w;
  1077.     r0.z=r0.z * r0.x;
  1078.     r0.x=saturate(-r0.x + _c2.x);
  1079.     //r2=tex2D(_s3, _v0); // enb bloom
  1080.     r2=tex2D(_s1, _v0); // vanilla bloom
  1081.     r2.xyz=r2 * _c1.y;
  1082.     r2.xyz=r0.x * r2;
  1083.     r1.xyz=r1 * r0.z + r2;
  1084.     r0.x=dot(r1.xyz, _c7.xyz);
  1085.     r1.w=_c7.w;
  1086.     r2=lerp(r0.x, r1, _c3.x);
  1087.     r1=r0.x * _c4 - r2;
  1088.     r1=_c4.w * r1 + r2;
  1089.     r1=_c3.w * r1 - r0.y; //khajiit night vision _c3.w
  1090.     r0=_c3.z * r1 + r0.y;
  1091.     r1=-r0 + _c5;
  1092.     _oC0=_c5.w * r1 + r0;
  1093.  
  1094. #endif //APPLYGAMECOLORCORRECTION
  1095.  
  1096.    float4 color=_oC0;
  1097.  
  1098. #ifndef APPLYGAMECOLORCORRECTION
  1099. color*=1.0;
  1100. color+=0.0; //0.05 //KYO : decrease this value to increase black levels. I'm doing this to affect BLACKS only without touching anything else.
  1101.  
  1102. #endif
  1103.  
  1104.  
  1105. #ifdef ENABLE_ENB_BLOOM
  1106.  
  1107.  
  1108.     #ifdef COMBINE_BLOOM
  1109.         float4 enbbloomcol = tex2D( _s3, _v0.xy ); + tex2D( _s1, _v0.xy );
  1110.     #else
  1111.         float4 enbbloomcol = tex2D( _s3, _v0.xy );
  1112.     #endif
  1113.    
  1114.     // DEBUG OUTPUT
  1115.     // return enbbloomcol;
  1116.    
  1117.     if( enbbloomcol.r + enbbloomcol.g + enbbloomcol.b > 0.0 )
  1118.     {
  1119.         #ifdef USE_BLOOM_HSV
  1120.  
  1121.         float EBInteriorFactor = EInteriorFactor;
  1122.         float EBNightDayFactor = ENightDayFactor;
  1123.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1124.             EBInteriorFactor = 1 - EInteriorFactor;
  1125.         #endif
  1126.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1127.             EBNightDayFactor = 1 - ENightDayFactor;
  1128.         #endif
  1129.        
  1130.         float fBloomSaturationSmooth =lerp( lerp( fBloomSaturationSmoothDay, fBloomSaturationSmoothNight, EBNightDayFactor ), fBloomSaturationSmoothInterior, EBInteriorFactor );
  1131.         float fBloomSaturationCurve =lerp( lerp( fBloomSaturationCurveDay, fBloomSaturationCurveNight, EBNightDayFactor ), fBloomSaturationCurveInterior, EBInteriorFactor );
  1132.         float fBloomSaturationMult =lerp( lerp( fBloomSaturationMultDay, fBloomSaturationMultNight, EBNightDayFactor ), fBloomSaturationMultInterior, EBInteriorFactor );
  1133.        
  1134.         float fBloomIntensitySmooth =lerp( lerp( fBloomIntensitySmoothDay, fBloomIntensitySmoothNight, EBNightDayFactor ), fBloomIntensitySmoothInterior, EBInteriorFactor );
  1135.         float fBloomIntensityCurve =lerp( lerp( fBloomIntensityCurveDay, fBloomIntensityCurveNight, EBNightDayFactor ), fBloomIntensityCurveInterior, EBInteriorFactor );
  1136.         float fBloomIntensityMult =lerp( lerp( fBloomIntensityMultDay, fBloomIntensityMultNight, EBNightDayFactor ), fBloomIntensityMultInterior, EBInteriorFactor );
  1137.         float fBloomIntensityMod =lerp( lerp( fBloomIntensityModDay, fBloomIntensityModNight, EBNightDayFactor ), fBloomIntensityModInterior, EBInteriorFactor );
  1138.         float fBloomIntensityMax =lerp( lerp( fBloomIntensityMaxDay, fBloomIntensityMaxNight, EBNightDayFactor ), fBloomIntensityMaxInterior, EBInteriorFactor );
  1139.  
  1140.         float3 bloomhsv = RGBtoHSV( enbbloomcol.rgb );
  1141.         bloomhsv.y = lerp( bloomhsv.y, smoothstep( 0.0, 1.0, bloomhsv.y ), fBloomSaturationSmooth );
  1142.         bloomhsv.y = pow( bloomhsv.y, fBloomSaturationCurve );
  1143.         bloomhsv.y *= fBloomSaturationMult;
  1144.         bloomhsv.z = lerp( bloomhsv.z, smoothstep( 0.0, 1.0, bloomhsv.z ), fBloomIntensitySmooth );
  1145.         bloomhsv.z = pow( bloomhsv.z, fBloomIntensityCurve );
  1146.         bloomhsv.z *= fBloomIntensityMult;
  1147.         bloomhsv.z += fBloomIntensityMod;
  1148.         bloomhsv.z = clamp( bloomhsv.z, 0.0, fBloomIntensityMax );
  1149.         enbbloomcol.rgb = HSVtoRGB( bloomhsv );
  1150.         #endif
  1151.         #ifdef USE_BLOOM_LERP
  1152.         color.rgb = lerp( color.rgb, enbbloomcol.rgb, clamp( EBloomAmount, 0.0, 1.0 ) );
  1153.         #endif
  1154.         #ifdef USE_BLOOM_ADD
  1155.         color.rgb += enbbloomcol.rgb * clamp( EBloomAmount, 0.0, 1.0 );
  1156.         #endif
  1157.     }
  1158.     #endif
  1159.  
  1160.    //adaptation in time
  1161.    float4   Adaptation=tex2D(_s4, 0.5);
  1162.    float   grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
  1163. //   grayadaptation=1.0/grayadaptation;
  1164.  
  1165.  
  1166.      float4   xcolorbloom=tex2D(_s3, _v0.xy); //bloom
  1167. //   float   maxb=max(xcolorbloom.x, max(xcolorbloom.y, xcolorbloom.z));
  1168. //   float   violetamount=maxb/(maxb+EVioletShiftAmountInv);
  1169. //   xcolorbloom.xyz=lerp(xcolorbloom.xyz, xcolorbloom.xyz*EVioletShiftColor, violetamount*violetamount);
  1170.  
  1171.  
  1172.     #ifdef HD6_BLOOM_DEBLUEIFY
  1173.  
  1174.         float DbInteriorFactor = EInteriorFactor;
  1175.         float DbNightDayFactor = ENightDayFactor;
  1176.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1177.             DbInteriorFactor = 1.0 - EInteriorFactor;
  1178.         #endif
  1179.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1180.             DbNightDayFactor = 1.0 - ENightDayFactor;
  1181.         #endif
  1182.  
  1183.         // Deblueify samples
  1184.             //float3 nsat=float3(1,0.74,0.64); // perfect-ish - removes blue and green from fog and outdoors, makes dwarven ruins very white though
  1185.             //float3 nsat=float3(1,0.80,0.74); // Touch greener
  1186.             //float3 nsat=float3(1,0.70,0.65); // Grey, very grey ice gaves almost white, but... foggy days go pink
  1187.             //float3 nsat=float3(0.85,0.75,0.7); // More reasnioable, still pink sky and snow in places
  1188.             //float3 nsat=float3(0.80,0.75,0.73);
  1189.             //float3 nsat=float3(1,0.64,0.58);
  1190.             //float3 nsat=float3(1,0.74,0.90); 
  1191.             //float3 nsat=float3(0.8,0.56,0.46);
  1192.             //float3 nsat=float3(0.7,0.6,0.4); // desatures everything a bit
  1193.             //float3 nsat=float3(0,0,0); // no color in bloom, makes everything very desaturated, fire looks white almost
  1194.  
  1195.         // --JawZ-- added day, night and interior debluify
  1196.             float3 nsat = lerp( lerp( bsatd, bsatn, DbNightDayFactor ), bsati, DbInteriorFactor );
  1197.  
  1198.         // store old values
  1199.             float3 oldcol=xcolorbloom.xyz;
  1200.            
  1201.         // adjust saturation
  1202.             xcolorbloom.xyz *= nsat;
  1203.  
  1204. //+++++++Changes appareance of color perception for Bloom only++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1205.         float3 greyc = float3(0.299, 0.587, 0.114); // perception of color luminace
  1206.         //float3 greyc = float3(0.811,0.523,0.996); // perception of color luminace
  1207.         //float3 greyc = float3(0.333,0.333,0.333); // screw perception
  1208. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1209.  
  1210.         xcolorbloom.xyz += (oldcol.x-(oldcol.x*nsat.x)) * greyc.x;
  1211.         xcolorbloom.xyz += (oldcol.y-(oldcol.y*nsat.y)) * greyc.y;
  1212.         xcolorbloom.xyz += (oldcol.z-(oldcol.z*nsat.z)) * greyc.z;
  1213.     #endif
  1214.  
  1215.     #ifdef HD6_BLOOM_DEFUZZ
  1216.         // Heliosdouble cobbled together bloom defuzzer - increases contrast of bloom / stop it hazing low brightness values
  1217.         // modulated by the overall brightness of the screen.
  1218.  
  1219.         float mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  1220.         xcolorbloom.xyz-=(mavg/3);
  1221.         //xcolorbloom.xyz=min(xcolorbloom.xyz,0.0);
  1222.         xcolorbloom.xyz+=(mavg*0.22222222);
  1223.         xcolorbloom.xyz*(mavg*1.22222222);
  1224.     #endif
  1225.    
  1226.     #ifdef DIFFUSE_BLOOM
  1227.         float DiffInteriorFactor = EInteriorFactor;
  1228.         float DiffNightDayFactor = ENightDayFactor;
  1229.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1230.             DiffInteriorFactor = 1 - EInteriorFactor;
  1231.         #endif
  1232.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1233.             DiffNightDayFactor = 1 - ENightDayFactor;
  1234.         #endif
  1235.  
  1236.         xcolorbloom.r*= lerp( lerp( REDDay, REDNight, DiffNightDayFactor ), REDInterior, DiffInteriorFactor );
  1237.         xcolorbloom.g*= lerp( lerp( GREENDay, GREENNight, DiffNightDayFactor ), GREENInterior, DiffInteriorFactor );
  1238.         xcolorbloom.b*= lerp( lerp( BLUEDay, BLUENight, DiffNightDayFactor ), BLUEInterior, DiffInteriorFactor );
  1239.  
  1240.  
  1241.         float Saturation = lerp( lerp( SatDay, SatNight, DiffNightDayFactor ), SatInterior, DiffInteriorFactor );
  1242.         float Luma = lerp( lerp( LumaDay, LumaNight, DiffNightDayFactor ), LumaInterior, DiffInteriorFactor );
  1243.         float Pow = lerp( lerp( PowDay, PowNight, DiffNightDayFactor ), PowInterior, DiffInteriorFactor );
  1244.         float Pow2 = lerp( lerp( Pow2Day, Pow2Night, DiffNightDayFactor ), Pow2Interior, DiffInteriorFactor );
  1245.  
  1246.         float3 cgray2=dot(xcolorbloom.xyz, Luma);
  1247.         float3 poweredcolor2=pow(xcolorbloom.xyz, Saturation);
  1248.         float newgray2=dot(poweredcolor2.xyz, Pow);
  1249.         xcolorbloom.xyz=poweredcolor2.xyz*cgray2/(newgray2+Pow2);
  1250.         color.xyz+=xcolorbloom.xyz*EBloomAmount;
  1251.     #endif
  1252.  
  1253.     float bchnd = ENightDayFactor;
  1254.     float ji = EInteriorFactor;
  1255.     #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1256.             bchnd = 1 - ENightDayFactor;
  1257.     #endif
  1258.     #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1259.             ji = 1 - EInteriorFactor;
  1260.     #endif
  1261.     float hnd = bchnd;
  1262.     float h1 = lerp(-1,1,tempF1.x); // Increases speed it changes by when pressing key     
  1263.         h1 = lerp( h1, 1, hnd ); // Removes affect during day      
  1264.         h1 = h1 - (h1 % 0.1); // Changes it so incriments are in steps, remove this if you want smooth changes when pressing keys
  1265.     float hbs = lerp( EBloomAmount/2, EBloomAmount, h1); // Reduce bloom as it gets darker, otherwise it just gets hazier, higher number reduces bloom more as it gets darker
  1266.    
  1267.    
  1268.     #ifdef HD6_BLOOM_CRISP 
  1269.             float3 LumCoeff = lerp( LumCoeffInterior, ( lerp( LumCoeffNight, LumCoeffDay,  bchnd ) ), ji);         
  1270.             float3 AvgLumin = lerp( AvgLuminInterior, ( lerp( AvgLuminNight, AvgLuminDay,  bchnd ) ), ji); 
  1271.  
  1272.             // Limits what triggers a bloom
  1273.             float3 brightbloom = xcolorbloom - lerp( TrigInterior, ( lerp( TrigNight, TrigDay,  bchnd ) ), ji);
  1274.                 brightbloom = max( brightbloom , 0);
  1275.  
  1276.             // Limits bloom to superbright spots only
  1277.             float3 superbright = xcolorbloom - lerp( SBrightInterior, ( lerp( SBrightNight, SBrightDay,  bchnd ) ), ji);
  1278.                 superbright = max( superbright , 0 ) ; // crop so dont go any lower than black
  1279.                 //superbright = lerp( AvgLumin, superbright, 0.5); // Contrast
  1280.                 superbright *= 0.6;    
  1281.            
  1282.             // Bloom - Brightness, Contrast and Saturation
  1283.             float3 brt = lerp( CBrightnessInterior, ( lerp( CBrightnessNight, CBrightnessDay,   bchnd ) ), ji);
  1284.             float3 con = lerp( CContrastInterior, ( lerp( CContrastNight, CContrastDay,   bchnd ) ), ji);
  1285.             float3 sat = lerp( CSaturationInterior, ( lerp( CSaturationNight, CSaturationDay,   bchnd ) ), ji);
  1286.                 float3 brtColor = brightbloom * brt;
  1287.                 float3 cintensity = dot( brtColor, LumCoeff );
  1288.                 float3 satColor = lerp( cintensity, brtColor, sat );
  1289.                 float3 conColor = lerp( AvgLumin, satColor, con );
  1290.                 conColor -= 0.3;
  1291.                 brightbloom = conColor;
  1292.  
  1293.             // These values compensates the brightness when no bloom is used
  1294.             color.xyz +=  lerp( BrightnessModInterior, ( lerp( BrightnessModNight, BrightnessModDay, bchnd ) ), ji);
  1295.             color.xyz *= lerp( BrightnessMultInterior, ( lerp( BrightnessMultNight, BrightnessMultDay, bchnd ) ), ji);
  1296.  
  1297.             // Adds bloom while compensating for any brightness change
  1298.             color.xyz += (( superbright * hbs ) * lerp( CompSBInterior, ( lerp( CompSBNight, CompSBDay,  bchnd ) ), ji)); // Limits where the bloom will "bloom"
  1299.             brightbloom -= ( superbright * 2 ); // removes superbright from brightbloom
  1300.             brightbloom = max( brightbloom , 0.0 );
  1301.             color.xyz += (( brightbloom * hbs ) * lerp( BloomStrInterior, ( lerp( BloomStrNight, BloomStrDay,  bchnd ) ), ji)); // How strong the bloom will be
  1302.  
  1303.             // This blends the the ENB and Skyrim bloom together, for a more hazey effect
  1304.             color.xyz += (xcolorbloom.xyz * hbs) * lerp( BloomBlendInterior, ( lerp( BloomBlendNight, BloomBlendDay,  bchnd ) ), ji); // How much the blend there will be
  1305.             color.xyz *= lerp( BlendCompInterior, ( lerp( BlendCompNight, BlendCompDay,  bchnd ) ), ji); // compensate for brightening caused by above bloom
  1306.  
  1307.     #endif
  1308.  
  1309.     #ifdef HD6_BLOOM_SCREEN
  1310.                 // Helios code to restrict bloom to bright areas only, not smudging dark outs around
  1311.  
  1312.                 color+=(color*EBloomAmount); // compensate if bloom disabled   
  1313.                 xcolorbloom=max(xcolorbloom,0); // will cause color shift/desaturation also
  1314.                 float tmult = 10;
  1315.                 color/=tmult; xcolorbloom/=tmult; // Screen mode wont work with floating point numbers / big numbers, so I reduce it first
  1316.  
  1317.                 color.x = 1.0 - ((1.0 - color.x) * (1.0 - xcolorbloom.x));
  1318.                 color.y = 1.0 - ((1.0 - color.y) * (1.0 - xcolorbloom.y));
  1319.                 color.z = 1.0 - ((1.0 - color.z) * (1.0 - xcolorbloom.z));
  1320.                 color*=tmult;          
  1321.     #endif
  1322.        
  1323.     #ifdef JZ_BLOOM_COLORIZATION
  1324.             float BCInteriorFactor = EInteriorFactor;
  1325.             float BCNightDayFactor = ENightDayFactor;
  1326.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1327.             BCInteriorFactor = 1 - EInteriorFactor;
  1328.         #endif
  1329.         #ifdef ENABLE_FLIP_NIGHT_DAY_FACTOR
  1330.             BCNightDayFactor = 1 - ENightDayFactor;
  1331.         #endif
  1332.  
  1333.             xcolorbloom.rgb*= lerp( lerp( bloommultDay, bloommultNight, BCNightDayFactor ), bloommultInterior, BCInteriorFactor );
  1334.             xcolorbloom.rgb-= lerp( lerp( bloomsubDay, bloomsubNight, BCNightDayFactor ), bloomsubInterior, BCInteriorFactor );
  1335.  
  1336.             xcolorbloom.rb*= lerp( lerp( MAGENTAbloomDay, MAGENTAbloomNight, BCNightDayFactor ), MAGENTAbloomInterior, BCInteriorFactor );
  1337.             xcolorbloom.gb*= lerp( lerp( CYANbloomDay, CYANbloomNight, BCNightDayFactor ), CYANbloomInterior, BCInteriorFactor );
  1338.             xcolorbloom.rg*= lerp( lerp( YELLOWbloomDay, YELLOWbloomNight, BCNightDayFactor ), YELLOWbloomInterior, BCInteriorFactor );
  1339.  
  1340.         color.xyz+=xcolorbloom.xyz*EBloomAmount;
  1341.     #endif
  1342.  //  color.xyz+=xcolorbloom.xyz*EBloomAmount;
  1343.  
  1344.  
  1345.    ///////////////////////////////
  1346.    // HSV COLOR CORRECTION CODE //
  1347.    ///////////////////////////////
  1348.  
  1349.     //IndigoNeko's Color Correction Code
  1350.  
  1351.     #ifdef ENABLE_HSV
  1352.  
  1353.     float fInteriorFactor = EInteriorFactor;
  1354.     float fNightDayFactor = ENightDayFactor;
  1355.     #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1356.         fInteriorFactor = 1 - EInteriorFactor;
  1357.     #endif
  1358.     #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1359.         fNightDayFactor = 1 - ENightDayFactor;
  1360.     #endif
  1361.    
  1362.     float fColorHueSmooth =lerp( lerp( fColorHueSmoothDay, fColorHueSmoothNight, fNightDayFactor ), fColorHueSmoothInterior, fInteriorFactor );
  1363.     float fColorSaturationSmooth =lerp( lerp( fColorSaturationSmoothDay, fColorSaturationSmoothNight, fNightDayFactor ), fColorSaturationSmoothInterior, fInteriorFactor );
  1364.     float fColorIntensitySmooth =lerp( lerp( fColorIntensitySmoothDay, fColorIntensitySmoothNight, fNightDayFactor ), fColorIntensitySmoothInterior, fInteriorFactor );
  1365.    
  1366.     float fColorHueCurve =lerp( lerp( fColorHueCurveDay, fColorHueCurveNight, fNightDayFactor ), fColorHueCurveInterior, fInteriorFactor );
  1367.     float fColorSaturationCurve =lerp( lerp( fColorSaturationCurveDay, fColorSaturationCurveNight, fNightDayFactor ), fColorSaturationCurveInterior, fInteriorFactor );
  1368.     float fColorIntensityCurve =lerp( lerp( fColorIntensityCurveDay, fColorIntensityCurveNight, fNightDayFactor ), fColorIntensityCurveInterior, fInteriorFactor );
  1369.  
  1370.     float fColorHueMult =lerp( lerp( fColorHueMultDay, fColorHueMultNight, fNightDayFactor ), fColorHueMultInterior, 1.0 - fInteriorFactor );
  1371.     float fColorSaturationMult =lerp( lerp( fColorSaturationMultDay, fColorSaturationMultNight, fNightDayFactor ), fColorSaturationMultInterior, fInteriorFactor );
  1372.     float fColorIntensityMult =lerp( lerp( fColorIntensityMultDay, fColorIntensityMultNight, fNightDayFactor ), fColorIntensityMultInterior, fInteriorFactor );
  1373.  
  1374.     float fColorHueMod =lerp( lerp( fColorHueModDay, fColorHueModNight, fNightDayFactor ), fColorHueModInterior, fInteriorFactor );
  1375.     float fColorSaturationMod =lerp( lerp( fColorSaturationModDay, fColorSaturationModNight, fNightDayFactor ), fColorSaturationModInterior, fInteriorFactor );
  1376.     float fColorIntensityMod =lerp( lerp( fColorIntensityModDay, fColorIntensityModNight, fNightDayFactor ), fColorIntensityModInterior, fInteriorFactor );
  1377.    
  1378.     float3 hsvcolor = RGBtoHSV( color.xyz );
  1379.     hsvcolor.y = max( hsvcolor.y, 0.0 );
  1380.     hsvcolor.z = max( hsvcolor.z, 0.0 );
  1381.    
  1382.     #ifdef USE_HSV_SMOOTH
  1383.     hsvcolor.x = lerp( hsvcolor.x, smoothstep( 0.0, 1.0, hsvcolor.x ), fColorHueSmooth );
  1384.     hsvcolor.y = lerp( hsvcolor.y, smoothstep( 0.0, 1.0, hsvcolor.y ), fColorSaturationSmooth );
  1385.     hsvcolor.z = lerp( hsvcolor.z, smoothstep( 0.0, 1.0, hsvcolor.z ), fColorIntensitySmooth );
  1386.     #endif
  1387.    
  1388.     #ifdef USE_HSV_CURVE
  1389.     hsvcolor.x = pow( hsvcolor.x, fColorHueCurve );
  1390.     hsvcolor.y = pow( hsvcolor.y, fColorSaturationCurve );
  1391.     hsvcolor.z = pow( hsvcolor.z, fColorIntensityCurve );
  1392.     #endif
  1393.  
  1394.     hsvcolor.x = fColorHueMod + ( fColorHueMult * hsvcolor.x );
  1395.     hsvcolor.y = fColorSaturationMod + ( fColorSaturationMult * hsvcolor.y );
  1396.     hsvcolor.z = fColorIntensityMod + ( fColorIntensityMult * hsvcolor.z );
  1397.  
  1398.     #ifdef USE_HSV_EQUALIZER
  1399.     hsvcolor.y = ColorEqualizerMod( hsvcolor.x ) + ( ColorEqualizerMult( hsvcolor.x ) * hsvcolor.y );
  1400.     #endif
  1401.  
  1402.     hsvcolor.y = max( hsvcolor.y, 0.0 );
  1403.     hsvcolor.z = max( hsvcolor.z, 0.0 );
  1404.     color.xyz = HSVtoRGB( hsvcolor );
  1405.     #endif
  1406.  
  1407.     #ifdef JZ_COLOR_FILTER
  1408.         float CFInteriorFactor = EInteriorFactor;
  1409.         float CFNightDayFactor = ENightDayFactor;
  1410.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1411.             CFInteriorFactor = 1 - EInteriorFactor;
  1412.         #endif
  1413.         #ifdef ENABLE_FLIP_NIGHT_DAY_FACTOR
  1414.             CFNightDayFactor = 1 - ENightDayFactor;
  1415.         #endif
  1416.  
  1417.         float3 EColorFilter =lerp( lerp( EColorFilterDay, EColorFilterNight, CFNightDayFactor ), EColorFilterInterior, CFInteriorFactor );
  1418.             EColorFilter.rgb-= lerp( lerp( EColorFilterSubDay, EColorFilterSubNight, CFNightDayFactor ), EColorFilterSubInterior, CFInteriorFactor );
  1419.  
  1420.             EColorFilter.rb*= lerp( lerp( MAGENTADay, MAGENTANight, CFNightDayFactor ), MAGENTAInterior, CFInteriorFactor );
  1421.             EColorFilter.gb*= lerp( lerp( CYANDay, CYANNight, CFNightDayFactor ), CYANInterior, CFInteriorFactor );
  1422.             EColorFilter.rg*= lerp( lerp( YELLOWDay, YELLOWNight, CFNightDayFactor ), YELLOWInterior, CFInteriorFactor );
  1423.  
  1424.             EColorFilter.rb-= lerp( lerp( MAGENTAsubDay, MAGENTAsubNight, CFNightDayFactor ), MAGENTAsubInterior, CFInteriorFactor );
  1425.             EColorFilter.gb-= lerp( lerp( CYANsubDay, CYANsubNight, CFNightDayFactor ), CYANsubInterior, CFInteriorFactor );
  1426.             EColorFilter.rg-= lerp( lerp( YELLOWsubDay, YELLOWsubNight, CFNightDayFactor ), YELLOWsubInterior, CFInteriorFactor );
  1427.  
  1428.         color.xyz*=EColorFilter;
  1429.     #endif
  1430.  
  1431.     //+++++++++++++++++++++++++++++
  1432.     float PPInteriorFactor = EInteriorFactor;
  1433.     float PPNightDayFactor = ENightDayFactor;
  1434.     #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1435.         PPInteriorFactor = 1 - EInteriorFactor;
  1436.     #endif
  1437.     #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1438.         PPNightDayFactor = 1 - ENightDayFactor;
  1439.     #endif
  1440.      hnd = PPNightDayFactor;
  1441.      ji = PPInteriorFactor;
  1442.    
  1443.     float2 hndtweak = float2( 3.1 , 1.5 );
  1444.     float vhnd = hnd; // effects vignette strength;
  1445.     bchnd = hnd; // effects hd6 bloom crisp
  1446.     float cdhnd = hnd; // effects hd6 colorsat daynight
  1447.    
  1448.     // Some caves are seen as daytime, so I set key 3 to force nightime
  1449.     // This doesnt work very well >_<
  1450.     hnd = tempF1.z < 1 ? 0 : hnd;
  1451.     hndtweak.x = tempF1.z < 1 ? hndtweak.y : hndtweak.x; // Don't ask, I have no idea why I need this // KYO : Me neither :P
  1452.     //+++++++++++++++++++++++++++++
  1453.    
  1454.     #if (POSTPROCESS==1)
  1455.  
  1456.     float EAdaptationMinV1 =lerp( lerp( EAdaptationMinV1Day, EAdaptationMinV1Night, PPNightDayFactor ), EAdaptationMinV1Interior, PPInteriorFactor );
  1457.     float EAdaptationMaxV1 =lerp( lerp( EAdaptationMaxV1Day, EAdaptationMaxV1Night, PPNightDayFactor ), EAdaptationMaxV1Interior, PPInteriorFactor );
  1458.     float EContrastV1 =lerp( lerp( EContrastV1Day, EContrastV1Night, PPNightDayFactor ), EContrastV1Interior, PPInteriorFactor );
  1459.     float EColorSaturationV1 =lerp( lerp( EColorSaturationV1Day, EColorSaturationV1Night, PPNightDayFactor ), EColorSaturationV1Interior, PPInteriorFactor );
  1460.     float EToneMappingCurveV1 =lerp( lerp( EToneMappingCurveV1Day, EToneMappingCurveV1Night, PPNightDayFactor ), EToneMappingCurveV1Interior, PPInteriorFactor );
  1461.  
  1462.  
  1463.         grayadaptation=max(grayadaptation, 0.0);
  1464.         grayadaptation=min(grayadaptation, 50.0);
  1465.         color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV1+EAdaptationMinV1);//*tempF1.x
  1466.  
  1467.         float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
  1468.         cgray=pow(cgray, EContrastV1);
  1469.         float3 poweredcolor=pow(color.xyz, EColorSaturationV1);
  1470.         float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
  1471.         color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  1472.  
  1473.         float3  luma=color.xyz;
  1474.         float   lumamax=300.0;
  1475.         color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
  1476.  
  1477.     #endif
  1478.     //+++++++++++++++++++++++++++++
  1479.  
  1480.     //+++++++++++++++++++++++++++++
  1481.     #if (POSTPROCESS==2)
  1482.  
  1483.     float newEAdaptationMax = lerp( EAdaptationMaxV2Interior, ( lerp( EAdaptationMaxV2Night, EAdaptationMaxV2Day, hnd ) ), ji );
  1484.     float newEAdaptationMin = lerp( EAdaptationMinV2Interior, ( lerp( EAdaptationMinV2Night, EAdaptationMinV2Day, hnd ) ), ji );
  1485.     float newEBrightnessV2 = lerp( EBrightnessV2Interior, ( lerp( EBrightnessV2Night, EBrightnessV2Day, hnd ) ), ji );
  1486.     float newEToneMappingCurve = lerp( EToneMappingCurveV2Interior, ( lerp( EToneMappingCurveV2Night, EToneMappingCurveV2Day, hnd ) ), ji );
  1487.     float newEIntensityContrastV2 = lerp( EIntensityContrastV2Interior, ( lerp( EIntensityContrastV2Night, EIntensityContrastV2Day, hnd ) ), ji );
  1488.     float newEToneMappingOversaturationV2 = lerp( EToneMappingOversaturationV2Interior, ( lerp( EToneMappingOversaturationV2Night, EToneMappingOversaturationV2Day, hnd ) ), ji );
  1489.     float newEColorSaturationV2 = lerp( EColorSaturationV2Interior, ( lerp( EColorSaturationV2Night, EColorSaturationV2Day, hnd ) ), ji );
  1490.     float HCompensateSatV2 = lerp( HCompensateSatV2Interior, ( lerp( HCompensateSatV2Night, HCompensateSatV2Day, hnd ) ), ji );
  1491.    
  1492.  
  1493.         grayadaptation=max(grayadaptation, 0.0);
  1494.         grayadaptation=min(grayadaptation, 50.0);
  1495.         color.xyz=color.xyz/(grayadaptation*newEAdaptationMax+newEAdaptationMin);//*tempF1.x
  1496.  
  1497.         color.xyz*=(newEBrightnessV2);
  1498.         color.xyz+=0.000001;
  1499.         float3 xncol=normalize(color.xyz);
  1500.         float3 scl=color.xyz/xncol.xyz;
  1501.         scl=pow(scl, newEIntensityContrastV2);
  1502.         xncol.xyz=pow(xncol.xyz, newEColorSaturationV2);
  1503.         color.xyz=scl*xncol.xyz;
  1504.         color.xyz*=HCompensateSatV2;
  1505.  
  1506.         float   lumamax=newEToneMappingOversaturationV2;
  1507.         color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + newEToneMappingCurve);
  1508.  
  1509.     #endif
  1510.     //+++++++++++++++++++++++++++++
  1511.  
  1512.     //+++++++++++++++++++++++++++++
  1513.     #if (POSTPROCESS==3)
  1514.  
  1515.     float EAdaptationMaxV3 =lerp( lerp( EAdaptationMaxV3Day, EAdaptationMaxV3Night, PPNightDayFactor ), EAdaptationMaxV3Interior, PPInteriorFactor );
  1516.     float EAdaptationMinV3 =lerp( lerp( EAdaptationMinV3Day, EAdaptationMinV3Night, PPNightDayFactor ), EAdaptationMinV3Interior, PPInteriorFactor );
  1517.     float EToneMappingOversaturationV3 =lerp( lerp( EToneMappingOversaturationV3Day, EToneMappingOversaturationV3Night, PPNightDayFactor ), EToneMappingOversaturationV3Interior, PPInteriorFactor );
  1518.     float EToneMappingCurveV3 =lerp( lerp( EToneMappingCurveV3Day, EToneMappingCurveV3Night, PPNightDayFactor ), EToneMappingCurveV3Interior, PPInteriorFactor );
  1519.  
  1520.         grayadaptation=max(grayadaptation, 0.0);
  1521.         grayadaptation=min(grayadaptation, 50.0);
  1522.         color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV3+EAdaptationMinV3);//*tempF1.x
  1523.  
  1524.         float   lumamax=EToneMappingOversaturationV3;
  1525.         color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
  1526.  
  1527.     #endif
  1528.     //+++++++++++++++++++++++++++++
  1529.  
  1530.     //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
  1531.     //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
  1532.     //color.xyz*=0.7;
  1533.  
  1534.     //+++++++++++++++++++++++++++++
  1535.     #if (POSTPROCESS==4)
  1536.  
  1537.     float EAdaptationMaxV4 =lerp( lerp( EAdaptationMaxV4Day, EAdaptationMaxV4Night, PPNightDayFactor ), EAdaptationMaxV4Interior, PPInteriorFactor );
  1538.     float EAdaptationMinV4 =lerp( lerp( EAdaptationMinV4Day, EAdaptationMinV4Night, PPNightDayFactor ), EAdaptationMinV4Interior, PPInteriorFactor );
  1539.     float EBrightnessCurveV4 =lerp( lerp( EBrightnessCurveV4Day, EBrightnessCurveV4Night, PPNightDayFactor ), EBrightnessCurveV4Interior, PPInteriorFactor );
  1540.     float EBrightnessMultiplierV4 =lerp( lerp( EBrightnessMultiplierV4Day, EBrightnessMultiplierV4Night, PPNightDayFactor ), EBrightnessMultiplierV4Interior, PPInteriorFactor );
  1541.     float EBrightnessToneMappingCurveV4 =lerp( lerp( EBrightnessToneMappingCurveV4Day, EBrightnessToneMappingCurveV4Night, PPNightDayFactor ), EBrightnessToneMappingCurveV4Interior, PPInteriorFactor );
  1542.  
  1543.         grayadaptation=max(grayadaptation, 0.0);
  1544.         grayadaptation=min(grayadaptation, 50.0);
  1545.         color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV4+EAdaptationMinV4);
  1546.  
  1547.         float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
  1548.         float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  1549.         float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  1550.         Y=pow(Y, EBrightnessCurveV4);
  1551.         Y=Y*EBrightnessMultiplierV4;
  1552.     //  Y=Y/(Y+EBrightnessToneMappingCurveV4);
  1553.     //  float   desaturatefact=saturate(Y*Y*Y*1.7);
  1554.     //  U=lerp(U, 0.0, desaturatefact);
  1555.     //  V=lerp(V, 0.0, desaturatefact);
  1556.         color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  1557.  
  1558.         color.xyz=max(color.xyz, 0.0);
  1559.         color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
  1560.  
  1561.     #endif
  1562.     //+++++++++++++++++++++++++++++
  1563.  
  1564.     //+++++++++++++++++++++++++++++ HD6 version based on postprocess 2
  1565.     #if (POSTPROCESS==5)
  1566.  
  1567.     float EAdaptationMaxV5 =lerp( lerp( EAdaptationMaxV5Day, EAdaptationMaxV5Night, PPNightDayFactor ), EAdaptationMaxV5Interior, PPInteriorFactor );
  1568.     float EAdaptationMinV5 =lerp( lerp( EAdaptationMinV5Day, EAdaptationMinV5Night, PPNightDayFactor ), EAdaptationMinV5Interior, PPInteriorFactor );
  1569.     float EIntensityContrastV5 =lerp( lerp( EIntensityContrastV5Day, EIntensityContrastV5Night, PPNightDayFactor ), EIntensityContrastV5Interior, PPInteriorFactor );
  1570.     float EColorSaturationV5 =lerp( lerp( EColorSaturationV5Day, EColorSaturationV5Night, PPNightDayFactor ), EColorSaturationV5Interior, PPInteriorFactor );
  1571.     float HCompensateSatV5 =lerp( lerp( HCompensateSatV5Day, HCompensateSatV5Night, PPNightDayFactor ), HCompensateSatV5Interior, PPInteriorFactor );
  1572.     float EToneMappingCurveV5 =lerp( lerp( EToneMappingCurveV5Day, EToneMappingCurveV5Night, PPNightDayFactor ), EToneMappingCurveV5Interior, PPInteriorFactor );
  1573.  
  1574.             grayadaptation=max(grayadaptation, 0.0);
  1575.             grayadaptation=min(grayadaptation, 50.0);
  1576.             color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV5+EAdaptationMinV5); //*tempF1.x
  1577.  
  1578.         //color.xyz*=EBrightnessV5;
  1579.         //color.xyz+=0.000001; // HD6 - Why? how curious
  1580.         float3 xncol=normalize(color.xyz);
  1581.         float3 scl=color.xyz/xncol.xyz;
  1582.         scl=pow(scl, EIntensityContrastV5);
  1583.         xncol.xyz=pow(xncol.xyz, EColorSaturationV5);
  1584.         color.xyz=scl*xncol.xyz;
  1585.         color.xyz*=HCompensateSatV5; // compensate for darkening caused my EcolorSat above
  1586.  
  1587.         //float lumamax=EToneMappingOversaturationV5;
  1588.         //color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV5);
  1589.  
  1590.         color.xyz=color.xyz/(color.xyz + EToneMappingCurveV5);
  1591.             //color.xyz=tex2D(_s0, _v0.xy);
  1592.             //color.xyz=color.xyz-0.03;
  1593.             //color.xyz/=10;
  1594.        
  1595.     #endif
  1596.     //+++++++++++++++++++++++++++++
  1597.  
  1598.     //+++++++++++++++++++++++++++++ Improved Tonemapping v1.1 by Brodiggan Gale
  1599.     #if (POSTPROCESS==6)
  1600.    
  1601.         //hd6/ppv2///////////////////////////////////////////
  1602.         float   EIntensityContrastV6 = lerp( lerp( EIntensityContrastV6Day, EIntensityContrastV6Night, PPNightDayFactor), EIntensityContrastV6Interior, PPInteriorFactor );
  1603.         float   EColorSaturationV6 = lerp( lerp( EColorSaturationV6Day, EColorSaturationV6Night, PPNightDayFactor), EColorSaturationV6Interior, PPInteriorFactor );
  1604.         float   HCompensateSatV6 = lerp( lerp( HCompensateSatV6Day, HCompensateSatV6Night, PPNightDayFactor), HCompensateSatV6Interior, PPInteriorFactor );
  1605.         float   EToneMappingCurveV6 = lerp( lerp( EToneMappingCurveV6Day, EToneMappingCurveV6Night, PPNightDayFactor), EToneMappingCurveV6Interior, PPInteriorFactor );
  1606.         float   EBrightnessV6 = lerp( lerp( EBrightnessV6Day, EBrightnessV6Night, PPNightDayFactor), EBrightnessV6Interior, PPInteriorFactor );
  1607.         float   EToneMappingOversaturationV6 = lerp( lerp( EToneMappingOversaturationV6Day, EToneMappingOversaturationV6Night, PPNightDayFactor), EToneMappingOversaturationV6Interior, PPInteriorFactor );
  1608.         float   EAdaptationMaxV6 =lerp( lerp( EAdaptationMaxV6Day, EAdaptationMaxV6Night, PPNightDayFactor ), EAdaptationMaxV6Interior, PPInteriorFactor );
  1609.         float   EAdaptationMinV6 =lerp( lerp( EAdaptationMinV6Day, EAdaptationMinV6Night, PPNightDayFactor ), EAdaptationMinV6Interior, PPInteriorFactor );
  1610.         float   lumamax = EToneMappingOversaturationV6;
  1611.         //kermles////////////////////////////////////////////
  1612.         float   EAdaptationCompensateV6 =lerp( lerp( EAdaptationCompensateV6Day, EAdaptationCompensateV6Night, PPNightDayFactor ), EAdaptationCompensateV6Interior, PPInteriorFactor );
  1613.         float   EBrightnessMaxV6 = lerp( lerp( EBrightnessMaxV6Day, EBrightnessMaxV6Night, PPNightDayFactor ), EBrightnessMaxV6Interior, PPInteriorFactor );
  1614.         float   EBrightnessMinV6 = lerp( lerp( EBrightnessMinV6Day, EBrightnessMinV6Night, PPNightDayFactor ), EBrightnessMinV6Interior, PPInteriorFactor );
  1615.         float3  moodColor = float3(lerp( lerp( EMoodColorDay.x, EMoodColorNight.x, PPNightDayFactor), EMoodColorInt.x, PPInteriorFactor), lerp( lerp( EMoodColorDay.y, EMoodColorNight.y, PPNightDayFactor), EMoodColorInt.y, PPInteriorFactor),lerp( lerp( EMoodColorDay.z, EMoodColorNight.z, PPNightDayFactor), EMoodColorInt.z, PPInteriorFactor));
  1616.         float   moodAmount = lerp( lerp( EMoodAmountDay, EMoodAmountNight, PPNightDayFactor), EMoodAmountInt, PPInteriorFactor);
  1617.         float   moodCurve = lerp( lerp( EMoodCurveDay, EMoodCurveNight, PPNightDayFactor), EMoodCurveInt, PPInteriorFactor);
  1618.         float3  shadowColor = float3(lerp( lerp( EShadowColorDay.x, EShadowColorNight.x, PPNightDayFactor), EShadowColorInt.x, PPInteriorFactor), lerp( lerp( EShadowColorDay.y, EShadowColorNight.y, PPNightDayFactor), EShadowColorInt.y, PPInteriorFactor),lerp( lerp( EShadowColorDay.z, EShadowColorNight.z, PPNightDayFactor), EShadowColorInt.z, PPInteriorFactor));
  1619.         float   shadowThreshold = lerp( lerp( EShadowThresholdDay, EShadowThresholdNight, PPNightDayFactor), EShadowThresholdInt, PPInteriorFactor);
  1620.         float   shadowCurve = lerp( lerp( EShadowCurveDay, EShadowCurveNight, PPNightDayFactor), EShadowCurveInt, PPInteriorFactor);
  1621.         float3  brightSpotColor = float3(lerp( lerp( EBrightSpotColorDay.x, EBrightSpotColorNight.x, PPNightDayFactor), EBrightSpotColorInt.x, PPInteriorFactor), lerp( lerp( EBrightSpotColorDay.y, EBrightSpotColorNight.y, PPNightDayFactor), EBrightSpotColorInt.y, PPInteriorFactor),lerp( lerp( EBrightSpotColorDay.z, EBrightSpotColorNight.z, PPNightDayFactor), EBrightSpotColorInt.z, PPInteriorFactor));
  1622.         float   brightSpotThreshold = lerp( lerp( EBrightSpotThresholdDay, EBrightSpotThresholdNight, PPNightDayFactor), EBrightSpotThresholdInt, PPInteriorFactor);
  1623.         float   brightSpotCurve = lerp( lerp( EBrightSpotCurveDay, EBrightSpotCurveNight, PPNightDayFactor), EBrightSpotCurveInt, PPInteriorFactor) / 10;
  1624.         float   hsvDesatCurve = lerp( lerp( EHSVDesatCurveDay, EHSVDesatCurveNight, PPNightDayFactor), EHSVDesatCurveInt, PPInteriorFactor); //controls desaturation strength
  1625.         float   PPAmount = 0.8;         //controls interpolation between vanilla colors and PP6 colors 
  1626.         float4  ncolor;                 //temporary variable for color adjustments
  1627.         float   avgbr;                  //temporary variable for color adjustments
  1628.        
  1629.     //begin pp code/////////////////////////////////////////////////
  1630.         //store vanilla colors//////////////////////////////////////////
  1631.         float4 oldcolor = color;
  1632.         //convert to hsv////////////////////////////////////////////////
  1633.         float3 hsvncolor = RGBtoHSV( color.xyz );
  1634.         hsvncolor.y = max( hsvncolor.y, 0.0 );
  1635.         hsvncolor.z = max( hsvncolor.z, 0.0 );
  1636.         //desaturate based on original saturation then resaturate///////
  1637.         hsvncolor.y = pow( hsvncolor.y, hsvDesatCurve );
  1638.         hsvncolor.y = saturate(hsvncolor.y * EColorSaturationV6);
  1639.         //convert back to rgb///////////////////////////////////////////
  1640.         hsvncolor.y = max( hsvncolor.y, 0.0 );
  1641.         color.xyz = HSVtoRGB( hsvncolor );
  1642.         //brightness clamping///////////////////////////////////////////
  1643.         color.xyz=clamp(color.xyz, EBrightnessMinV6, EBrightnessMaxV6);
  1644.         //ppv2 modified by kermles//////////////////////////////////////
  1645.         grayadaptation = clamp(grayadaptation, 0, 50);
  1646.         color.xyz *= EBrightnessV6;
  1647.         float3 xncol = normalize(color.xyz);
  1648.         float3 scl = color.xyz/xncol.xyz;
  1649.         scl = pow(scl, EIntensityContrastV6);
  1650.         xncol.xyz = pow(xncol.xyz, EColorSaturationV6);
  1651.         color.xyz = scl*xncol.xyz;
  1652.         color.xyz *= HCompensateSatV6;
  1653.         color.xyz = (color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV6);
  1654.         //mood coloring/////////////////////////////////////////////////
  1655.         ncolor = color;
  1656.         avgbr = (ncolor.x + ncolor.y + ncolor.z)/3;
  1657.         moodColor.xyz = lerp( moodColor/10, moodColor, saturate( avgbr * 2 ) );
  1658.         moodColor.xyz = lerp( moodColor, 1, saturate( avgbr - 0.5 ) * 2 );
  1659.         moodColor.xyz = lerp( ncolor, moodColor, saturate(avgbr / moodCurve));
  1660.         ncolor.xyz = lerp( ncolor, moodColor, saturate( avgbr * moodAmount ) );
  1661.         color.xyz = max(0, ncolor);
  1662.         //shadows///////////////////////////////////////////////////////
  1663.         ncolor = color;
  1664.         avgbr = (ncolor.x + ncolor.y + ncolor.z)/3;
  1665.         shadowColor = lerp(0.1*(2.55-shadowColor), 2.55-shadowColor, saturate(avgbr*2));
  1666.         shadowColor = lerp(shadowColor, 1, saturate(avgbr-0.5)*2);
  1667.         ncolor.xyz = max(ncolor, pow(ncolor, ((1.0+ncolor) * (shadowColor))*shadowThreshold)/shadowCurve);
  1668.         color.xyz = saturate(ncolor);
  1669.         //brightspots///////////////////////////////////////////////////
  1670.         brightSpotColor = lerp(brightSpotColor/10, brightSpotColor, saturate(avgbr*2));
  1671.         brightSpotColor = lerp(brightSpotColor, 1, saturate(avgbr-0.5)*2);
  1672.         ncolor = 1-color;
  1673.         ncolor.xyz = max(ncolor, pow(ncolor, ((1.0 + ncolor) * (brightSpotColor))*brightSpotThreshold)/brightSpotCurve);
  1674.         color.xyz = saturate(1-ncolor);
  1675.         //convert to hsv////////////////////////////////////////////////
  1676.         hsvncolor = RGBtoHSV( color.xyz );
  1677.         hsvncolor.y = max( hsvncolor.y, 0.0 );
  1678.         hsvncolor.z = max( hsvncolor.z, 0.0 );
  1679.         //adaptation/contrast///////////////////////////////////////////
  1680.         hsvncolor.z = pow(hsvncolor.z, (grayadaptation*EAdaptationMaxV6+EAdaptationMinV6));
  1681.         //convert back to rgb///////////////////////////////////////////
  1682.         hsvncolor.y = max( hsvncolor.y, 0.0 );
  1683.         hsvncolor.z = max( hsvncolor.z, 0.0 );
  1684.         color.xyz = HSVtoRGB( hsvncolor );
  1685.         color.xyz /= grayadaptation*EAdaptationMaxV6+EAdaptationMinV6;
  1686.         color.xyz /= EAdaptationCompensateV6;
  1687.         //rerun ppv2////////////////////////////////////////////////////
  1688.         color.xyz *= EBrightnessV6;
  1689.         xncol = normalize(color.xyz);
  1690.         scl = color.xyz/xncol.xyz;
  1691.         scl = pow(scl, EIntensityContrastV6);
  1692.         xncol.xyz = pow(xncol.xyz, EColorSaturationV6);
  1693.         color.xyz = scl*xncol.xyz;
  1694.         color.xyz *= HCompensateSatV6;
  1695.         color.xyz = (color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV6);
  1696.         //lerp between vanilla and pp6 colors///////////////////////////
  1697.         color = lerp(oldcolor, color, PPAmount);
  1698.     #endif
  1699.     //+++++++++++++++++++++++++++++
  1700.    
  1701.     //////////////////////
  1702.     // ENB PALETTE CODE //
  1703.     //////////////////////
  1704.     #ifdef ENABLE_ENB_PALETTE
  1705.  
  1706.     float PMInteriorFactor = EInteriorFactor;
  1707.     float PMNightDayFactor = ENightDayFactor;
  1708.     #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1709.         PMInteriorFactor = 1.0 - EInteriorFactor;
  1710.     #endif
  1711.     #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1712.         PMNightDayFactor = 1.0 - ENightDayFactor;
  1713.     #endif
  1714.    
  1715.     float palmix =lerp( lerp( palmixDay, palmixNight, PMNightDayFactor ), palmixInterior, PMInteriorFactor );
  1716.  
  1717.  
  1718.     float3 enbpalcol = tex2D( _s7, 0.5 ).rgb;
  1719.     float enbpallum = ( enbpalcol.r + enbpalcol.g + enbpalcol.b );
  1720.     if( enbpallum > 0.0 )
  1721.     {
  1722.         color.rgb = saturate(color.rgb);
  1723.         float3  brightness = Adaptation.xyz;
  1724.         brightness=max(brightness.x, max(brightness.y, brightness.z));
  1725.         float3  palette=0.0;
  1726.         float4  uvsrc=0.0;
  1727.         uvsrc.x=color.r;
  1728.         uvsrc.y=brightness.r;
  1729.         palette.r=tex2D(_s7, uvsrc).r;
  1730.         uvsrc.x=color.g;
  1731.         uvsrc.y=brightness.g;
  1732.         palette.g=tex2D(_s7, uvsrc).g;
  1733.         uvsrc.x=color.b;
  1734.         uvsrc.y=brightness.b;
  1735.         palette.b=tex2D(_s7, uvsrc).b;
  1736.         color.rgb=palette.rgb * palmix;
  1737.     }
  1738.     #endif  
  1739.  
  1740.     /////////////////////
  1741.     // SEPIA TONE CODE //
  1742.     /////////////////////
  1743.     #ifdef ENABLE_SEPIATONE
  1744.  
  1745.         float SPInteriorFactor = EInteriorFactor;
  1746.         float SPNightDayFactor = ENightDayFactor;
  1747.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1748.             SPInteriorFactor = 1 - EInteriorFactor;
  1749.         #endif
  1750.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1751.             SPNightDayFactor = 1 - ENightDayFactor;
  1752.         #endif
  1753.  
  1754.         float fSepiaExposure =lerp( lerp( fSepiaExposureDay, fSepiaExposureNight, SPNightDayFactor ), fSepiaExposureInterior, SPInteriorFactor );
  1755.         float fSepiaColor =lerp( lerp( fSepiaColorDay, fSepiaColorNight, SPNightDayFactor ), fSepiaColorInterior, SPInteriorFactor );
  1756.         float fSepiaDesaturation =lerp( lerp( fSepiaDesaturationDay, fSepiaDesaturationNight, SPNightDayFactor ), fSepiaDesaturationInterior, SPInteriorFactor );
  1757.  
  1758.     float SepiaWeight = float3( 0.2125, 0.7154, 0.0721 );
  1759.     float SepiaLuminance = min( 1.0, dot( color, SepiaWeight ) * fSepiaExposure ) ;
  1760.     float3 SepiaColor = fSepiaColor * SepiaLuminance;
  1761.     color.rgb = lerp( color.rgb, SepiaColor, fSepiaDesaturation );
  1762.     #endif
  1763.    
  1764.     ////////////////
  1765.     // GRAIN CODE //
  1766.     ////////////////
  1767.     #ifdef ENABLE_GRAIN
  1768.  
  1769.         float GInteriorFactor = EInteriorFactor;
  1770.         float GNightDayFactor = ENightDayFactor;
  1771.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1772.             GInteriorFactor = 1 - EInteriorFactor;
  1773.         #endif
  1774.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1775.             GNightDayFactor = 1 - ENightDayFactor;
  1776.         #endif
  1777.  
  1778.         float fGrainMotion =lerp( lerp( fGrainMotionDay, fGrainMotionNight, GNightDayFactor ), fGrainMotionInterior, GInteriorFactor );
  1779.         float fGrainSaturation =lerp( lerp( fGrainSaturationDay, fGrainSaturationNight, GNightDayFactor ), fGrainSaturationInterior, GInteriorFactor );
  1780.         float fGrainIntensity =lerp( lerp( fGrainIntensityDay, fGrainIntensityNight, GNightDayFactor ), fGrainIntensityInterior, GInteriorFactor );
  1781.  
  1782.  
  1783.     float GrainTimerSeed = Timer.x * fGrainMotion;
  1784.     float2 GrainTexCoordSeed = _v0.xy * 1.0;
  1785.     float2 GrainSeed1 = GrainTexCoordSeed + float2( 0.0, GrainTimerSeed );
  1786.     float2 GrainSeed2 = GrainTexCoordSeed + float2( GrainTimerSeed, 0.0 );
  1787.     float2 GrainSeed3 = GrainTexCoordSeed + float2( GrainTimerSeed, GrainTimerSeed );
  1788.     float GrainNoise1 = random( GrainSeed1 );
  1789.     float GrainNoise2 = random( GrainSeed2 );
  1790.     float GrainNoise3 = random( GrainSeed3 );
  1791.     float GrainNoise4 = ( GrainNoise1 + GrainNoise2 + GrainNoise3 ) * 0.333333333;
  1792.     float3 GrainNoise = float3( GrainNoise4, GrainNoise4, GrainNoise4 );
  1793.     float3 GrainColor = float3( GrainNoise1, GrainNoise2, GrainNoise3 );
  1794.     color.rgb += ( lerp( GrainNoise, GrainColor, fGrainSaturation ) * fGrainIntensity ) - ( fGrainIntensity * 0.5);
  1795.     #endif
  1796.  
  1797.     ///////////////////
  1798.     // VIGNETTE CODE //
  1799.     ///////////////////
  1800.     #ifdef ENABLE_VIGNETTE
  1801.  
  1802.         float VInteriorFactor = EInteriorFactor;
  1803.         float VNightDayFactor = ENightDayFactor;
  1804.         #ifdef ENABLE_FLIP_INT_EXT_FACTOR
  1805.             VInteriorFactor = 1 - EInteriorFactor;
  1806.         #endif
  1807.         #ifdef ENABLE_FLIP_NITE_DAY_FACTOR
  1808.             VNightDayFactor = 1 - ENightDayFactor;
  1809.         #endif
  1810.  
  1811.         float fVignetteCenter =lerp( lerp( fVignetteCenterDay, fVignetteCenterNight, VNightDayFactor ), fVignetteCenterInterior, VInteriorFactor );
  1812.         float fVignetteScale =lerp( lerp( fVignetteScaleDay, fVignetteScaleNight, VNightDayFactor ), fVignetteScaleInterior, VInteriorFactor );
  1813.         float fVignetteRadius =lerp( lerp( fVignetteRadiusDay, fVignetteRadiusNight, VNightDayFactor ), fVignetteRadiusInterior, VInteriorFactor );
  1814.         float fVignetteSharpness =lerp( lerp( fVignetteSharpnessDay, fVignetteSharpnessNight, VNightDayFactor ), fVignetteSharpnessInterior, VInteriorFactor );
  1815.         float fVignetteCurve =lerp( lerp( fVignetteCurveDay, fVignetteCurveNight, VNightDayFactor ), fVignetteCurveInterior, VInteriorFactor );
  1816.  
  1817.     float2 VignettePosition = ( _v0.xy - fVignetteCenter ) * float2( ScreenSize.z, 1.0 );
  1818.     VignettePosition /= fVignetteScale;
  1819.     float VignetteDistance = distance( VignettePosition, float2(0.0 , 0.0) );
  1820.     float VignetteEffect = max( 0.0, ( VignetteDistance - fVignetteRadius ) * fVignetteSharpness * 50.0 );
  1821.     color.rgb *= max( 0.0, min( 1.0, 1.0 - pow( VignetteEffect, fVignetteCurve ) ) );
  1822.     #endif
  1823.  
  1824.    _oC0.w=1.0;
  1825.    _oC0.xyz=color.xyz;
  1826.  
  1827.    return _oC0;
  1828. }
  1829.  
  1830.  
  1831.  
  1832. //switch between vanilla and mine post processing
  1833. #ifndef ENB_FLIPTECHNIQUE
  1834. technique Shader_D6EC7DD1
  1835. #else
  1836. technique Shader_ORIGINALPOSTPROCESS
  1837. #endif
  1838. {
  1839.    pass p0
  1840.    {
  1841.       VertexShader  = compile vs_3_0 VS_Quad();
  1842.       PixelShader  = compile ps_3_0 PS_D6EC7DD1();
  1843.  
  1844.       ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1845.       ZEnable=FALSE;
  1846.       ZWriteEnable=FALSE;
  1847.       CullMode=NONE;
  1848.       AlphaTestEnable=FALSE;
  1849.       AlphaBlendEnable=FALSE;
  1850.       SRGBWRITEENABLE=FALSE;
  1851.    }
  1852. }
  1853.  
  1854.  
  1855.  
  1856. //original shader of post processing
  1857. #ifndef ENB_FLIPTECHNIQUE
  1858. technique Shader_ORIGINALPOSTPROCESS
  1859. #else
  1860. technique Shader_D6EC7DD1
  1861. #endif
  1862. {
  1863.    pass p0
  1864.    {
  1865.       VertexShader  = compile vs_3_0 VS_Quad();
  1866.       PixelShader=
  1867.    asm
  1868.    {
  1869. // Parameters:
  1870. //   sampler2D Avg;
  1871. //   sampler2D Blend;
  1872. //   float4 Cinematic;
  1873. //   float4 ColorRange;
  1874. //   float4 Fade;
  1875. //   sampler2D Image;
  1876. //   float4 Param;
  1877. //   float4 Tint;
  1878. // Registers:
  1879. //   Name         Reg   Size
  1880. //   ------------ ----- ----
  1881. //   ColorRange   c1       1
  1882. //   Param        c2       1
  1883. //   Cinematic    c3       1
  1884. //   Tint         c4       1
  1885. //   Fade         c5       1
  1886. //   Image        s0       1
  1887. //   Blend        s1       1
  1888. //   Avg          s2       1
  1889. //s0 bloom result
  1890. //s1 color
  1891. //s2 is average color
  1892.  
  1893.     ps_3_0
  1894.     def c6, 0, 0, 0, 0
  1895.     //was c0 originally
  1896.     def c7, 0.212500006, 0.715399981, 0.0720999986, 1
  1897.     dcl_texcoord v0.xy
  1898.     dcl_2d s0
  1899.     dcl_2d s1
  1900.     dcl_2d s2
  1901.     rcp r0.x, c2.y
  1902.     texld r1, v0, s2
  1903.     mul r0.yz, r1.xxyw, c1.y
  1904.     rcp r0.w, r0.y
  1905.     mul r0.z, r0.w, r0.z
  1906.     texld r1, v0, s1
  1907.     mul r1.xyz, r1, c1.y
  1908.     dp3 r0.w, c7, r1
  1909.     mul r1.w, r0.w, r0.z
  1910.     mad r0.z, r0.z, r0.w, c7.w
  1911.     rcp r0.z, r0.z
  1912.     mad r0.x, r1.w, r0.x, c7.w
  1913.     mul r0.x, r0.x, r1.w
  1914.     mul r0.x, r0.z, r0.x
  1915.     cmp r0.x, -r0.w, c6.x, r0.x
  1916.     rcp r0.z, r0.w
  1917.     mul r0.z, r0.z, r0.x
  1918.     add_sat r0.x, -r0.x, c2.x
  1919.     texld r2, v0, s0
  1920.     mul r2.xyz, r2, c1.y
  1921.     mul r2.xyz, r0.x, r2
  1922.     mad r1.xyz, r1, r0.z, r2
  1923.     dp3 r0.x, r1, c7
  1924.     mov r1.w, c7.w
  1925.     lrp r2, c3.x, r1, r0.x
  1926.     mad r1, r0.x, c4, -r2
  1927.     mad r1, c4.w, r1, r2
  1928.     mad r1, c3.w, r1, -r0.y
  1929.     mad r0, c3.z, r1, r0.y
  1930.     add r1, -r0, c5
  1931.     mad oC0, c5.w, r1, r0
  1932.    };
  1933.       ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1934.       ZEnable=FALSE;
  1935.       ZWriteEnable=FALSE;
  1936.       CullMode=NONE;
  1937.       AlphaTestEnable=FALSE;
  1938.       AlphaBlendEnable=FALSE;
  1939.       SRGBWRITEENABLE=FALSE;
  1940.     }
  1941. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement