Advertisement
Guest User

enbeffect ME 2.0 alayanrole

a guest
Apr 11th, 2014
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 190.95 KB | None | 0 0
  1. //++++++++++++++++++++++++++++++++++++++++++++
  2. // ENBSeries effect file
  3. // visit http://enbdev.com for updates
  4. // Copyright (c) 2007-2013 Boris Vorontsov
  5. // MasterEffect 2 enbeffect.fx file
  6. // Copyright by MartyMcFly
  7. // IF YOU UPLOAD YOUR ENB SOMEWHERE. DO NOT REMOVE
  8. // THIS COPYRIGHT OR YOUR ENB WILL BE REPORTED
  9. //++++++++++++++++++++++++++++++++++++++++++++
  10.  
  11.  
  12. // For ENB version 0.139 and up have "FLIP_NITE_DAY_FACTOR" enabled and "FLIP_INT_EXT_FACTOR" disabled.
  13. // For ENB version 0.119 and up have "FLIP_NITE_DAY_FACTOR" enabled and "FLIP_INT_EXT_FACTOR" enabled.
  14. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  15. #define FLIP_INT_EXT_FACTOR 0 // Flips the interior and exterior factor, so that interior settings affect exteriors and vice versa.
  16. //INTERIOR, EXTERIOR SEPARATION IS NOT USED BY 0.238 FOR NOW!!!
  17.  
  18. #define FLIP_NITE_DAY_FACTOR 1 // Flips the day and night factor, so that day settings affect nights and vice versa.
  19.  
  20. // Post bloom results in a higher dynamic range, pre bloom blends in with the scene better.
  21. // Choose one, two will break the file.
  22. #define PRE_BLOOM 1 // Bloom happens before my post processing code
  23. #define POST_BLOOM 0 // Bloom happens after my post processing code
  24.  
  25. // Bloom type (choose one)
  26. #define CURVE_BLOOM 0 // Precise bloom type that avoids affecting dark areas.
  27. #define CRISP_BLOOM 0 // Crisp bloom that avoids blurring colors around too much.
  28. #define DIFFUSE_BLOOM 1 // More controlled and accurate bloom than default.
  29. #define ENB_BLOOM 0 // Default ENB bloom with HSV color controls.
  30.  
  31. // Bloom mixing type (multiple selections possible)
  32. #define BLOOM_COLORIZATION 0 // Adjusts intensity of bloom RGB and CMY color channels.
  33. #define BLOOM_DEFUZZ 0 // Attempts to remove some haziness from bloom.
  34. #define BLOOM_ADD 1 // Uses addition for bloom, adding it to the original image. Most reliable option.
  35. #define BLOOM_LERP 0 // Uses interpolation to blend the bloom colors with the orginal image. Results in a hazy effect.
  36.  
  37. // Various color controls
  38. #define HSV_CONTROLS 0 // Modifies colors using Hue/Saturation/Value controls.
  39. #define HSV_EQUALIZER 0 // Adjusts saturation of various colors individually.
  40. #define COLOR_FILTER 0 // Adjusts intensity of RGB and CMY color channels.
  41. #define COLORSAT_DAYNIGHT 0 // Adjusts saturation (not the same as intensity) of RGB and CMY color channels.
  42. #define COLOR_TWEAKS 0 // Provides control over brightness, contrast and saturation with in-game adjustment.
  43. #define FINAL_ADJUSTMENTS 0 // Highest quality brightness, saturation and contrast controls in the file. Happens after all other effects.
  44. #define COLOR_POLARIZATION 0 // Polarizes original colors along the color wheel based on a specified color, original colors close to the specified color will be shifted towards it and opposite colors will be accentuated.
  45. #define COLOR_GRADING 0 // Original RGB color channels are shifted towards a specified color, then remixed.
  46. #define BLEACH_BYPASS 0 // Effect used in cinema that desaturates the image and increases contrast.
  47. #define SEPIATONE 0 // Effect used in cinema that desaturates and tints the image.
  48. #define ENB_PALETTE 1 // Enables ENB palette texture mixing. Enable UsePaletteTexture in enbseries.ini. Warning: Limits dynamic range!
  49. #define ENB_PALETTE_LENSDIRT 0 // Adds a BF3-Style Lens Dirt to the screen, enblensdirt.bmp must be in GTA root folder
  50. #define POSTPROCESS 6 // Choose which post-processing effect to use, options range from 0 through 8.
  51. #define TVLEVELS 1 // Sets a new black and white point. This increases contrast but causes clipping.
  52. #define VIBRANCE 0 // Intelligently (de)saturates the pixels depending on their original saturation.
  53. #define MASTEREFFECT_TONEMAP 0 // Basic tonemap with filmiccurve and addcontrast function. Useful for beginners!
  54. #define CROSSPROCESS 0 // Imitates wrong chemistry of image processing, similiar to GTA V death/menu tint or old movie colorcorrection.
  55. #define SPHERICAL 0 // Tonemapper from Sonic Ether's Unbelieveable Shaders
  56. #define CINEONDPX 0 // Should make the image look like it's been converted to DPX Cineon
  57. #define SINCITY 0 // Effect from the movie "Sin City" - everything else than red is grey.
  58. #define COLORMOD 1 // Contrast, Saturation and Brightness ported from colormod.asi
  59.  
  60. // Overlay effects
  61. #define MT_VIGNETTE 0 // Darkens edges of the screen slightly to increase focus on the center.
  62. #define HD6_VIGNETTE 1 // A slightly different take on vignette.
  63. #define GRAIN 1 // Enables animated film grain.
  64. #define SHARPEN 0 // Sharps the image
  65. #define LETTERBOX_BARS 0 // Simulates a higher aspect ratio display for a more cinematic effect.
  66. #define BORDER 0 // 1 pixel broad border around screen to eliminate white outlining by excessive sharpening
  67.  
  68. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  69.  
  70. //////////////////////
  71. ///FINAL ADJUSTMENTS//
  72. //////////////////////
  73.  
  74. //Final color adjustments. I highly reccommend you use this effect instead of other saturation/contrast/brightness adjustments
  75. //when possible as it uses the most advanced formula out of any of them and produces the most mathematically and visually accurate results.
  76.  
  77. float3 SaturationDay = float3(1.0, 1.0, 1.0); //Adjusts saturation, higher is more saturated
  78. float BrightnessDay = 0.50; //Adjusts brightness, higher is brighter
  79. float ContrastDay = 0.0; //Adjusts contrast, higher is more defined, values range from -1.0 to 1.0
  80.  
  81. float SaturationNight = float3(0.6, 0.6, 0.6);
  82. float BrightnessNight = 0.50;
  83. float ContrastNight = 0.0;
  84.  
  85. float SaturationInt = float3(1.0, 1.0, 1.0);
  86. float BrightnessInt = 0.50;
  87. float ContrastInt = 0.0;
  88. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  89.  
  90.  
  91. //////////////////////
  92. //////TV LEVELS///////
  93. //////////////////////
  94.  
  95. float DARK_LEVEL_DAY = 26.00; // Brightness percent value - anything below this is completely black
  96. float DARK_LEVEL_NIGHT = 26.00;
  97. float DARK_LEVEL_INT = 26.00;
  98.  
  99. float BRIGHT_LEVEL_DAY = 86.0; // Brightness percent value - anything above this is completely white
  100. float BRIGHT_LEVEL_NIGHT = 86.0;
  101. float BRIGHT_LEVEL_INT = 86.0;
  102. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  103.  
  104.  
  105. //////////////////////
  106. //////VIBRANCE////////
  107. //////////////////////
  108.  
  109. float VibranceDay = 2.0; // Amount of intelligent saturation applied
  110. float VibranceNight = 1.3;
  111. float VibranceInterior = 1.3;
  112. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  113.  
  114.  
  115. //////////////////////////////////
  116. //////MASTEREFFECT_TONEMAP////////
  117. //////////////////////////////////
  118.  
  119. float MGammaDay = 1.2; // Gamma curve
  120. float MGammaNight = 1.2;
  121. float MGammaInterior = 1.2;
  122.  
  123. float MExposureDay = 0.11; // Brightness, higher means brighter but also more white
  124. float MExposureNight = 0.11;
  125. float MExposureInterior = 0.11;
  126.  
  127. float MSaturationDay = -0.2; // Color saturation
  128. float MSaturationNight = -0.2;
  129. float MSaturationInterior = -0.2;
  130.  
  131. float MBleachDay = -0.02; // desaturates and increases contrast to simulate bleached out image
  132. float MBleachNight = -0.02;
  133. float MBleachInterior = -0.02;
  134.  
  135. float MDefogDay = 0.05; // amount of color removal
  136. float MDefogNight = 0.05;
  137. float MDefogInterior = 0.05;
  138.  
  139. float MFogColorDay = float3(0.00, 0.0, -0.30); // which color to remove, default blue is removed by -0.30
  140. float MFogColorNight = float3(0.00, 0.0, -0.30); // negative value means that blue isn't removed but added :P
  141. float MFogColorInterior = float3(0.00, 0.0, -0.30);
  142.  
  143. float MADay = 0.15;
  144. float MANight = 0.15;
  145. float MAInterior = 0.15;
  146.  
  147. float MBDay = 0.50;
  148. float MBNight = 0.50;
  149. float MBInterior = 0.50;
  150.  
  151. float MCDay = 0.10;
  152. float MCNight = 0.10;
  153. float MCInterior = 0.10;
  154.  
  155. float MDDay = 0.20;
  156. float MDNight = 0.20;
  157. float MDInterior = 0.20;
  158.  
  159. float MEDay = 0.02;
  160. float MENight = 0.02;
  161. float MEInterior = 0.02;
  162.  
  163. float MFDay = 0.30;
  164. float MFNight = 0.30;
  165. float MFInterior = 0.30;
  166.  
  167. float MWDay = 16.2;
  168. float MWNight = 16.2;
  169. float MWInterior = 16.2;
  170.  
  171. float MExpAdjustDay = 20.5;
  172. float MExpAdjustNight = 20.5;
  173. float MExpAdjustInterior = 20.5;
  174.  
  175. float MAddContrastDay = 0.25;
  176. float MAddContrastNight = 0.25;
  177. float MAddContrastInterior = 0.25;
  178. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  179.  
  180.  
  181. /////////////////////////////
  182. //////CROSSPROCESSING////////
  183. /////////////////////////////
  184.  
  185. float CrossContrastDay = 1.1; // Contrast
  186. float CrossContrastNight = 1.1;
  187. float CrossContrastInterior = 1.1;
  188.  
  189. float CrossSaturationDay = 0.85; // Saturation
  190. float CrossSaturationNight = 0.85;
  191. float CrossSaturationInterior = 0.85;
  192.  
  193. float CrossBrightnessDay = -0.145; // Brightness...
  194. float CrossBrightnessNight = -0.145;
  195. float CrossBrightnessInterior = -0.145;
  196.  
  197. float CrossAmountDay = 0.8; // Amount of Cross Processing applied, the higher, the more the color gets cross processed
  198. float CrossAmountNight = 0.8;
  199. float CrossAmountInterior = 0.8;
  200.  
  201. // DO NOT CHANGE THIS!!!!
  202. float2 CrossMatrix [3] = {
  203. float2 (1.03, 0.04),
  204. float2 (1.09, 0.01),
  205. float2 (0.78, 0.13),
  206. };
  207. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  208.  
  209.  
  210. /////////////////////////////////
  211. //////SPHERICAL TONEMAPPING//////
  212. /////////////////////////////////
  213.  
  214.  
  215.  
  216. float sphericalAmountDay = 0.3; // Increases the amount of tonemapping applied
  217. float sphericalAmountNight = 0.3;
  218. float sphericalAmountInterior = 0.3;
  219.  
  220. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  221.  
  222.  
  223. //////////////////////
  224. //////CINEON DPX//////
  225. //////////////////////
  226.  
  227. float DPXRedDay = 5.0; // Increases power of the specific color
  228. float DPXGreenDay = 5.0;
  229. float DPXBlueDay = 5.0;
  230.  
  231. float DPXRedNight = 5.0;
  232. float DPXGreenNight = 5.0;
  233. float DPXBlueNight = 5.0;
  234.  
  235. float DPXRedInterior = 5.0;
  236. float DPXGreenInterior = 5.0;
  237. float DPXBlueInterior = 5.0;
  238.  
  239. float DPXColorGammaDay = 1.0; // Increases polor curve
  240. float DPXColorGammaNight = 1.0;
  241. float DPXColorGammaInterior = 1.0;
  242.  
  243. float DPXDPXSaturationDay = 1.0; // Increases color saturation
  244. float DPXDPXSaturationNight = 1.0;
  245. float DPXDPXSaturationInterior = 1.0;
  246.  
  247. float DPXRedCDay = 0.35; // Increases curve of the specific color
  248. float DPXGreenCDay = 0.35;
  249. float DPXBlueCDay = 0.34;
  250.  
  251. float DPXRedCNight = 0.35;
  252. float DPXGreenCNight = 0.35;
  253. float DPXBlueCNight = 0.34;
  254.  
  255. float DPXRedCInterior = 0.35;
  256. float DPXGreenCInterior = 0.35;
  257. float DPXBlueCInterior = 0.34;
  258.  
  259. float DPXBlendDay = 1.0; // Increases DPX Intensity
  260. float DPXBlendNight = 1.0;
  261. float DPXBlendInterior = 1.0; // But will it blend? :O
  262.  
  263. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  264.  
  265. //////////////////////
  266. ///////COLORMOD///////
  267. //////////////////////
  268.  
  269. float ColormodChroma = 0.8; // Saturation
  270.  
  271. float ColormodGammaR = 1.05; // Gamma for Red color channel
  272. float ColormodGammaG = 1.05; // Gamma for Green color channel
  273. float ColormodGammaB = 1.05; // Gamma for Blue color channel
  274.  
  275. float ColormodContrastR = 0.6; // Contrast for Red color channel
  276. float ColormodContrastG = 0.6; // ...
  277. float ColormodContrastB = 0.6; // ...
  278.  
  279. float ColormodBrightnessR = -0.08; // Brightness for Red color channel
  280. float ColormodBrightnessG = -0.08; // ...
  281. float ColormodBrightnessB = -0.08; // ...
  282.  
  283. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  284.  
  285. //////////////////////
  286. /////CURVE BLOOM//////
  287. //////////////////////
  288. #if(CURVE_BLOOM == 1)
  289.  
  290.  
  291. #define SHARP_MODE 1 // Enables a sharper version of Curve Bloom.
  292.  
  293. //Curve Bloom Day settings.////////////////////////////////////
  294. float3 curvebloommultDay = float3( 1.0, 1.0, 1.0 ); // Adjusts intensity of RGB color channels
  295. float3 curvebloomsubDay = float3( 0.0, 0.0, 0.0 ); // Intensity adjustment using subtraction
  296. float curveMAGENTAbloomDay = 1.0; // Increases the amount of magenta color there is in bloom
  297. float curveCYANbloomDay = 1.0; // Increases the amount of cyan color there is in bloom
  298. float curveYELLOWbloomDay = 1.0; // Increases the amount of yellow color there is in bloom
  299.  
  300. float BloomThresholdDay = 1.4; //Adjusts curve bloom brightness threshold, higher is less sensitive to brightness
  301. float BloomCurveDay = 1.0; //Adjusts curve bloom brightness before contrast adjustment, higher is darker
  302. float BloomBrightnessDay = 1.0; //Adjusts brightness of curve bloom after contrast adjustment, higher is brighter
  303. float BloomContrastDay = 1.5; //Adjusts contrast of curve bloom, higher is more defined
  304. float3 BloomSaturationDay = float3(1.2, 0.85, 0.97); //Adjusts saturation of curve bloom, higher is more colorful
  305.  
  306. //Curve Bloom Night settings./////////////////////////////////
  307. float3 curvebloommultNight = float3( 1.0, 1.0, 1.0 );
  308. float3 curvebloomsubNight = float3( 0.0, 0.0, 0.0 );
  309. float curveMAGENTAbloomNight = 1.0;
  310. float curveCYANbloomNight = 1.0;
  311. float curveYELLOWbloomNight = 1.0;
  312.  
  313. float BloomThresholdNight = 1.4;
  314. float BloomCurveNight = 1.0;
  315. float BloomBrightnessNight = 1.0;
  316. float BloomContrastNight = 1.5;
  317. float3 BloomSaturationNight = float3(1.2, 0.85, 0.97);
  318.  
  319. //Curve Bloom Interior settings.//////////////////////////////
  320. float3 curvebloommultInterior = float3( 1.0, 1.0, 1.0 );
  321. float3 curvebloomsubInterior = float3( 0.0, 0.0, 0.0 );
  322. float curveMAGENTAbloomInterior = 1.0;
  323. float curveCYANbloomInterior = 1.0;
  324. float curveYELLOWbloomInterior = 1.0;
  325.  
  326. float BloomThresholdInt = 1.4;
  327. float BloomCurveInt = 1.0;
  328. float BloomBrightnessInt = 1.0;
  329. float BloomContrastInt = 1.5;
  330. float3 BloomSaturationInt = float3(1.0, 1.0, 1.0);
  331. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  332. #endif
  333.  
  334.  
  335. //////////////////////
  336. /////CRISP BLOOM//////
  337. //////////////////////
  338. #if(CRISP_BLOOM == 1)
  339. // HD6 BLOOM CRISP - Alternate crisp bloom, no hazey mud.
  340.  
  341. //DAY
  342.  
  343. float3 crispbloommultDay = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue bloom colors seperately
  344. float3 crispbloomsubDay = float3( 0.0, 0.0, 0.0 ); // Alters appearance of the Red, Green and Blue bloom colors
  345. float crispMAGENTAbloomDay = 1.0; // Increases the amount of magenta color there is in bloom
  346. float crispCYANbloomDay = 1.0; // Increases the amount of cyan color there is in bloom
  347. float crispYELLOWbloomDay = 1.0; // Increases the amount of yellow color there is in bloom
  348.  
  349. float3 LumCoeffDay = ( 0.2125, 0.7154, 0.0721 ); // Increases brightness around "bloomy" spots
  350. float3 AvgLuminDay = ( 0.5, 0.5, 0.5 ); // Increases contrast around "bloomy" spots
  351.  
  352. float TrigDay = 0.18; // Limits what triggers a bloom
  353. float SBrightDay = 0.7; // Limits bloom to superbright spots only
  354.  
  355. float CBrightnessDay = 1.0; // Adjust the bloom brightness
  356. float CContrastDay = 1.1; // Adjust the bloom contrast
  357. float CSaturationDay = 1.0; // Adjust the bloom saturation
  358.  
  359. float BrightnessModDay = 0.0; // Compensate the brightness when no bloom is used
  360. float BrightnessMultDay = 1.0; // Compensate the brightness when no bloom is used
  361.  
  362. float CompSBDay = 1.0; // Limits where the bloom will "bloom"
  363. float BloomStrDay = 1.0; // How strong the bloom will be
  364.  
  365. float BloomBlendDay = 0.5; // How much blend there will be between ENB and Vanilla bloom
  366. float BlendCompDay = 1.0; // Compensate for brightening caused by above bloom blend
  367.  
  368. //NIGHT
  369.  
  370. float3 crispbloommultNight = float3( 1.0, 1.0, 1.0 );
  371. float3 crispbloomsubNight = float3( 0.0, 0.0, 0.0 );
  372. float crispMAGENTAbloomNight = 1.0;
  373. float crispCYANbloomNight = 1.0;
  374. float crispYELLOWbloomNight = 1.0;
  375.  
  376. float3 LumCoeffNight = ( 0.2125, 0.7154, 0.0721 ); // Increases brightness around "bloomy" spots
  377. float3 AvgLuminNight = ( 0.5, 0.5, 0.5 ); // Increases contrast around "bloomy" spots
  378.  
  379. float TrigNight = 0.18; // Limits what triggers a bloom
  380. float SBrightNight = 0.7; // Limits bloom to superbright spots only
  381.  
  382. float CBrightnessNight = 1.0; // Adjust the bloom brightness
  383. float CContrastNight = 1.1; // Adjust the bloom contrast
  384. float CSaturationNight = 1.0; // Adjust the bloom saturation
  385.  
  386. float BrightnessModNight = 0.0; // Compensate the brightness when no bloom is used
  387. float BrightnessMultNight = 1.0; // Compensate the brightness when no bloom is used
  388.  
  389. float CompSBNight = 1.0; // Limits where the bloom will "bloom"
  390. float BloomStrNight = 1.0; // How strong the bloom will be
  391.  
  392. float BloomBlendNight = 0.5; // How much blend there will be between ENB and Vanilla bloom
  393. float BlendCompNight = 1.0; // Compensate for brightening caused by above bloom blend
  394.  
  395. //Interior
  396.  
  397. float3 crispbloommultInterior = float3( 1.0, 1.0, 1.0 );
  398. float3 crispbloomsubInterior = float3( 0.0, 0.0, 0.0 );
  399. float crispMAGENTAbloomInterior = 1.0;
  400. float crispCYANbloomInterior = 1.0;
  401. float crispYELLOWbloomInterior = 1.0;
  402.  
  403. float3 LumCoeffInterior = ( 0.2125, 0.7154, 0.0721 ); // Increases brightness around "bloomy" spots
  404. float3 AvgLuminInterior = ( 0.5, 0.5, 0.5 ); // Increases contrast around "bloomy" spots
  405.  
  406. float TrigInterior = 0.18; // Limits what triggers a bloom
  407. float SBrightInterior = 0.7; // Limits bloom to superbright spots only
  408.  
  409. float CBrightnessInterior = 1.0; // Adjust the bloom brightness
  410. float CContrastInterior = 1.1; // Adjust the bloom contrast
  411. float CSaturationInterior = 0.8; // Adjust the bloom saturation
  412.  
  413. float BrightnessModInterior = 0.0; // Compensate the brightness when no bloom is used
  414. float BrightnessMultInterior = 1.0; // Compensate the brightness when no bloom is used
  415.  
  416. float CompSBInterior = 1.0; // Limits where the bloom will "bloom"
  417. float BloomStrInterior = 1.0; // How strong the bloom will be
  418.  
  419. float BloomBlendInterior = 0.5; // How much blend there will be between ENB and Vanilla bloom
  420. float BlendCompInterior = 1.0; // Compensate for brightening caused by above bloom blend
  421. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  422. #endif
  423. /////////////////////
  424. ///DIFFUSE BLOOM/////
  425. /////////////////////
  426. #if(DIFFUSE_BLOOM == 1)
  427. //-----------------------------------------------------------------------------------------------------------
  428. // Diffuse Bloom Day. Red, Green, Blue
  429. float3 diffbloommultDay = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue bloom colors seperately
  430. float3 diffbloomsubDay = float3( 0.0, 0.0, 0.0 ); // Alters appearance of the Red, Green and Blue bloom colors
  431. float diffMAGENTAbloomDay = 0.87; // Increases the amount of magenta color there is in bloom
  432. float diffCYANbloomDay = 0.9; // Increases the amount of cyan color there is in bloom
  433. float diffYELLOWbloomDay = 0.9; // Increases the amount of yellow color there is in bloom
  434. float SatDay = 0.95; // Controls the saturation of the diffuse bloom
  435. float LumaDay = 0.65; // Controls the Luminosity/brightness of the diffuse bloom
  436. float PowDay = 1.0; // Dampens the bloom, making it less visible
  437. float Pow2Day = 0.00001; // Dampens the bloom, making it less visible
  438.  
  439. // Diffuse Bloom Night. Red, Green, Blue
  440. float3 diffbloommultNight = float3( 1.0, 1.0, 1.0 );
  441. float3 diffbloomsubNight = float3( 0.0, 0.0, 0.0 );
  442. float diffMAGENTAbloomNight = 1.07;
  443. float diffCYANbloomNight = 1.1;
  444. float diffYELLOWbloomNight = 1.05;
  445. float SatNight = 0.95;
  446. float LumaNight = 1.0;
  447. float PowNight = 2.5;
  448. float Pow2Night = 0.0001;
  449.  
  450. // Diffuse Bloom Interior. Red, Green, Blue
  451. float3 diffbloommultInterior = float3( 1.0, 1.0, 1.0 );
  452. float3 diffbloomsubInterior = float3( 0.0, 0.0, 0.0 );
  453. float diffMAGENTAbloomInterior = 1.0;
  454. float diffCYANbloomInterior = 1.0;
  455. float diffYELLOWbloomInterior = 1.0;
  456. float SatInterior = 1.0;
  457. float LumaInterior = 1.0;
  458. float PowInterior = 2.0;
  459. float Pow2Interior = 0.0001;
  460. //-----------------------------------------------------------------------------------------------------------
  461. #endif
  462. /////////////////////
  463. ///ENB BLOOM/////////
  464. /////////////////////
  465. #if(ENB_BLOOM == 1)
  466. //-----------------------------------------------------------------------------------------------------------
  467. // ENB Bloom settings.
  468.  
  469. // DAY Red, Green, Blue
  470. float3 ENBbloommultDay = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue bloom colors seperately
  471. float3 ENBbloomsubDay = float3( 0.0, 0.0, 0.0 ); // Alters appearance of the Red, Green and Blue bloom colors
  472. float ENBMAGENTAbloomDay = 1.0; // Increases the amount of magenta color there is in bloom
  473. float ENBCYANbloomDay = 1.0; // Increases the amount of cyan color there is in bloom
  474. float ENBYELLOWbloomDay = 1.0; // Increases the amount of yellow color there is in bloom
  475.  
  476. float fBloomIntensityMultDay = 1.0; // Controls brightness of bloom. Higher values are brighter.
  477. float fBloomIntensityModDay = 0.0; // Controls brightness of bloom. Higher values are brighter.
  478. float fBloomIntensityCurveDay = 1.0; // Controls brightness curve of bloom. Higher values make midranges darker.
  479. float fBloomIntensitySmoothDay = 0.0; // Controls brightness contrast of bloom. Makes darks darker and brights brighter.
  480. float fBloomIntensityMaxDay = 10.0; // Controls brightness maximum of bloom.
  481. float fBloomSaturationMultDay = 1.0; // Controls the saturation of bloom. Higher values are more colorful.
  482. float fBloomSaturationCurveDay = 1.0; // Controls the saturation curve of bloom. Higher values reduce midrange colors.
  483. float fBloomSaturationSmoothDay = 0.0; // Controls the saturation contrast of bloom. Reduces subtle coloring.
  484.  
  485. // NIGHT Red, Green, Blue
  486. float3 ENBbloommultNight = float3( 1.0, 1.0, 1.0 );
  487. float3 ENBbloomsubNight = float3( 0.0, 0.0, 0.0 );
  488. float ENBMAGENTAbloomNight = 1.0;
  489. float ENBCYANbloomNight = 1.0;
  490. float ENBYELLOWbloomNight = 1.0;
  491.  
  492. float fBloomIntensityMultNight = 1.0;
  493. float fBloomIntensityModNight = 0.0;
  494. float fBloomIntensityCurveNight = 1.0;
  495. float fBloomIntensitySmoothNight = 0.0;
  496. float fBloomIntensityMaxNight = 10.0;
  497. float fBloomSaturationMultNight = 1.0;
  498. float fBloomSaturationCurveNight = 1.0;
  499. float fBloomSaturationSmoothNight = 0.0;
  500.  
  501. // INTERIOR Red, Green, Blue
  502. float3 ENBbloommultInterior = float3( 1.0, 1.0, 1.0 );
  503. float3 ENBbloomsubInterior = float3( 0.0, 0.0, 0.0 );
  504. float ENBMAGENTAbloomInterior = 1.0;
  505. float ENBCYANbloomInterior = 1.0;
  506. float ENBYELLOWbloomInterior = 1.0;
  507.  
  508. float fBloomIntensityMultInterior = 1.0;
  509. float fBloomIntensityModInterior = 0.0;
  510. float fBloomIntensityCurveInterior = 1.0;
  511. float fBloomIntensitySmoothInterior = 0.0;
  512. float fBloomIntensityMaxInterior = 10.0;
  513. float fBloomSaturationMultInterior = 1.0;
  514. float fBloomSaturationCurveInterior = 1.0;
  515. float fBloomSaturationSmoothInterior= 0.0;
  516. //-----------------------------------------------------------------------------------------------------------
  517. #endif
  518.  
  519. /////////////////////
  520. ///COLOR FILTER//////
  521. /////////////////////
  522. #if(COLOR_FILTER == 1)
  523. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  524. // COLOR SETTINGS
  525. //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.
  526. // Red, Green, Blue
  527. float3 EColorFilterDay = float3 ( 1.0, 1.0, 1.0 );// Adjusts the RGB values seperately, Red, Green and Blue.
  528. float3 EColorFilterNight = float3 ( 1.0, 1.0, 1.0 ); // Adjusts the RGB values seperately, Red, Green and Blue.
  529. float3 EColorFilterInterior = float3 ( 1.0, 1.0, 1.0 ); // Adjusts the RGB values seperately, Red, Green and Blue.
  530.  
  531. float3 EColorFilterSubDay = float3 ( 0.0, 0.0, 0.0 ); // Subtract the RGB values seperately, Red, Green and Blue.
  532. float3 EColorFilterSubNight = float3 ( 0.0, 0.0, 0.0 ); // Subtract the RGB values seperately, Red, Green and Blue.
  533. float3 EColorFilterSubInterior = float3 ( 0.0, 0.0, 0.0 ); // Subtract the RGB values seperately, Red, Green and Blue
  534.  
  535. // DAY
  536. float MAGENTADay = 1.0; // Adds specified amount of magenta color
  537. float MAGENTAsubDay = 0.0; // Subtracts specified amount of magenta color
  538. float CYANDay = 1.0; // Adds specified amount of cyan color
  539. float CYANsubDay = 0.0; // Subtracts specified amount of cyan color
  540. float YELLOWDay = 1.0; // Adds specified amount of yellow color
  541. float YELLOWsubDay = 0.0; // Subtracts specified amount of yellow color
  542. // NIGHT
  543. float MAGENTANight = 1.0; // Adds specified amount of magenta color
  544. float MAGENTAsubNight = 0.0; // Subtracts specified amount of magenta color
  545. float CYANNight = 1.0; // Adds specified amount of cyan color
  546. float CYANsubNight = 0.0; // Subtracts specified amount of cyan color
  547. float YELLOWNight = 1.0; // Adds specified amount of yellow color
  548. float YELLOWsubNight = 0.0; // Subtracts specified amount of yellow color
  549. // INTERIOR
  550. float MAGENTAInterior = 1.0; // Adds specified amount of magenta color
  551. float MAGENTAsubInterior = 0.0; // Subtracts specified amount of magenta color
  552. float CYANInterior = 1.0; // Adds specified amount of cyan color
  553. float CYANsubInterior = 0.0; // Subtracts specified amount of cyan color
  554. float YELLOWInterior = 1.0; // Adds specified amount of yellow color
  555. float YELLOWsubInterior = 0.0; // Subtracts specified amount of yellow color
  556. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  557. #endif
  558. /////////////////////
  559. ///HSV CONTROLS//////
  560. /////////////////////
  561. #if(HSV_CONTROLS == 1)
  562. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  563. // HSV Color Correction settings.
  564.  
  565. // HSV Daytime Settings
  566. float fColorSaturationMultDay = 1.0; // Controls the color saturation multiplier. Range: 0.0 (greyscale) to 2.0 (hypercolor).
  567. float fColorSaturationModDay = 0.0; // Controls the color saturation. Range: -1 to 1. Default: 0.0
  568. float fColorSaturationCurveDay = 0.0; // Controls the color saturation curve. Default: 1.0.
  569. float fColorSaturationSmoothDay = 0.0; // Controls the color saturation contrast. Default: 0.0.
  570.  
  571. float fColorIntensityMultDay = 1.0; // Controls the color intensity multiplier. Default: 1.0
  572. float fColorIntensityModDay = 0.0; // Controls the color brightness. Range: -1 to 1. Default: 0.0
  573. float fColorIntensityCurveDay = 1.0; // Controls the color intensity curve. Default: 1.0
  574. float fColorIntensitySmoothDay = 0.0; // Controls the color intensity contrast. Default: 0.0.
  575.  
  576. float fColorHueMultDay = 1.0; // Controls the color hue multiplier. Default: 1.0
  577. float fColorHueModDay = 0.0; // Controls the color hue. Range: -1 to 1. Default: 0.0
  578. float fColorHueCurveDay = 1.0; // Controls the color hue curve. Default: 1.0.
  579. float fColorHueSmoothDay = 0.0; // Controls the color hue contrast. Default: 0.0.
  580.  
  581. // HSV Nighttime Settings
  582. float fColorSaturationMultNight = 1.0; // Controls the color saturation multiplier. Range: 0.0 (greyscale) to 2.0 (hypercolor).
  583. float fColorSaturationModNight = 0.0; // Controls the color saturation. Range: -1 to 1. Default: 0.0
  584. float fColorSaturationCurveNight = 1.0; // Controls the color saturation curve. Default: 1.0.
  585. float fColorSaturationSmoothNight = 0.0; // Controls the color saturation contrast. Default: 0.0.
  586.  
  587. float fColorIntensityMultNight = 1.0; // Controls the color intensity multiplier. Default: 1.0
  588. float fColorIntensityModNight = 0.0; // Controls the color brightness. Range: -1 to 1. Default: 0.0
  589. float fColorIntensityCurveNight = 1.0; // Controls the color intensity curve. Default: 1.0
  590. float fColorIntensitySmoothNight = 0.0; // Controls the color intensity contrast. Default: 0.0.
  591.  
  592. float fColorHueMultNight = 1.0; // Controls the color hue multiplier. Default: 1.0
  593. float fColorHueModNight = 0.0; // Controls the color hue. Range: -1 to 1. Default: 0.0
  594. float fColorHueCurveNight = 1.0; // Controls the color hue curve. Default: 1.0.
  595. float fColorHueSmoothNight = 0.0; // Controls the color hue contrast. Default: 0.0.
  596.  
  597. // HSV Interior Settings
  598. float fColorSaturationMultInterior = 1.0; // Controls the color saturation multiplier. Range: 0.0 (greyscale) to 2.0 (hypercolor).
  599. float fColorSaturationModInterior = 0.0; // Controls the color saturation. Range: -1 to 1. Default: 0.0
  600. float fColorSaturationCurveInterior = 1.0; // Controls the color saturation curve. Default: 1.0.
  601. float fColorSaturationSmoothInterior= 0.0; // Controls the color saturation contrast. Default: 0.0.
  602.  
  603. float fColorIntensityMultInterior = 1.0; // Controls the color intensity multiplier. Default: 1.0
  604. float fColorIntensityModInterior = 0.0; // Controls the color brightness. Range: -1 to 1. Default: 0.0
  605. float fColorIntensityCurveInterior = 1.0; // Controls the color intensity curve. Default: 1.0
  606. float fColorIntensitySmoothInterior = 0.0; // Controls the color intensity contrast. Default: 0.0.
  607.  
  608. float fColorHueMultInterior = 1.0; // Controls the color hue multiplier. Default: 1.0
  609. float fColorHueModInterior = 0.0; // Controls the color hue. Range: -1 to 1. Default: 0.0
  610. float fColorHueCurveInterior = 1.0; // Controls the color hue curve. Default: 1.0.
  611. float fColorHueSmoothInterior = 0.0; // Controls the color hue contrast. Default: 0.0.
  612. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  613. #endif
  614. /////////////////////
  615. ///HSV EQUALIZER/////
  616. /////////////////////
  617. #if(HSV_EQUALIZER == 1)
  618. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  619. // HSV Equalizer settings. Must have #define HSV_CONTROLS enabled.
  620. // Adjust multiplier and modifier of specific color saturations. Default: 0.0
  621.  
  622. //Multipliers////////////////////////////////////////////////
  623. float fColorSaturationMultRedDay = 0.0;
  624. float fColorSaturationMultRedNight = 0.0;
  625. float fColorSaturationMultRedInt = 0.0;
  626.  
  627. float fColorSaturationMultOrangeDay = 0.0;
  628. float fColorSaturationMultOrangeNight = 0.0;
  629. float fColorSaturationMultOrangeInt = 0.0;
  630.  
  631. float fColorSaturationMultYellowDay = 0.0;
  632. float fColorSaturationMultYellowNight = 0.0;
  633. float fColorSaturationMultYellowInt = 0.0;
  634.  
  635. float fColorSaturationMultGreenDay = 0.0;
  636. float fColorSaturationMultGreenNight = 0.0;
  637. float fColorSaturationMultGreenInt = 0.0;
  638.  
  639. float fColorSaturationMultCyanDay = 0.0;
  640. float fColorSaturationMultCyanNight = 0.0;
  641. float fColorSaturationMultCyanInt = 0.0;
  642.  
  643. float fColorSaturationMultBlueDay = 0.0;
  644. float fColorSaturationMultBlueNight = 0.0;
  645. float fColorSaturationMultBlueInt = 0.0;
  646.  
  647. float fColorSaturationMultMagentaDay = 0.0;
  648. float fColorSaturationMultMagentaNight = 0.0;
  649. float fColorSaturationMultMagentaInt = 0.0;
  650.  
  651. //Modifiers//////////////////////////////////////////////////
  652. float fColorSaturationModRedDay = 0.0;
  653. float fColorSaturationModRedNight = 0.0;
  654. float fColorSaturationModRedInt = 0.0;
  655.  
  656. float fColorSaturationModOrangeDay = 0.0;
  657. float fColorSaturationModOrangeNight = 0.0;
  658. float fColorSaturationModOrangeInt = 0.0;
  659.  
  660. float fColorSaturationModYellowDay = 0.0;
  661. float fColorSaturationModYellowNight = 0.0;
  662. float fColorSaturationModYellowInt = 0.0;
  663.  
  664. float fColorSaturationModGreenDay = 0.0;
  665. float fColorSaturationModGreenNight = 0.0;
  666. float fColorSaturationModGreenInt = 0.0;
  667.  
  668. float fColorSaturationModCyanDay = 0.0;
  669. float fColorSaturationModCyanNight = 0.0;
  670. float fColorSaturationModCyanInt = 0.0;
  671.  
  672. float fColorSaturationModBlueDay = 0.0;
  673. float fColorSaturationModBlueNight = 0.0;
  674. float fColorSaturationModBlueInt = 0.0;
  675.  
  676. float fColorSaturationModMagentaDay = 0.0;
  677. float fColorSaturationModMagentaNight = 0.0;
  678. float fColorSaturationModMagentaInt = 0.0;
  679. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  680. #endif
  681. /////////////////////
  682. ///COLOR TWEAKS//////
  683. /////////////////////
  684. //--------------------------------------------------------------------------------------------------------------------------
  685. // Red, Green, Blue
  686. float3 rgbd = float3( 1.0, 1.0, 1.0 ); // RGB balance Day
  687. float3 rgbn = float3( 1.0, 1.0, 1.0 ); // RGB balance Night
  688. float3 rgbi = float3( 1.0, 1.0, 1.0 ); // RGB balance Interior
  689.  
  690. // Change size of keypress dot here, can be 0 to hide it
  691. float dotsize = 0.01;
  692.  
  693. //Use the temporary variables 1-3 in the ENB tweaking overlay to control these settings in game
  694. // Day, Night, Int
  695. float3 uctbrt1[2] = { float3( 1.0, 1.0, 1.0 ), // Brightness maximum range
  696. float3( -1.0, -1.0, -1.0 ) };//Brightness minimum range
  697.  
  698. float3 uctbrt2[2] = { float3( 1.0, 1.0, 1.0 ), // Brightness maximum range (Alters after contrast adjustment)
  699. float3( -1.0, -1.0, -1.0 ) };//Brightness minimum range (Alters after contrast adjustment)
  700.  
  701. float3 uctcon[2] = { float3( 1.0, 1.0, 1.0 ), // Contrast maximum range
  702. float3( -1.0, -1.0, -1.0 ) };//Contrast minimum range
  703.  
  704. float3 uctsat[2] = { float3( 1.0, 1.0, 1.0 ), // Saturation maximum range
  705. float3( -1.0, -1.0, -1.0 ) };//Saturation minimum range
  706.  
  707. // Third set of brightness controls used for darkening nights.
  708. // Day Night Int
  709. float3 darkenby1[2] = { float3( 0.0, 0.0, 0.0 ), //Brightness maximum range
  710. float3( 0.0, 0.0, 0.0 ) }; //Brightness minimum range
  711.  
  712. //--------------------------------------------------------------------------------------------------------------------------
  713. /////////////////////
  714. ///COLORSAT DAYNIGHT/
  715. /////////////////////
  716. #if(COLORSAT_DAYNIGHT == 1)
  717. //--------------------------------------------------------------------------------------------------------------------------
  718. // HD6_COLORSAT_DAYNIGHT - Alter saturation seperately from Day, Night and Interior
  719. //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.
  720.  
  721. // Red, Green, Blue
  722. float3 ansatd = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue colors seperately during Days
  723. float3 ansatn = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue colors seperately during Nights
  724. float3 ansati = float3( 1.0, 1.0, 1.0 ); // Increase Red, Green and Blue colors seperately in Interiors
  725. float3 snsatd = float3( 0.0, 0.0, 0.0 ); // Subtracts Red, Green and Blue colors seperately during Days
  726. float3 snsatn = float3( 0.0, 0.0, 0.0 ); // Subtracts Red, Green and Blue colors seperately during Nights
  727. float3 snsati = float3( 0.0, 0.0, 0.0 ); // Subtracts Red, Green and Blue colors seperately in Interiors
  728.  
  729. // DAY
  730. float hd6MAGENTADay = 1.0; // Adds specified amount of magenta color
  731. float hd6MAGENTAsubDay = 0.0; // Subtracts specified amount of magenta color
  732. float hd6CYANDay = 1.0; // Adds specified amount of cyan color
  733. float hd6CYANsubDay = 0.0; // Subtracts specified amount of cyan color
  734. float hd6YELLOWDay = 1.0; // Adds specified amount of yellow color
  735. float hd6YELLOWsubDay = 0.0; // Subtracts specified amount of yellow color
  736. // NIGHT
  737. float hd6MAGENTANight = 1.0; // Adds specified amount of magenta color
  738. float hd6MAGENTAsubNight = 0.0; // Subtracts specified amount of magenta color
  739. float hd6CYANNight = 1.0; // Adds specified amount of cyan color
  740. float hd6CYANsubNight = 0.0; // Subtracts specified amount of cyan color
  741. float hd6YELLOWNight = 1.0; // Adds specified amount of yellow color
  742. float hd6YELLOWsubNight = 0.0; // Subtracts specified amount of yellow color
  743. // INTERIOR
  744. float hd6MAGENTAInterior = 1.0; // Adds specified amount of magenta color
  745. float hd6MAGENTAsubInterior = 0.0; // Subtracts specified amount of magenta color
  746. float hd6CYANInterior = 1.0; // Adds specified amount of cyan color
  747. float hd6CYANsubInterior = 0.0; // Subtracts specified amount of cyan color
  748. float hd6YELLOWInterior = 1.0; // Adds specified amount of yellow color
  749. float hd6YELLOWsubInterior = 0.0; // Subtracts specified amount of yellow color
  750. //--------------------------------------------------------------------------------------------------------------------------
  751. #endif
  752. ///////////////////////
  753. ///COLOR POLARIZATION//
  754. ///////////////////////
  755. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  756. //Color Polarization Settings.
  757. /////////////////////////////////Red Green Blue
  758. float3 GuideHueDay = float3(1.0, 0.2, 0.0); //Colors close this this color will be shifted towards it, colors opposite will be saturated
  759. float AmountDay = 1.0; //Controls strength of the effect, higher is stronger
  760. float ConcentrateDay = 4.0; //Controls how much colors will "bunch up" towards the guide color, higher is stronger
  761. float DesatCorrDay = 0.2; //Controls how much it will affect dull colors, higher will affect them less
  762. /////////////////////////////////Red Green Blue
  763. float3 GuideHueNight = float3(1.0, 0.2, 0.0);
  764. float AmountNight = 1.0;
  765. float ConcentrateNight= 4.0;
  766. float DesatCorrNight = 0.2;
  767. /////////////////////////////////Red Green Blue
  768. float3 GuideHueInt = float3(1.0, 0.2, 0.0);
  769. float AmountInt = 1.0;
  770. float ConcentrateInt = 4.0;
  771. float DesatCorrInt = 0.2;
  772. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  773. /////////////////////
  774. ///COLOR GRADING/////
  775. /////////////////////
  776. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  777. //Color Grading settings.
  778. float3 RedVectorDay = float3(1.0, 0.2, 0.0); //Red colors will be shifted towards this color instead
  779. float3 GreenVectorDay = float3(0.2, 1.0, 0.0); //Blue colors will be shifted towards this color instead
  780. float3 BlueVectorDay = float3(0.0, 0.2, 1.0); //Green colors will be shifted towards this color instead
  781.  
  782. float3 RedVectorNight = float3(1.0, 0.2, 0.0);
  783. float3 GreenVectorNight = float3(0.2, 1.0, 0.0);
  784. float3 BlueVectorNight = float3(0.0, 0.2, 1.0);
  785.  
  786. float3 RedVectorInt = float3(1.0, 0.2, 0.0);
  787. float3 GreenVectorInt = float3(0.0, 1.0, 0.2);
  788. float3 BlueVectorInt = float3(0.0, 0.2, 1.0);
  789. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  790. /////////////////////
  791. ///BLEACH BYPASS/////
  792. /////////////////////
  793. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  794. //Bleach Bypass Day Settings/////////////////Red Green Blue
  795. float3 BleachBypassAmountRGBDay = float3(0.4, 0.4, 0.4); //Controls strength of the effect separately for RGB, higher is stronger
  796. //Bleach Bypass Night Settings///////////////Red Green Blue
  797. float3 BleachBypassAmountRGBNight = float3(0.4, 0.4, 0.4);
  798. //Bleach Bypass Interior Settings////////////Red Green Blue
  799. float3 BleachBypassAmountRGBInt = float3(0.4, 0.4, 0.4);
  800. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  801. /////////////////////
  802. ///SEPIA TONE////////
  803. /////////////////////
  804. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  805. // Sepia Tone settings Day.
  806. float3 fSepiaColorDay = float3( 1.0, 0.85 , 0.7 );// Controls color of sepia tone.
  807. float fSepiaDesaturationDay = 0.5; // Controls amount of sepia color applied to image.
  808. float fSepiaExposureDay = 1.2; // Controls exposure of sepia tone.
  809.  
  810. // Sepia Tone settings Night.
  811. float3 fSepiaColorNight = float3( 1.0, 0.85 , 0.7 );// Controls color of sepia tone.
  812. float fSepiaDesaturationNight = 0.5; // Controls amount of sepia color applied to image.
  813. float fSepiaExposureNight = 1.2; // Controls exposure of sepia tone.
  814.  
  815. // Sepia Tone settings Interior.
  816. float3 fSepiaColorInterior = float3( 1.0, 0.85 , 0.7 );// Controls color of sepia tone.
  817. float fSepiaDesaturationInterior= 0.5; // Controls amount of sepia color applied to image.
  818. float fSepiaExposureInterior = 1.2; // Controls exposure of sepia tone.
  819. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  820. //////////////////////
  821. ///ADAPTATION/////////
  822. //////////////////////
  823. //-----------------------------------------------------------------------------------------------------------
  824. // Vanilla Adaptation Day settings.
  825.  
  826. float fVanillaAdaptationAmbientDay = 0.9; // Controls how much ambient luminosity there is from vanilla adaptation code.
  827. float fVanillaAdaptationChangeDay = 0.5; // Controls how much the brightness changes when looking up and down. Affects ambient too.
  828.  
  829. // Vanilla Adaptation Night settings.
  830. float fVanillaAdaptationAmbientNight = 1.1;
  831. float fVanillaAdaptationChangeNight = 0.4;
  832.  
  833. // Vanilla Adaptation Interior settings.
  834. float fVanillaAdaptationAmbientInterior = 1.0;
  835. float fVanillaAdaptationChangeInterior = 0.5;
  836. //-----------------------------------------------------------------------------------------------------------
  837. /////////////////////
  838. ///PALETTE MIXER/////
  839. /////////////////////
  840. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  841. // Palette mixer settings - Must have "UsePaletteTexture" enabled in the enbseries.ini file for these settings have an effect.
  842. float palmixDay =1.0; // Controls the intensity of the enbpalette.bmp
  843. float palmixNight =1.0; // Controls the intensity of the enbpalette.bmp
  844. float palmixInterior =1.0; // Controls the intensity of the enbpalette.bmp
  845. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  846. /////////////////////////
  847. ////LENSDIRT PALETTE/////
  848. /////////////////////////
  849. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  850. // Lensdirt settings - Must have "UsePaletteTexture" enabled in the enbseries.ini file for these settings have an effect.
  851. // Never use colorcorrection enbpalette and lens enbpalette at the same time!!
  852. float LensDirtThreshold = 0.12;
  853. float LensDirtPower = 10.5;
  854. /////////////////////
  855. ///HD6 VIGNETTE//////
  856. /////////////////////
  857. //--------------------------------------------------------------------------------------------------------------------------
  858. // HD6_VIGNETTE - Darkens and blurs edges of the screen which increases focus on center
  859. float rovigpwr = 0.4; // For Round vignette
  860. float2 sqvigpwr = float2( 1.10, 1.0 ); // For square vignette: (top, bottom)
  861. float vsatstrength = 0.4; // How saturated vignette is
  862. float vignettepow = 3.0; // For Round vignette, higher pushes it to the corners and increases contrast/sharpness
  863. float vstrengthatnight = 0.5; // How strong vignette is at night
  864. float vstrengthinterior= 0.55;
  865. //--------------------------------------------------------------------------------------------------------------------------
  866. /////////////////////
  867. ///MT_VIGNETTE///////
  868. /////////////////////
  869. #if(MT_VIGNETTE == 1)
  870. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  871. // Vignette settings Day.
  872. float fVignetteRadiusDay = 0.65; // Controls how large the radius of the vignette is. Larger numbers make the ring larger.
  873. float fVignetteSharpnessDay = 0.025; // Controls how sharp the edge of the vignette is. Larger numbers make edge of the ring sharper.
  874. float fVignetteCurveDay = 2.0; // Controls the blending of the vignette.
  875. float2 fVignetteCenterDay = float2( 0.5, 0.5 ); // Controls the position of the vignette center on the screen.
  876. float2 fVignetteScaleDay = float2( 1.0, 1.0 ); // Controls the horizontal and vertical scaling of vignette.
  877.  
  878. // Vignette settings Night.
  879. float fVignetteRadiusNight = 0.65; // Controls how large the radius of the vignette is. Larger numbers make the ring larger.
  880. float fVignetteSharpnessNight = 0.025; // Controls how sharp the edge of the vignette is. Larger numbers make edge of the ring sharper.
  881. float fVignetteCurveNight = 2.0; // Controls the blending of the vignette.
  882. float2 fVignetteCenterNight = float2( 0.5, 0.5 ); // Controls the position of the vignette center on the screen.
  883. float2 fVignetteScaleNight = float2( 1.0, 1.0 ); // Controls the horizontal and vertical scaling of vignette.
  884.  
  885. // Vignette settings Interior.
  886. float fVignetteRadiusInterior = 0.65; // Controls how large the radius of the vignette is. Larger numbers make the ring larger.
  887. float fVignetteSharpnessInterior= 0.025; // Controls how sharp the edge of the vignette is. Larger numbers make edge of the ring sharper.
  888. float fVignetteCurveInterior = 2.0; // Controls the blending of the vignette.
  889. float2 fVignetteCenterInterior = float2( 0.5, 0.5 ); // Controls the position of the vignette center on the screen.
  890. float2 fVignetteScaleInterior = float2( 1.0, 1.0 ); // Controls the horizontal and vertical scaling of vignette.
  891. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  892. #endif
  893. /////////////////////
  894. ///FILM GRAIN////////
  895. /////////////////////
  896. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  897. // Grain settings Day.
  898. float fGrainIntensityDay = 0.08; // Controls the intensity of the grain effect.
  899. float fGrainSaturationDay = 0.25; // Controls the color saturation of the grain effect.
  900. float fGrainMotionDay = 0.05; // Controls how rapidly the grain effect changes over time.
  901.  
  902. // Grain settings Night.
  903. float fGrainIntensityNight = 0.1; // Controls the intensity of the grain effect.
  904. float fGrainSaturationNight = 0.25; // Controls the color saturation of the grain effect.
  905. float fGrainMotionNight = 0.05; // Controls how rapidly the grain effect changes over time.
  906.  
  907. // Grain settings Interior.
  908. float fGrainIntensityInterior = 0.1; // Controls the intensity of the grain effect.
  909. float fGrainSaturationInterior = 0.25; // Controls the color saturation of the grain effect.
  910. float fGrainMotionInterior = 0.05; // Controls how rapidly the grain effect changes over time.
  911.  
  912. ////////////////////////
  913. ///IMAGE SHARPEN////////
  914. ////////////////////////
  915. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  916. float fSharpScaleDay = 0.6932;
  917. float fSharpScaleNight = 0.4932;
  918. float fSharpScaleInterior = 0.4932;
  919. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  920.  
  921. /////////////////////
  922. ///LETTERBOX/////////
  923. /////////////////////
  924. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  925. // Letterbox settings.
  926. float fLetterboxBarHeightDay = 0.05; // Controls the height of cinematic bars.
  927. float fLetterboxBarHeightNight = 0.05; // Controls the height of cinematic bars.
  928. float fLetterboxBarHeightInterior = 0.05; // Controls the height of cinematic bars.
  929. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  930.  
  931. /////////////////////////////////////////////////////////////////////////////////////////////////
  932. ///POSTPROCESSING METHODS////////////////////////////////////////////////////////////////////////
  933. /////////////////////////////////////////////////////////////////////////////////////////////////
  934.  
  935. /////////////////////
  936. ///POSTPROCESSING 0//
  937. /////////////////////
  938. #if POSTPROCESS == 0
  939. //POSTPROCESS v0 by JawZ The vanilla Post-Process method - The perfect method for ENB Beginners.
  940.  
  941. // JZ - This enables the EToneMappingCurveV0 setting to be usable. Enable it by changing the 0 to a 1.
  942. #define ENABLE_TONEMAPPING 1
  943.  
  944. //DAY
  945. float EBrightnessV0Day = 1.0; // JZ - Use this to alter the general brightness of the whole screen.
  946. float EContrastV0Day = 1.0; // JZ - Higher amounts make the dark areas darker while making the bright spot brighter.
  947. float EColorSaturationV0Day = 1.2; // JZ - Adds more color to the screen.
  948. float EToneMappingCurveV0Day = 1.0; // JZ - Increasing this darkens the image, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  949.  
  950. //NIGHT
  951. float EBrightnessV0Night = 1.0;
  952. float EContrastV0Night = 1.0;
  953. float EColorSaturationV0Night = 1.2;
  954. float EToneMappingCurveV0Night = 1.0;
  955.  
  956. //Interior
  957. float EBrightnessV0Interior = 1.0;
  958. float EContrastV0Interior = 1.0;
  959. float EColorSaturationV0Interior = 1.0;
  960. float EToneMappingCurveV0Interior = 1.0;
  961. #endif
  962. /////////////////////
  963. ///POSTPROCESSING 1//
  964. /////////////////////
  965. //POSTPROCESS v1 by ENB
  966. #if POSTPROCESS == 1
  967. //DAY
  968. float EAdaptationMinV1Day = 0.01;
  969. float EAdaptationMaxV1Day = 0.07;
  970.  
  971. float EContrastV1Day = 0.95;
  972. float EColorSaturationV1Day = 1.2;
  973. float EToneMappingCurveV1Day = 6.0;
  974.  
  975. //NIGHT
  976. float EAdaptationMinV1Night = 0.01;
  977. float EAdaptationMaxV1Night = 0.15;
  978.  
  979. float EContrastV1Night = 0.95;
  980. float EColorSaturationV1Night = 1.0;
  981. float EToneMappingCurveV1Night = 6.0;
  982.  
  983. //Interior
  984. float EAdaptationMinV1Interior = 0.01;
  985. float EAdaptationMaxV1Interior = 0.15;
  986.  
  987. float EContrastV1Interior = 0.95;
  988. float EColorSaturationV1Interior = 1.0;
  989. float EToneMappingCurveV1Interior = 6.0;
  990. #endif
  991. /////////////////////
  992. ///POSTPROCESSING 2//
  993. /////////////////////
  994. #if POSTPROCESS == 2
  995. //POSTPROCESS v2 by ENB, modified by JawZ
  996. //DAY
  997. float EAdaptationMinV2Day = 1.0; // JZ - Determines the lowest amount the Adaptation will adjust the brightness.
  998. float EAdaptationMaxV2Day = 1.0; // JZ - Determines the highest amount the Adaptation will adjust the brightness.
  999.  
  1000. float EBrightnessV2Day = 1.0; // JZ - Use this to alter the general brightness of the whole screen.
  1001. float EBrightnessCurveV2Day = 1.0; // JZ - A sort of contrast that only darkens the image and increases the saturation.
  1002. float EBrightnessPostCurveV2Day = 1.0; // JZ - Brightness addition applied after the EBrightnessCurve setting. If EBrightnessCurve is set to 1.0 it will act the same as EBrightness.
  1003.  
  1004. float EIntensityContrastV2Day = 1.0; // JZ - Higher amounts make the dark areas darker while making the bright spot brighter.
  1005. float EColorSaturationV2Day = 1.0; // JZ - Adds more color to the screen.
  1006. float EToneMappingCurveV2Day = 1.0; // JZ - Increasing this darkens the image, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  1007. float EToneMappingOversaturationV2Day = 1.0; // JZ - Same thing as EToneMappingCurve but more subtle and desaturates the screen.
  1008. //NIGHT
  1009. float EAdaptationMinV2Night = 1.0;
  1010. float EAdaptationMaxV2Night = 1.0;
  1011.  
  1012. float EBrightnessV2Night = 1.0;
  1013. float EBrightnessCurveV2Night = 1.0;
  1014. float EBrightnessPostCurveV2Night = 1.0;
  1015.  
  1016. float EIntensityContrastV2Night = 1.0;
  1017. float EColorSaturationV2Night = 1.0;
  1018. float EToneMappingCurveV2Night = 1.0;
  1019. float EToneMappingOversaturationV2Night = 1.0;
  1020. //Interior
  1021. float EAdaptationMinV2Interior = 1.0;
  1022. float EAdaptationMaxV2Interior = 1.0;
  1023.  
  1024. float EBrightnessV2Interior = 1.0;
  1025. float EBrightnessCurveV2Interior = 1.0;
  1026. float EBrightnessPostCurveV2Interior = 1.0;
  1027.  
  1028. float EIntensityContrastV2Interior = 1.0;
  1029. float EColorSaturationV2Interior = 1.0;
  1030. float EToneMappingCurveV2Interior = 1.0;
  1031. float EToneMappingOversaturationV2Interior = 1.0;
  1032. #endif
  1033. /////////////////////
  1034. ///POSTPROCESSING 3//
  1035. /////////////////////
  1036. //POSTPROCESS v3 by ENB
  1037. #if POSTPROCESS == 3
  1038. //DAY
  1039. float EAdaptationMinV3Day = 0.05;
  1040. float EAdaptationMaxV3Day = 0.125;
  1041.  
  1042. float EToneMappingCurveV3Day = 8.0;
  1043. float EToneMappingOversaturationV3Day = 60.0;
  1044.  
  1045. //NIGHT
  1046. float EAdaptationMinV3Night = 0.05;
  1047. float EAdaptationMaxV3Night = 0.125;
  1048.  
  1049. float EToneMappingCurveV3Night = 4.0;
  1050. float EToneMappingOversaturationV3Night = 60.0;
  1051.  
  1052. //Interior
  1053. float EAdaptationMinV3Interior = 0.05;
  1054. float EAdaptationMaxV3Interior = 0.125;
  1055.  
  1056. float EToneMappingCurveV3Interior = 4.0;
  1057. float EToneMappingOversaturationV3Interior = 60.0;
  1058. #endif
  1059. /////////////////////
  1060. ///POSTPROCESSING 4//
  1061. /////////////////////
  1062. //POSTPROCESS v4 by ENB
  1063. #if POSTPROCESS == 4
  1064. //DAY
  1065. float EAdaptationMinV4Day = 0.2;
  1066. float EAdaptationMaxV4Day = 0.125;
  1067.  
  1068. float EBrightnessCurveV4Day = 0.7;
  1069. float EBrightnessMultiplierV4Day = 0.45;
  1070. float EBrightnessToneMappingCurveV4Day = 0.5;
  1071.  
  1072. //NIGHT
  1073. float EAdaptationMinV4Night = 0.2;
  1074. float EAdaptationMaxV4Night = 0.125;
  1075.  
  1076. float EBrightnessCurveV4Night = 0.7;
  1077. float EBrightnessMultiplierV4Night = 0.45;
  1078. float EBrightnessToneMappingCurveV4Night = 0.5;
  1079.  
  1080. //Interior
  1081. float EAdaptationMinV4Interior = 0.2;
  1082. float EAdaptationMaxV4Interior = 0.125;
  1083.  
  1084. float EBrightnessCurveV4Interior = 0.7;
  1085. float EBrightnessMultiplierV4Interior = 0.45;
  1086. float EBrightnessToneMappingCurveV4Interior = 0.5;
  1087. #endif
  1088. /////////////////////
  1089. ///POSTPROCESSING 5//
  1090. /////////////////////
  1091. //POSTPROCESS v5 by HD6 based on Post-process v2
  1092. #if POSTPROCESS == 5
  1093.  
  1094. // HD6 static adaptation, Day, Night, Interior
  1095. float3 JKNightDayFactortweak = float3( 3.1 , 1.5, 3.1 );
  1096.  
  1097. //DAY
  1098. float EAdaptationMinV5Day = 0.12;
  1099. float EAdaptationMaxV5Day = 0.29;
  1100.  
  1101. float EToneMappingCurveV5Day = 1.0;
  1102. float EIntensityContrastV5Day = 1.0;
  1103. float EColorSaturationV5Day = 1.0;
  1104. float HCompensateSatV5Day = 1.0;
  1105.  
  1106. //NIGHT
  1107. float EAdaptationMinV5Night = 0.12;
  1108. float EAdaptationMaxV5Night = 0.29;
  1109.  
  1110. float EToneMappingCurveV5Night = 1.0;
  1111. float EIntensityContrastV5Night = 1.0;
  1112. float EColorSaturationV5Night = 1.0;
  1113. float HCompensateSatV5Night = 1.0;
  1114.  
  1115. //Interior
  1116. float EAdaptationMinV5Interior = 0.12;
  1117. float EAdaptationMaxV5Interior = 0.29;
  1118.  
  1119. float EToneMappingCurveV5Interior = 1.0;
  1120. float EIntensityContrastV5Interior = 1.0;
  1121. float EColorSaturationV5Interior = 1.0;
  1122. float HCompensateSatV5Interior = 1.0;
  1123. #endif
  1124. /////////////////////
  1125. ///POSTPROCESSING 6//
  1126. /////////////////////
  1127. //Postprocessing V6 by Kermles
  1128. #if POSTPROCESS == 6
  1129. #define PRE_COLORATION 0 //Color controls happen before adaptation
  1130. #define POST_COLORATION 1 //Color controls happen after adaptation
  1131. #define SHADOW_USE_ADDITION 1 //May cause slight brightening of image, but also retains more detail in shadows
  1132. #define BRIGHTSPOT_IGNORE_WHITES 1 //Brightspot controls won't affect pure white areas.
  1133. //DAY
  1134. float EBrightnessV6Day = 0.65; //Higher values brighten the image.
  1135. float EIntensityContrastV6Day = 1.1; //Higher values accentuate differences between light and dark areas.
  1136. float EColorSaturationV6Day = 2.0; //Higher values make the image more colorful.
  1137.  
  1138. float EToneMappingOversaturationV6Day = 1.15; //Lower values brighten the image and help increase dynamic range.
  1139. float EToneMappingCurveV6Day = 1.3; //JZ - Increasing this darkens the image, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  1140.  
  1141. float EAdaptationMinV6Day = 1.0; //Higher values increase the minimum darkening from adaptation.
  1142. float EAdaptationMaxV6Day = 0.5; //Higher values increase the strength of adaptation darkening.
  1143.  
  1144. float EFinalContrastV6Day = 0.45; //Higher values accentuate differences between light and dark areas.
  1145. float EFinalExposureV6Day = 0.05; //Higher values brighten the image.
  1146. /////////////////////////////////////////////////////////Red Green Blue
  1147. float3 EMoodColorDay = float3( 0.1, 0.125, 0.5 );//Determines the general coloration of the scene.
  1148. float EMoodAmountDay = 0.8; //Higher values increase effect strength.
  1149. float EMoodThresholdDay = 1.1; //Lower values increase the spread of the effect.
  1150. float EMoodCurveDay = 3.0; //Lower values increase the spread of the effect.
  1151. //////////////////////////////////////////////////////////Red Green Blue
  1152. float3 EShadowColorDay = float3( 0.0, 0.125, 1.0 );//Determines the color of shadows.
  1153. float EShadowAmountDay = 1.15; //Higher values increase effect strength. Max 2.55
  1154. float EShadowThresholdDay = 0.6; //Lower values increase the spread of the effect.
  1155. float EShadowCurveDay = 16.0; //Lower values increase the spread of the effect.
  1156. /////////////////////////////////////////////////////////Red Green Blue
  1157. float3 EBrightSpotColorDay = float3( 0.0, 0.0, 0.0 );//Determines the color of bright areas.
  1158. float EBrightSpotAmountDay = 0.0; //Higher values increase effect strength.
  1159. float EBrightSpotThresholdDay = 1.15; //Lower values increase the spread of the effect.
  1160. float EBrightSpotCurveDay = 35.75; //Lower values increase the spread of the effect.
  1161. ////////////////////////////////////////////////////////////////////////
  1162. //NIGHT
  1163. float EBrightnessV6Night = 1.0;
  1164. float EIntensityContrastV6Night = 1.0;
  1165. float EColorSaturationV6Night = 1.0;
  1166.  
  1167. float EToneMappingOversaturationV6Night = 1.0;
  1168. float EToneMappingCurveV6Night = 1.0;
  1169.  
  1170. float EAdaptationMinV6Night = 0.64;
  1171. float EAdaptationMaxV6Night = 0.32;
  1172.  
  1173. float EFinalContrastV6Night = 0.0;
  1174. float EFinalExposureV6Night = 0.0;
  1175. /////////////////////////////////////////////////////////Red Green Blue
  1176. float3 EMoodColorNight = float3( 0.0, 0.125, 1.0 );
  1177. float EMoodAmountNight = 0.0;
  1178. float EMoodThresholdNight = 1.0;
  1179. float EMoodCurveNight = 3.0;
  1180. /////////////////////////////////////////////////////////Red Green Blue
  1181. float3 EShadowColorNight = float3( 0.0, 0.125, 1.0 );
  1182. float EShadowAmountNight = 1.0;
  1183. float EShadowThresholdNight = 0.5;
  1184. float EShadowCurveNight = 16.0;
  1185. //////////////////////////////////////////////////////////Red Green Blue
  1186. float3 EBrightSpotColorNight = float3( 1.0, 0.125, 0.0 );
  1187. float EBrightSpotAmountNight = 0.0;
  1188. float EBrightSpotThresholdNight = 0.5;
  1189. float EBrightSpotCurveNight = 16.0;;
  1190. ///////////////////////////////////////////////////////////////////////////
  1191. //Interior
  1192. float EBrightnessV6Interior = 1.0;
  1193. float EIntensityContrastV6Interior = 1.0;
  1194. float EColorSaturationV6Interior = 1.0;
  1195.  
  1196. float EToneMappingOversaturationV6Interior= 1.0;
  1197. float EToneMappingCurveV6Interior = 1.0;
  1198.  
  1199. float EAdaptationMinV6Interior = 0.64;
  1200. float EAdaptationMaxV6Interior = 0.32;
  1201.  
  1202. float EFinalContrastV6Interior = 0.0;
  1203. float EFinalExposureV6Interior = 0.0;
  1204. /////////////////////////////////////////////////////////Red Green Blue
  1205. float3 EMoodColorInt = float3( 0.0, 0.125, 1.0 );
  1206. float EMoodAmountInt = 0.0;
  1207. float EMoodThresholdInt = 1.0;
  1208. float EMoodCurveInt = 3.0;
  1209. /////////////////////////////////////////////////////////Red Green Blue
  1210. float3 EShadowColorInt = float3( 0.0, 0.125, 1.0 );
  1211. float EShadowAmountInt = 0.0;
  1212. float EShadowThresholdInt = 0.5;
  1213. float EShadowCurveInt = 16.0;
  1214. //////////////////////////////////////////////////////////Red Green Blue
  1215. float3 EBrightSpotColorInt = float3( 1.0, 0.125, 0.0 );
  1216. float EBrightSpotAmountInt = 0.0;
  1217. float EBrightSpotThresholdInt = 0.5;
  1218. float EBrightSpotCurveInt = 16.0;
  1219. ///////////////////////////////////////////////////////////////////////////
  1220. #endif
  1221. /////////////////////
  1222. ///POSTPROCESSING 7//
  1223. /////////////////////
  1224. //Postprocessing V7 by Kermles
  1225. #if POSTPROCESS == 7
  1226. #define PRE_COLORATION 0 //Color controls happen before adaptation
  1227. #define POST_COLORATION 0 //Color controls happen after adaptation
  1228. #define SHADOW_USE_ADDITION 0 //May cause slight brightening of image, but also retains more detail in shadows
  1229. #define BRIGHTSPOT_IGNORE_WHITES 0 //Brightspot controls won't affect pure white areas.
  1230. #define COLOR_ADAPTATION 1 //Desaturates image based on adaptation strength
  1231. //DAY
  1232. //Color
  1233. float EHSVDesatCurveDay = 1.0; //Higher values desaturate the image according to original saturation.
  1234. float EBrightnessV7Day = 1.0; //Higher values brighten the image.
  1235. float EIntensityContrastV7Day = 1.0; //Higher values accentuate differences between light and dark areas.
  1236. float EColorSaturationV7Day = 1.0; //Higher values make the image more colorful.
  1237. //Tonemapping
  1238. float EToneMappingOversaturationV7Day = 1.0; //Lower values brighten the image and help increase dynamic range.
  1239. float EToneMappingCurveV7Day = 1.0; //JZ - Increasing this darkens the image, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  1240. //Adaptation
  1241. float EAdaptationMinV7Day = 0.64; //Higher values increase the minimum darkening from adaptation.
  1242. float EAdaptationMaxV7Day = 0.32; //Higher values increase the strength of adaptation darkening.
  1243. float EColorAdaptationStrengthV7Day = 1.0; //Higher values increase the image desaturation based on adaptation.
  1244. //Final adjustments.
  1245. float EFinalContrastV7Day = 0.0; //Higher values accentuate differences between light and dark areas.
  1246. float EFinalExposureV7Day = 0.0; //Higher values brighten the image.
  1247. /////////////////////////////////////////////////////////Red Green Blue
  1248. float3 EMoodColorDay = float3( 0.0, 0.125, 1.0 );//Determines the general coloration of the scene.
  1249. float EMoodAmountDay = 0.5; //Higher values increase effect strength.
  1250. float EMoodThresholdDay = 1.0; //Lower values increase the spread of the effect.
  1251. float EMoodCurveDay = 3.0; //Lower values increase the spread of the effect.
  1252. //////////////////////////////////////////////////////////Red Green Blue
  1253. float3 EShadowColorDay = float3( 0.0, 0.125, 1.0 );//Determines the color of shadows. Max 2.55
  1254. float EShadowAmountDay = 0.0; //Higher values increase effect strength.
  1255. float EShadowThresholdDay = 1.0; //Lower values increase the spread of the effect.
  1256. float EShadowCurveDay = 16.0; //Lower values increase the spread of the effect.
  1257. /////////////////////////////////////////////////////////Red Green Blue
  1258. float3 EBrightSpotColorDay = float3( 1.0, 0.125, 0.0 );//Determines the color of bright areas.
  1259. float EBrightSpotAmountDay = 0.0; //Higher values increase effect strength.
  1260. float EBrightSpotThresholdDay = 0.5; //Lower values increase the spread of the effect.
  1261. float EBrightSpotCurveDay = 16.0; //Lower values increase the spread of the effect.
  1262. ////////////////////////////////////////////////////////////////////////
  1263. //NIGHT
  1264. float EHSVDesatCurveNight = 1.0;
  1265.  
  1266. float EBrightnessV7Night = 1.0;
  1267. float EIntensityContrastV7Night = 1.0;
  1268. float EColorSaturationV7Night = 1.0;
  1269.  
  1270. float EToneMappingOversaturationV7Night = 1.0;
  1271. float EToneMappingCurveV7Night = 1.0;
  1272.  
  1273. float EAdaptationMinV7Night = 0.64;
  1274. float EAdaptationMaxV7Night = 0.32;
  1275. float EColorAdaptationStrengthV7Night = 1.0;
  1276.  
  1277. float EFinalContrastV7Night = 0.0;
  1278. float EFinalExposureV7Night = 0.0;
  1279. /////////////////////////////////////////////////////////Red Green Blue
  1280. float3 EMoodColorNight = float3( 0.0, 0.125, 1.0 );
  1281. float EMoodAmountNight = 0.0;
  1282. float EMoodThresholdNight = 1.0;
  1283. float EMoodCurveNight = 4.0;
  1284. /////////////////////////////////////////////////////////Red Green Blue
  1285. float3 EShadowColorNight = float3( 0.0, 0.125, 1.0 );
  1286. float EShadowAmountNight = 0.0;
  1287. float EShadowThresholdNight = 0.5;
  1288. float EShadowCurveNight = 12.0;
  1289. //////////////////////////////////////////////////////////Red Green Blue
  1290. float3 EBrightSpotColorNight = float3( 1.0, 0.125, 0.0 );
  1291. float EBrightSpotAmountNight = 0.5;
  1292. float EBrightSpotThresholdNight = 0.5;
  1293. float EBrightSpotCurveNight = 12.0;
  1294. ///////////////////////////////////////////////////////////////////////////
  1295. //Interior
  1296. float EHSVDesatCurveInt = 1.0;
  1297.  
  1298. float EBrightnessV7Interior = 1.0;
  1299. float EIntensityContrastV7Interior = 1.0;
  1300. float EColorSaturationV7Interior = 1.0;
  1301.  
  1302. float EToneMappingOversaturationV7Interior= 1.0;
  1303. float EToneMappingCurveV7Interior = 1.0;
  1304.  
  1305. float EAdaptationMinV7Interior = 0.64;
  1306. float EAdaptationMaxV7Interior = 0.32;
  1307. float EColorAdaptationStrengthV7Interior = 1.0;
  1308.  
  1309. float EFinalContrastV7Interior = 0.0;
  1310. float EFinalExposureV7Interior = 0.0;
  1311. /////////////////////////////////////////////////////////Red Green Blue
  1312. float3 EMoodColorInt = float3( 0.0, 0.125, 1.0 );
  1313. float EMoodAmountInt = 0.0;
  1314. float EMoodThresholdInt = 1.0;
  1315. float EMoodCurveInt = 3.0;
  1316. /////////////////////////////////////////////////////////Red Green Blue
  1317. float3 EShadowColorInt = float3( 0.0, 0.125, 1.0 );
  1318. float EShadowAmountInt = 0.0;
  1319. float EShadowThresholdInt = 0.5;
  1320. float EShadowCurveInt = 16.0;
  1321. //////////////////////////////////////////////////////////Red Green Blue
  1322. float3 EBrightSpotColorInt = float3( 1.0, 0.125, 0.0 );
  1323. float EBrightSpotAmountInt = 0.0;
  1324. float EBrightSpotThresholdInt = 0.5;
  1325. float EBrightSpotCurveInt = 16.0;
  1326. ///////////////////////////////////////////////////////////////////////////
  1327. #endif
  1328. /////////////////////
  1329. ///POSTPROCESSING 8//
  1330. /////////////////////
  1331. #if POSTPROCESS == 8 //Improved Tonemapping by Brodiggan Gale modified by Kermles
  1332.  
  1333. #define PRE_COLORATION 0 //Color controls happen before adaptation
  1334. #define POST_COLORATION 0 //Color controls happen after adaptation
  1335. #define SHADOW_USE_ADDITION 0 //May cause slight brightening of image, but also retains more detail in shadows
  1336. #define BRIGHTSPOT_IGNORE_WHITES 0 //Brightspot controls won't affect pure white areas.
  1337. //Day
  1338. float EMinSaturationPowerDay = 0.7; //Higher values raise the minimum color strength of the scene.
  1339. float EMaxSaturationPowerDay = 1.4; //Higher values raise the maximum color strength of the scene.
  1340. float EBrightCurveDay = 1.0; //Higher values brighten the image.
  1341. float EContrastCurveDay = 1.0; //Higher values accentuate differences between light and dark areas.
  1342. float EContrastThresholdDay = 0.9; //Determines the brightness threshold used for contrast adjustments. Max 1.0
  1343.  
  1344. float EToneMappingOversaturationV8Day = 1.0; //Lower values brighten the image and help increase dynamic range.
  1345. float EToneMappingCurveV8Day = 1.0; //JZ - Increasing this darkens the image, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  1346.  
  1347. float EAdaptationMinV8Day = 0.64; //Higher values increase the minimum darkening from adaptation.
  1348. float EAdaptationMaxV8Day = 0.32; //Higher values increase the strength of adaptation darkening.
  1349.  
  1350. float EFinalContrastV8Day = 0.0; //Higher values accentuate differences between light and dark areas.
  1351. float EFinalExposureV8Day = 0.0; //Higher values brighten the image.
  1352. /////////////////////////////////////////////////////////Red Green Blue
  1353. float3 EMoodColorDay = float3( 1.0, 0.125, 0.0 );//Determines the general coloration of the scene.
  1354. float EMoodAmountDay = 0.0; //Higher values increase effect strength.
  1355. float EMoodThresholdDay = 1.0; //Lower values increase the spread of the effect.
  1356. float EMoodCurveDay = 3.0; //Lower values increase the spread of the effect.
  1357. //////////////////////////////////////////////////////////Red Green Blue
  1358. float3 EShadowColorDay = float3( 0.0, 0.125, 1.0 );//Determines the color of shadows.
  1359. float EShadowAmountDay = 0.0; //Higher values increase effect strength.
  1360. float EShadowThresholdDay = 0.5; //Lower values increase the spread of the effect.
  1361. float EShadowCurveDay = 16.0; //Lower values increase the spread of the effect.
  1362. /////////////////////////////////////////////////////////Red Green Blue
  1363. float3 EBrightSpotColorDay = float3( 1.0, 0.125, 0.0 );//Determines the color of bright areas.
  1364. float EBrightSpotAmountDay = 0.0; //Higher values increase effect strength.
  1365. float EBrightSpotThresholdDay = 0.5; //Lower values increase the spread of the effect.
  1366. float EBrightSpotCurveDay = 16.0; //Lower values increase the spread of the effect.
  1367. ////////////////////////////////////////////////////////////////////////
  1368. //Night
  1369. float EMinSaturationPowerNight = 0.7;
  1370. float EMaxSaturationPowerNight = 1.0;
  1371. float EBrightCurveNight = 0.9;
  1372. float EContrastCurveNight = 1.1;
  1373. float EContrastThresholdNight = 0.1;
  1374.  
  1375. float EToneMappingOversaturationV8Night = 1.0;
  1376. float EToneMappingCurveV8Night = 1.0;
  1377.  
  1378. float EAdaptationMinV8Night = 0.64;
  1379. float EAdaptationMaxV8Night = 0.32;
  1380.  
  1381. float EFinalContrastV8Night = 0.0;
  1382. float EFinalExposureV8Night = 0.0;
  1383. /////////////////////////////////////////////////////////Red Green Blue
  1384. float3 EMoodColorNight = float3( 0.0, 0.125, 1.0 );
  1385. float EMoodAmountNight = 0.0;
  1386. float EMoodThresholdNight = 1.0;
  1387. float EMoodCurveNight = 3.0;
  1388. /////////////////////////////////////////////////////////Red Green Blue
  1389. float3 EShadowColorNight = float3( 0.0, 0.125, 1.0 );
  1390. float EShadowAmountNight = 0.0;
  1391. float EShadowThresholdNight = 0.5;
  1392. float EShadowCurveNight = 16.0;
  1393. //////////////////////////////////////////////////////////Red Green Blue
  1394. float3 EBrightSpotColorNight = float3( 1.0, 0.125, 0.0 );
  1395. float EBrightSpotAmountNight = 0.0;
  1396. float EBrightSpotThresholdNight = 0.5;
  1397. float EBrightSpotCurveNight = 16.0;
  1398. ///////////////////////////////////////////////////////////////////////////
  1399. //Interior
  1400. float EMinSaturationPowerInt = 0.7;
  1401. float EMaxSaturationPowerInt = 1.4;
  1402. float EBrightCurveInt = 0.95;
  1403. float EContrastCurveInt = 1.1;
  1404. float EContrastThresholdInt = 0.9;
  1405.  
  1406. float EToneMappingOversaturationV8Interior= 1.0;
  1407. float EToneMappingCurveV8Interior = 1.0;
  1408.  
  1409. float EAdaptationMinV8Interior = 0.64;
  1410. float EAdaptationMaxV8Interior = 0.32;
  1411.  
  1412. float EFinalContrastV8Interior = 0.0;
  1413. float EFinalExposureV8Interior = 0.0;
  1414. /////////////////////////////////////////////////////////Red Green Blue
  1415. float3 EMoodColorInt = float3(0.0, 0.125, 1.0);
  1416. float EMoodAmountInt = 0.0;
  1417. float EMoodThresholdInt = 1.0;
  1418. float EMoodCurveInt = 3.0;
  1419. /////////////////////////////////////////////////////////Red Green Blue
  1420. float3 EShadowColorInt = float3(0.0, 0.125, 1.0);
  1421. float EShadowAmountInt = 0.0;
  1422. float EShadowThresholdInt = 0.5;
  1423. float EShadowCurveInt = 16.0;
  1424. //////////////////////////////////////////////////////////Red Green Blue
  1425. float3 EBrightSpotColorInt = float3(1.0, 0.125, 0.0);
  1426. float EBrightSpotAmountInt = 0.0;
  1427. float EBrightSpotThresholdInt = 0.5;
  1428. float EBrightSpotCurveInt = 16.0;
  1429. ///////////////////////////////////////////////////////////////////////////
  1430. #endif
  1431.  
  1432. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1433. /////////////////////////////////////////////////////////////////////////////////////////////////
  1434. ///END OF USER CONTROLS, PROCEED AT YOUR OWN RISK////////////////////////////////////////////////
  1435. /////////////////////////////////////////////////////////////////////////////////////////////////
  1436. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1437.  
  1438.  
  1439.  
  1440.  
  1441.  
  1442. /// Thanks to Kermles for this huge enbeffect which is the base for this ME 2 enbeffect :)
  1443. /// Actually, 70-80% of the work is by Kermles here.
  1444.  
  1445.  
  1446.  
  1447. /////////////////////////////////////////////////////////////////////////////////////////////////
  1448. ///FUNCTIONS/CONSTANTS///////////////////////////////////////////////////////////////////////////
  1449. /////////////////////////////////////////////////////////////////////////////////////////////////
  1450.  
  1451.  
  1452.  
  1453. float3 RGBtoXYZ(in float3 rgb)
  1454. {
  1455. float3 rXYZV = float3(0.49, 0.31, 0.2);
  1456. float3 gXYZV = float3(0.17697, 0.8124, 0.01063);
  1457. float3 bXYZV = float3(0.0, 0.01, 0.99);
  1458. float3 XYZ = 0.17697 * (float3(dot(rgb, rXYZV), dot(rgb, gXYZV), dot(rgb, bXYZV)));
  1459. return XYZ;
  1460. }
  1461.  
  1462. float3 RGBtoLMSR(in float3 rgb)
  1463. {
  1464. float L = dot(rgb, float3(0.096869562190332, 0.318940374720484, -0.188428411786113));
  1465. float M = dot(rgb, float3(0.020208210904239, 0.291385283197581, -0.090918262127325));
  1466. float S = dot(rgb, float3(0.002760510899553, -0.008341563564118, 0.067213551661950));
  1467. float R = dot(rgb, float3(-0.007607045462440, 0.122492925567539, 0.022445835141881));
  1468. return float4(L,M,S,R);
  1469. }
  1470.  
  1471. float3 XYZtoLMS(in float3 xyz)
  1472. {
  1473. float3 xLMSV = float3(0.8951, 0.2664, -0.1614);
  1474. float3 yLMSV = float3(-0.7502, 1.7135, 0.0367);
  1475. float3 zLMSV = float3(0.0389, -0.0685, 1.0296);
  1476. float3 LMS = float3(dot(xyz, xLMSV), dot(xyz, yLMSV), dot(xyz, zLMSV));
  1477. return LMS;
  1478. }
  1479.  
  1480. float3 LMStoRGBYL(in float3 lms)
  1481. {
  1482. float RG = lms.y-lms.x;
  1483. float BY = lms.z-(lms.x+lms.y);
  1484. float L = lms.x+lms.y;
  1485. return float3(RG,BY,L);
  1486. }
  1487.  
  1488. #if(HSV_EQUALIZER == 1)
  1489. float fHueRed = 0.0;
  1490. float fHueOrange = 0.08333333;
  1491. float fHueYellow = 0.16666667;
  1492. float fHueGreen = 0.33333333;
  1493. float fHueCyan = 0.5;
  1494. float fHueBlue = 0.66666667;
  1495. float fHueMagenta = 0.83333333;
  1496. float fHueRed2 = 1.0;
  1497.  
  1498. float ColorEqualizerMult(in float H, in float JKNDF, in float JKIF)
  1499. {
  1500. float SMult = 1.0;
  1501. SMult += lerp(lerp(fColorSaturationMultRedDay * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) ), fColorSaturationMultRedNight * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) ), JKNDF),fColorSaturationMultRedInt * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) ), JKIF);
  1502. SMult += lerp(lerp(fColorSaturationMultOrangeDay * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) ), fColorSaturationMultOrangeNight * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) ), JKNDF), fColorSaturationMultOrangeInt * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) ), JKIF);
  1503. SMult += lerp(lerp(fColorSaturationMultYellowDay * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) ), fColorSaturationMultYellowNight * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) ), JKNDF), fColorSaturationMultYellowInt * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) ), JKIF);
  1504. SMult += lerp(lerp(fColorSaturationMultGreenDay * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) ), fColorSaturationMultGreenNight * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) ), JKNDF), fColorSaturationMultGreenInt * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) ), JKIF);
  1505. SMult += lerp(lerp(fColorSaturationMultCyanDay * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) ), fColorSaturationMultCyanNight * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) ), JKNDF), fColorSaturationMultCyanInt * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) ), JKIF);
  1506. SMult += lerp(lerp(fColorSaturationMultBlueDay * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) ), fColorSaturationMultBlueNight * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) ), JKNDF), fColorSaturationMultBlueInt * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) ), JKIF);
  1507. SMult += lerp(lerp(fColorSaturationMultMagentaDay * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) ), fColorSaturationMultMagentaNight * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) ), JKNDF), fColorSaturationMultMagentaInt * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) ), JKIF);
  1508. SMult += lerp(lerp(fColorSaturationMultRedDay * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) ), fColorSaturationMultRedNight * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) ), JKNDF), fColorSaturationMultRedInt * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) ), JKIF);
  1509. return SMult;
  1510. }
  1511.  
  1512. float ColorEqualizerMod(in float H, in float JKNDF, in float JKIF)
  1513. {
  1514. float SMod = 0.0;
  1515. SMod += lerp(lerp(fColorSaturationModRedDay * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) ), fColorSaturationModRedNight * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) ), JKNDF),fColorSaturationModRedInt * ( 1.0 - min( 1.0, abs( ( fHueRed - H ) / ( fHueRed - fHueOrange ) ) ) ), JKIF);
  1516. SMod += lerp(lerp(fColorSaturationModOrangeDay * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) ), fColorSaturationModOrangeNight * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) ), JKNDF), fColorSaturationModOrangeInt * ( 1.0 - min( 1.0, abs( ( fHueOrange - H ) / ( fHueOrange - fHueYellow ) ) ) ), JKIF);
  1517. SMod += lerp(lerp(fColorSaturationModYellowDay * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) ), fColorSaturationModYellowNight * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) ), JKNDF), fColorSaturationModYellowInt * ( 1.0 - min( 1.0, abs( ( fHueYellow - H ) / ( fHueYellow - fHueGreen ) ) ) ), JKIF);
  1518. SMod += lerp(lerp(fColorSaturationModGreenDay * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) ), fColorSaturationModGreenNight * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) ), JKNDF), fColorSaturationModGreenInt * ( 1.0 - min( 1.0, abs( ( fHueGreen - H ) / ( fHueGreen - fHueYellow ) ) ) ), JKIF);
  1519. SMod += lerp(lerp(fColorSaturationModCyanDay * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) ), fColorSaturationModCyanNight * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) ), JKNDF), fColorSaturationModCyanInt * ( 1.0 - min( 1.0, abs( ( fHueCyan - H ) / ( fHueCyan - fHueGreen ) ) ) ), JKIF);
  1520. SMod += lerp(lerp(fColorSaturationModBlueDay * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) ), fColorSaturationModBlueNight * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) ), JKNDF), fColorSaturationModBlueInt * ( 1.0 - min( 1.0, abs( ( fHueBlue - H ) / ( fHueBlue - fHueCyan ) ) ) ), JKIF);
  1521. SMod += lerp(lerp(fColorSaturationModMagentaDay * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) ), fColorSaturationModMagentaNight * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) ), JKNDF), fColorSaturationModMagentaInt * ( 1.0 - min( 1.0, abs( ( fHueMagenta - H ) / ( fHueMagenta - fHueBlue ) ) ) ), JKIF);
  1522. SMod += lerp(lerp(fColorSaturationModRedDay * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) ), fColorSaturationModRedNight * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) ), JKNDF), fColorSaturationModRedInt * ( 1.0 - min( 1.0, abs( ( fHueRed2 - H ) / ( fHueRed2 - fHueMagenta ) ) ) ), JKIF);
  1523. return SMod;
  1524. }
  1525. #endif
  1526.  
  1527. float3 HUEtoRGB(in float H)
  1528. {
  1529. float R = abs(H * 6.0 - 3.0) - 1.0;
  1530. float G = 2.0 - abs(H * 6.0 - 2.0);
  1531. float B = 2.0 - abs(H * 6.0 - 4.0);
  1532. return saturate(float3(R,G,B));
  1533. }
  1534.  
  1535. float RGBCVtoHUE(in float3 RGB, in float C, in float V)
  1536. {
  1537. float3 Delta = (V - RGB) / C;
  1538. Delta.rgb -= Delta.brg;
  1539. Delta.rgb += float3(2.0,4.0,6.0);
  1540. Delta.brg = step(V, RGB) * Delta.brg;
  1541. float H;
  1542. H = max(Delta.r, max(Delta.g, Delta.b));
  1543. return frac(H / 6.0);
  1544. }
  1545.  
  1546. float3 HSVtoRGB(in float3 HSV)
  1547. {
  1548. float3 RGB = HUEtoRGB(HSV.x);
  1549. return ((RGB - 1) * HSV.y + 1) * HSV.z;
  1550. }
  1551.  
  1552. float3 RGBtoHSV(in float3 RGB)
  1553. {
  1554. float3 HSV = 0.0;
  1555. HSV.z = max(RGB.r, max(RGB.g, RGB.b));
  1556. float M = min(RGB.r, min(RGB.g, RGB.b));
  1557. float C = HSV.z - M;
  1558. if (C != 0.0)
  1559. {
  1560. HSV.x = RGBCVtoHUE(RGB, C, HSV.z);
  1561. HSV.y = C / HSV.z;
  1562. }
  1563. return HSV;
  1564. }
  1565.  
  1566. float __min_channel(float3 v)
  1567. {
  1568. float t = (v.x<v.y) ? v.x : v.y;
  1569. t = (t<v.z) ? t : v.z;
  1570. return t;
  1571. }
  1572.  
  1573. float __max_channel(float3 v)
  1574. {
  1575. float t = (v.x>v.y) ? v.x : v.y;
  1576. t = (t>v.z) ? t : v.z;
  1577. return t;
  1578. }
  1579.  
  1580. float3 RGBtoHSV7(float3 RGB)
  1581. {
  1582. RGB.x = 1/(1+RGB.x);
  1583. RGB.y = 1/(1+RGB.y);
  1584. RGB.z = 1/(1+RGB.z);
  1585. float3 HSV = (0.0).xxx;
  1586. float minVal = __min_channel(RGB);
  1587. float maxVal = __max_channel(RGB);
  1588. float delta = maxVal - minVal; //Delta RGB value
  1589. HSV.z = maxVal;
  1590. if (delta != 0) { // If gray, leave H & S at zero
  1591. HSV.y = delta / maxVal;
  1592. float3 delRGB;
  1593. delRGB = ( ( ( maxVal.xxx - RGB ) / 6.0 ) + ( delta / 2.0 ) ) / delta;
  1594. if ( RGB.x == maxVal ) HSV.x = delRGB.z - delRGB.y;
  1595. else if ( RGB.y == maxVal ) HSV.x = ( 1.0/3.0) + delRGB.x - delRGB.z;
  1596. else if ( RGB.z == maxVal ) HSV.x = ( 2.0/3.0) + delRGB.y - delRGB.x;
  1597. if ( HSV.x < 0.0 ) { HSV.x += 1.0; }
  1598. if ( HSV.x > 1.0 ) { HSV.x -= 1.0; }
  1599. }
  1600. return (HSV);
  1601. }
  1602.  
  1603. float3 HSVtoRGB7(float3 HSV)
  1604. {
  1605. float3 RGB = HSV.z;
  1606. if ( HSV.y != 0 ) {
  1607. float var_h = HSV.x * 6;
  1608. float var_i = floor(var_h); // Or ... var_i = floor( var_h )
  1609. float var_1 = HSV.z * (1.0 - HSV.y);
  1610. float var_2 = HSV.z * (1.0 - HSV.y * (var_h-var_i));
  1611. float var_3 = HSV.z * (1.0 - HSV.y * (1-(var_h-var_i)));
  1612. if (var_i == 0) { RGB = float3(HSV.z, var_3, var_1); }
  1613. else if (var_i == 1) { RGB = float3(var_2, HSV.z, var_1); }
  1614. else if (var_i == 2) { RGB = float3(var_1, HSV.z, var_3); }
  1615. else if (var_i == 3) { RGB = float3(var_1, var_2, HSV.z); }
  1616. else if (var_i == 4) { RGB = float3(var_3, var_1, HSV.z); }
  1617. else { RGB = float3(HSV.z, var_1, var_2); }
  1618. }
  1619. RGB.x = (1/RGB.x)-1;
  1620. RGB.y = (1/RGB.y)-1;
  1621. RGB.z = (1/RGB.z)-1;
  1622. return (RGB);
  1623. }
  1624.  
  1625. float3 hsv_safe(float3 InColor)
  1626. {
  1627. float3 safeC = InColor;
  1628. safeC.x = frac(safeC.x);
  1629. /* if (safeC.x < 0.0) {
  1630. safeC.x += 1.0;
  1631. } else if (safeC.x > 1.0) {
  1632. safeC.x -= 1.0;
  1633. } */
  1634. return(safeC);
  1635. }
  1636.  
  1637. float3 hsv_complement(float3 InColor)
  1638. {
  1639. float3 complement = InColor;
  1640. complement.x -= 0.5;
  1641. if (complement.x<0.0) { complement.x += 1.0; } // faster than hsv_safe()
  1642. return(complement);
  1643. }
  1644.  
  1645. #define COLOR_PI (3.141592652589793238)
  1646. #define COLOR_TWO_PI (2.0 * COLOR_PI)
  1647.  
  1648. float3 color_cylinder(float3 hsv)
  1649. {
  1650. float a = hsv.x * COLOR_TWO_PI;
  1651. float3 p;
  1652. p.x = hsv.y * cos(a);
  1653. p.y = hsv.y * sin(a);
  1654. p.z = hsv.z;
  1655. return p;
  1656. }
  1657.  
  1658. float3 from_cylinder(float3 p)
  1659. {
  1660. float3 hsv;
  1661. hsv.z = p.z;
  1662. float q = p.x*p.x+p.y*p.y;
  1663. q = sqrt(q);
  1664. hsv.y = (q);
  1665. float a = atan2(p.y,p.x);
  1666. hsv.x = a / COLOR_TWO_PI;
  1667. // return hsv_safe(hsv);
  1668. return (hsv);
  1669. }
  1670.  
  1671. // lerp the shortest distance through the color solid
  1672. float3 hsv_lerp(float3 C0,float3 C1,float T)
  1673. {
  1674. float3 p0 = color_cylinder(C0);
  1675. float3 p1 = color_cylinder(C1);
  1676. float3 pg = lerp(p0,p1,T);
  1677. return from_cylinder(pg);
  1678. }
  1679.  
  1680. // lerp the shorterst distance around the color wheel - ONLY color
  1681. float3 hsv_tint(float3 SrcColor,float3 TintColor,float T)
  1682. {
  1683. float3 tt = hsv_lerp(SrcColor,TintColor,T);
  1684. tt.yz = SrcColor.yz;
  1685. return(tt);
  1686. }
  1687.  
  1688. float hue_lerp(float h1,
  1689. float h2,
  1690. float v)
  1691. {
  1692. float d = abs(h1 - h2);
  1693. if (d <= 0.5) {
  1694. return (float)lerp(h1,h2,v);
  1695. } else if (h1 < h2) {
  1696. return (float)frac(lerp((h1+1.0),h2,v));
  1697. } else
  1698. return (float)frac(lerp(h1,(h2+1.0),v));
  1699. }
  1700.  
  1701. float Luminance( float3 Color )
  1702. {
  1703. return dot( Color, float3( 0.2125, 0.7154, 0.0721 ) );
  1704. }
  1705.  
  1706. float random(in float2 uv)
  1707. {
  1708. float2 noise = (frac(sin(dot(uv , float2(12.9898,78.233) * 2.0)) * 43758.5453));
  1709. return abs(noise.x + noise.y) * 0.5;
  1710. }
  1711.  
  1712. float smootherstep(float edge0, float edge1, float x)
  1713. {
  1714. x = saturate((x - edge0)/(edge1 - edge0));
  1715. return x*x*(3 - 2*x);
  1716. }
  1717.  
  1718. // fitRange: Take an input value (x) on the range [a, b] and return a value mapped to the range [c, d].
  1719. float fitRange (float a, float b, float x, float c, float d) {
  1720. // 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].
  1721. // 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.
  1722. return ((d - c) * (x - a) / (b - a)) + c;
  1723. }
  1724.  
  1725. // 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).
  1726. // 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.
  1727. // Note: (n) must be positive and non-zero. This function must not be passed any value for n <= 0.0.
  1728. float pCurve (float x, float n) {
  1729. return ((n + 1) / (n * (1 + (n * pow(x, 2))))) - (1/n);
  1730. }
  1731.  
  1732. // sCurve: Takes an input value (x) on the range [-1, 1] and a curve depth (n), fits values to a smooth s-curve.
  1733. // Returns values for x=(-1, 1] ranging from 0 to 1, peeking at 1.0 where x = 1. Values outside this range are invalid.
  1734. // Note: The range (-1, 1] for (x) does not include -1.0. This function must not be passed x = -1.0.
  1735. float sCurve (float x, float n) {
  1736. return 1 / (1 + pow((1 - x)/(1 + x), n));
  1737. }
  1738.  
  1739. // peakCurve: Wrapper for pCurve, takes an input value (x) on the range [a,b], along with a curve depth (n),
  1740. // Checks for invalid values, fits (x) to the appropriate range, then calls pCurve.
  1741. float peakCurve (float a, float b, float x, float n) {
  1742. if (n <= 0.0) return -1.0; // check for invalid curve depth (n)
  1743. x = fitRange(a, b, x, -1.0, 1.0);
  1744. return pCurve(x, n);
  1745. }
  1746.  
  1747. // smoothCurve: Wrapper for sCurve, takes an input value (x) on the range [a,b], along with a curve depth (n).
  1748. // Checks for invalid values, fits (x) to the appropriate range, then calls sCurve.
  1749. float smoothCurve (float a, float b, float x, float n) {
  1750. if (x <= a) return 0.0; //return 0.0 if x is below the range.
  1751. if (x >= b) return 1.0; //return 1.0 if x is below the range.
  1752. x = fitRange(a, b, x, -1.0, 1.0);
  1753. return sCurve(x, n);
  1754. }
  1755.  
  1756. // 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).
  1757. // 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.
  1758. float compoundCurve (float a, float b, float x, float n, float c) {
  1759. if (x <= a) return 0.0; //return 0.0 if x is below the range.
  1760. if (x >= b) return 1.0; //return 1.0 if x is below the range.
  1761.  
  1762. if (c <= a) return -1.0; //invalid crossover point
  1763. if (c >= b) return -1.0; //invalid crossover point
  1764.  
  1765. float cMult = fitRange(a, b, c, 0.0, 2.0);
  1766.  
  1767. if (x <= c) {
  1768. return cMult * sCurve(fitRange(a, c, x, -1.0, 0.0), n);
  1769. } else {
  1770. return ((2.0 - cMult) * sCurve(fitRange(c, b, x, 0.0, 1.0), n)) + (cMult - 1);
  1771. }
  1772. }
  1773.  
  1774. // Master Effect functions
  1775. float4 TonemapPass( float4 colorInput, float JKI, float JKND )
  1776. {
  1777.  
  1778. float MGamma =lerp( lerp( MGammaDay, MGammaNight, JKND ), MGammaInterior, JKI );
  1779. float MExposure =lerp( lerp( MExposureDay, MExposureNight, JKND ), MExposureInterior, JKI );
  1780. float MSaturation =lerp( lerp( MSaturationDay, MSaturationNight, JKND ), MSaturationInterior, JKI );
  1781. float MBleach =lerp( lerp( MBleachDay, MBleachNight, JKND ), MBleachInterior, JKI );
  1782. float MDefog =lerp( lerp( MDefogDay, MDefogNight, JKND ), MDefogInterior, JKI );
  1783. float MFogColor =lerp( lerp( MFogColorDay, MFogColorNight, JKND ), MFogColorInterior, JKI );
  1784. float MA =lerp( lerp( MADay, MANight, JKND ), MAInterior, JKI );
  1785. float MB =lerp( lerp( MBDay, MBNight, JKND ), MBInterior, JKI );
  1786. float MC =lerp( lerp( MCDay, MCNight, JKND ), MCInterior, JKI );
  1787. float MD =lerp( lerp( MDDay, MDNight, JKND ), MDInterior, JKI );
  1788. float ME =lerp( lerp( MEDay, MENight, JKND ), MEInterior, JKI );
  1789. float MF =lerp( lerp( MFDay, MFNight, JKND ), MFInterior, JKI );
  1790. float MW =lerp( lerp( MWDay, MWNight, JKND ), MWInterior, JKI );
  1791. float MExpAdjust =lerp( lerp( MExpAdjustDay, MExpAdjustNight, JKND ), MExpAdjustInterior, JKI );
  1792. float MAddContrast =lerp( lerp( MAddContrastDay, MAddContrastNight, JKND ), MAddContrastInterior, JKI );
  1793.  
  1794.  
  1795. float3 color = colorInput.rgb;
  1796.  
  1797. //mine
  1798. float3 curr = ((color*(MA*color+MC*MB)+MD*ME)/(color*(MA*color+MB)+MD*MF))-ME/MF;
  1799. float3 whiteScale = ((MW*(MA*MW+MC*MB)+MD*ME)/(MW*(MA*MW+MB)+MD*MF))-ME/MF;
  1800. color = curr*whiteScale;
  1801.  
  1802. color = color*MExpAdjust;
  1803.  
  1804. color = lerp(color, 0.5 * (1 + sin((color - 0.5)*3.1415926)), MAddContrast);
  1805.  
  1806. color = saturate(color - MDefog * MFogColor); // Defog
  1807.  
  1808. color *= pow(2.0f, MExposure); // Exposure
  1809.  
  1810. color = pow(color, MGamma); // Gamma -- roll into the first gamma correction in main.h ?
  1811.  
  1812. float3 MlumCoeff = float3(0.2126, 0.7152, 0.0722);
  1813. float Mlum = dot(MlumCoeff, color.rgb);
  1814.  
  1815. float3 Mblend = Mlum.rrr; //dont use float3
  1816.  
  1817. float ML = saturate( 10.0 * (Mlum - 0.45) );
  1818.  
  1819. float3 result1 = 2.0f * color.rgb * Mblend;
  1820. float3 result2 = 1.0f - 2.0f * (1.0f - Mblend) * (1.0f - color.rgb);
  1821.  
  1822. float3 newColor = lerp(result1, result2, ML);
  1823. float A2 = MBleach * color.rgb; //why use a float for A2 here and then multiply by color.rgb (a float3)?
  1824. //float3 A2 = Bleach * color.rgb; //
  1825. float3 mixRGB = A2 * newColor;
  1826.  
  1827. color.rgb += ((1.0f - A2) * mixRGB);
  1828.  
  1829. float3 Mmiddlegray = dot(color,(1.0/3.0)); //1fps slower than the original on nvidia, 2 fps faster on AMD
  1830.  
  1831. float3 Mdiffcolor = color - Mmiddlegray; //float 3 here
  1832. colorInput.rgb = (color + Mdiffcolor * MSaturation)/(1+(Mdiffcolor*MSaturation)); //saturation
  1833.  
  1834. return colorInput;
  1835. }
  1836.  
  1837.  
  1838.  
  1839.  
  1840. float4 CrossProcess_PS(float4 color, float JKI, float JKND)
  1841. {
  1842.  
  1843. float CrossContrast =lerp( lerp( CrossContrastDay, CrossContrastNight, JKND ), CrossContrastInterior, JKI );
  1844. float CrossSaturation =lerp( lerp( CrossSaturationDay, CrossSaturationNight, JKND ), CrossSaturationInterior, JKI );
  1845. float CrossBrightness =lerp( lerp( CrossBrightnessDay, CrossBrightnessNight, JKND ), CrossBrightnessInterior, JKI );
  1846. float CrossAmount =lerp( lerp( CrossAmountDay, CrossAmountNight, JKND ), CrossAmountInterior, JKI );
  1847.  
  1848.  
  1849. float4 image1 = color;
  1850. float4 image2 = color;
  1851.  
  1852. float gray = dot(float3(0.5,0.5,0.5), image1);
  1853.  
  1854. image1 = lerp (gray, image1,CrossSaturation);
  1855.  
  1856. image1 = lerp (0.35, image1,CrossContrast);
  1857.  
  1858. image1 +=CrossBrightness;
  1859.  
  1860. image2.r = image1.r * CrossMatrix[0].x + CrossMatrix[0].y;
  1861. image2.g = image1.g * CrossMatrix[1].x + CrossMatrix[1].y;
  1862. image2.b = image1.b * CrossMatrix[2].x + CrossMatrix[2].y;
  1863.  
  1864. color = lerp(image1, image2, CrossAmount);
  1865.  
  1866. return color;
  1867. }
  1868.  
  1869.  
  1870. static float3x3 RGB =
  1871. {
  1872. 2.67147117265996,-1.26723605786241,-0.410995602172227,
  1873. -1.02510702934664,1.98409116241089,0.0439502493584124,
  1874. 0.0610009456429445,-0.223670750812863,1.15902104167061
  1875. };
  1876.  
  1877. static float3x3 XYZ =
  1878. {
  1879. 0.500303383543316,0.338097573222739,0.164589779545857,
  1880. 0.257968894274758,0.676195259144706,0.0658358459823868,
  1881. 0.0234517888692628,0.1126992737203,0.866839673124201
  1882. };
  1883.  
  1884. float4 DPXPass(float4 InputColor, float JKI, float JKND){
  1885.  
  1886.  
  1887. float DPXRed =lerp( lerp( DPXRedDay, DPXRedNight, JKND ), DPXRedInterior, JKI );
  1888. float DPXGreen =lerp( lerp( DPXGreenDay, DPXGreenNight, JKND ), DPXGreenInterior, JKI );
  1889. float DPXBlue =lerp( lerp( DPXBlueDay, DPXBlueNight, JKND ), DPXBlueInterior, JKI );
  1890.  
  1891. float DPXColorGamma =lerp( lerp( DPXColorGammaDay, DPXColorGammaNight, JKND ), DPXColorGammaInterior, JKI );
  1892.  
  1893. float DPXDPXSaturation =lerp( lerp( DPXDPXSaturationDay, DPXDPXSaturationNight, JKND ), DPXDPXSaturationInterior, JKI );
  1894.  
  1895. float DPXRedC =lerp( lerp( DPXRedCDay, DPXRedCNight, JKND ), DPXRedCInterior, JKI );
  1896. float DPXGreenC =lerp( lerp( DPXGreenCDay, DPXGreenCNight, JKND ), DPXGreenCInterior, JKI );
  1897. float DPXBlueC =lerp( lerp( DPXBlueCDay, DPXBlueCNight, JKND ), DPXBlueCInterior, JKI );
  1898.  
  1899. float DPXBlend =lerp( lerp( DPXBlendDay, DPXBlendNight, JKND ), DPXBlendInterior, JKI );
  1900.  
  1901.  
  1902. float DPXContrast = -0.2;
  1903.  
  1904. float DPXGamma = 1.0;
  1905.  
  1906. float RedCurve = DPXRed;
  1907. float GreenCurve = DPXGreen;
  1908. float BlueCurve = DPXBlue;
  1909.  
  1910. float3 RGB_Curve = float3(DPXRed,DPXGreen,DPXBlue);
  1911. float3 RGB_C = float3(DPXRedC,DPXGreenC,DPXBlueC);
  1912.  
  1913. float3 B = InputColor.rgb;
  1914.  
  1915. B = pow(B, 1.0/DPXGamma);
  1916.  
  1917. B = B * (1.0 - DPXContrast) + (0.5 * DPXContrast);
  1918.  
  1919. float3 Btemp = (1.0 / (1.0 + exp(RGB_Curve / 2.0)));
  1920. B = ((1.0 / (1.0 + exp(-RGB_Curve * (B - RGB_C)))) / (-2.0 * Btemp + 1.0)) + (-Btemp / (-2.0 * Btemp + 1.0));
  1921.  
  1922.  
  1923. float value = max(max(B.r, B.g), B.b);
  1924. float3 color = B / value;
  1925.  
  1926. color = pow(color, 1.0/DPXColorGamma);
  1927.  
  1928. float3 c0 = color * value;
  1929.  
  1930. c0 = mul(XYZ, c0);
  1931.  
  1932. float luma = dot(c0, float3(0.30, 0.59, 0.11));
  1933.  
  1934. c0 = (1.0 - DPXDPXSaturation) * luma + DPXDPXSaturation * c0;
  1935.  
  1936. c0 = mul(RGB, c0);
  1937.  
  1938. InputColor.rgb = lerp(InputColor.rgb, c0, DPXBlend);
  1939.  
  1940.  
  1941. return InputColor;
  1942. }
  1943.  
  1944.  
  1945.  
  1946. /////////////////////////////////////////////////////////////////////////////////////////////////
  1947. ///SHADER INITIALIZATIONS////////////////////////////////////////////////////////////////////////
  1948. /////////////////////////////////////////////////////////////////////////////////////////////////
  1949. //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
  1950. float4 tempF1; //0,1,2,3
  1951. float4 tempF2; //5,6,7,8
  1952. float4 tempF3; //9,0
  1953. float4 Timer; //x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
  1954. float4 ScreenSize; //x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
  1955. float ENightDayFactor; //changes in range 0..1, 0 means that night time, 1 - day time
  1956. float EInteriorFactor; //changes 0 or 1. 0 means that exterior, 1 - interior
  1957. float EBloomAmount; //enb version of bloom applied, ignored if original post processing used
  1958.  
  1959. texture2D texs0;//color
  1960. texture2D texs3;//bloom enb
  1961. texture2D texs4;//adaptation enb
  1962. texture2D texs7;//palette enb
  1963.  
  1964. texture2D texs8
  1965. <
  1966. string ResourceName="enblensdirt.bmp";
  1967. >;
  1968. texture2D texs10
  1969. <
  1970. string ResourceName="enbeinringsiezuknechten.bmp";
  1971. >;
  1972.  
  1973.  
  1974. sampler2D _s0 = sampler_state
  1975. {
  1976. Texture = <texs0>;
  1977. MinFilter = LINEAR;//
  1978. MagFilter = LINEAR;//
  1979. MipFilter = LINEAR;//LINEAR;
  1980. AddressU = Clamp;
  1981. AddressV = Clamp;
  1982. SRGBTexture=FALSE;
  1983. MaxMipLevel=0;
  1984. MipMapLodBias=0;
  1985. };
  1986. sampler2D _s3 = sampler_state
  1987. {
  1988. Texture = <texs3>;
  1989. MinFilter = LINEAR;//
  1990. MagFilter = LINEAR;//
  1991. MipFilter = NONE;//LINEAR;
  1992. AddressU = Clamp;
  1993. AddressV = Clamp;
  1994. SRGBTexture=FALSE;
  1995. MaxMipLevel=0;
  1996. MipMapLodBias=0;
  1997. };
  1998.  
  1999. sampler2D _s4 = sampler_state
  2000. {
  2001. Texture = <texs4>;
  2002. MinFilter = LINEAR;//
  2003. MagFilter = LINEAR;//
  2004. MipFilter = NONE;//LINEAR;
  2005. AddressU = Clamp;
  2006. AddressV = Clamp;
  2007. SRGBTexture=FALSE;
  2008. MaxMipLevel=0;
  2009. MipMapLodBias=0;
  2010. };
  2011.  
  2012. sampler2D _s7 = sampler_state
  2013. {
  2014. Texture = <texs7>;
  2015. MinFilter = LINEAR;
  2016. MagFilter = LINEAR;
  2017. MipFilter = NONE;
  2018. AddressU = Clamp;
  2019. AddressV = Clamp;
  2020. SRGBTexture=FALSE;
  2021. MaxMipLevel=0;
  2022. MipMapLodBias=0;
  2023. };
  2024.  
  2025. sampler2D _s8 = sampler_state //additional
  2026. {
  2027. Texture = <texs8>;
  2028. MinFilter = LINEAR;
  2029. MagFilter = LINEAR;
  2030. };
  2031.  
  2032. sampler2D _s10 = sampler_state //additional
  2033. {
  2034. Texture = <texs10>;
  2035. MinFilter = LINEAR;
  2036. MagFilter = LINEAR;
  2037. };
  2038.  
  2039.  
  2040. struct VS_OUTPUT_POST
  2041. {
  2042. float4 vpos : POSITION;
  2043. float2 txcoord0 : TEXCOORD0;
  2044. };
  2045. struct VS_INPUT_POST
  2046. {
  2047. float3 pos : POSITION;
  2048. float2 txcoord0 : TEXCOORD0;
  2049. };
  2050.  
  2051. VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
  2052. {
  2053. VS_OUTPUT_POST OUT;
  2054.  
  2055. OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  2056.  
  2057. OUT.txcoord0.xy=IN.txcoord0.xy;
  2058.  
  2059. return OUT;
  2060. }
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066. float4 PS_GTASA(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
  2067. {
  2068. float4 _oC0=0.0; //output
  2069.  
  2070. float4 _c6=float4(0, 0, 0, 0);
  2071. float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
  2072.  
  2073. float4 r0;
  2074. float4 r1;
  2075. float4 r2;
  2076. float4 r3;
  2077. float4 r4;
  2078. float4 r5;
  2079. float4 r6;
  2080. float4 r7;
  2081. float4 r8;
  2082. float4 r9;
  2083. float4 r10;
  2084. float4 r11;
  2085.  
  2086. /////////////////////////////////////////////////////////////////////////////////////////////////
  2087. ///DNI CODE//////////////////////////////////////////////////////////////////////////////////////
  2088. /////////////////////////////////////////////////////////////////////////////////////////////////
  2089.  
  2090. // FLIP DNI CODE
  2091. float JKInteriorFactor = EInteriorFactor;
  2092. float JKNightDayFactor = ENightDayFactor;
  2093. #if(FLIP_INT_EXT_FACTOR == 1)
  2094. JKInteriorFactor = 1 - EInteriorFactor;
  2095. #endif
  2096. #if(FLIP_NITE_DAY_FACTOR == 1)
  2097. JKNightDayFactor = 1 - ENightDayFactor;
  2098. #endif
  2099.  
  2100. // FLIP DNI CODE
  2101. float hnd = ENightDayFactor;
  2102. float ji = EInteriorFactor;
  2103. #if(FLIP_INT_EXT_FACTOR == 0)
  2104. ji = 1 - EInteriorFactor;
  2105. #endif
  2106. #if(FLIP_NITE_DAY_FACTOR == 0)
  2107. hnd = 1 - ENightDayFactor;
  2108. #endif
  2109.  
  2110. float2 hndtweak = float2( 3.1 , 1.5 );
  2111. float vhnd = hnd; // effects vignette stregth;
  2112. float bchnd = hnd; // effects hd6 bloom crisp
  2113. float cdhnd = hnd; // effects hd6 colorsat daynight
  2114.  
  2115. // Some caves are seen as daytime, so I set key 3 to force nightime
  2116. // This doesnt work very well >_<
  2117. hnd = tempF2.x < 1 ? 0 : hnd;
  2118. hndtweak.x = tempF2.x < 1 ? hndtweak.y : hndtweak.x; // Dont ask, I have no idea why I need this lol
  2119.  
  2120. /////////////////////////////////////////////////////////////////////////////////////////////////
  2121. ///LETTERBOX CODE////////////////////////////////////////////////////////////////////////////////
  2122. /////////////////////////////////////////////////////////////////////////////////////////////////
  2123.  
  2124. #if(LETTERBOX_BARS == 1)
  2125. float fLetterboxBarHeight =lerp( lerp( fLetterboxBarHeightDay, fLetterboxBarHeightNight, JKNightDayFactor ), fLetterboxBarHeightInterior, JKInteriorFactor );
  2126.  
  2127. if( IN.txcoord0.y > 1.0 - fLetterboxBarHeight || IN.txcoord0.y < fLetterboxBarHeight )
  2128. {
  2129. return _c6;
  2130. }
  2131. #endif
  2132.  
  2133. /////////////////////////////////////////////////////////////////////////////////////////////////
  2134. ///VANILLA COLOR CORRECTION//////////////////////////////////////////////////////////////////////
  2135. /////////////////////////////////////////////////////////////////////////////////////////////////
  2136.  
  2137. float4 _v0=0.0;
  2138.  
  2139. _v0.xy=IN.txcoord0.xy;
  2140.  
  2141.  
  2142.  
  2143.  
  2144.  
  2145. //float3 LumCoeff = lerp( LumCoeffInterior, ( lerp( LumCoeffNight, LumCoeffDay, JKNightDayFactor ) ), JKInteriorFactor);
  2146.  
  2147.  
  2148. #if (SHARPEN==0)
  2149. r1=tex2D(_s0, _v0.xy); // COLOR
  2150. #endif
  2151.  
  2152. #if (SHARPEN==1)
  2153.  
  2154. r1=tex2D(_s0, _v0.xy);
  2155. r1 *= 9;
  2156.  
  2157. float ScreenSizeHoriz = 1/(ScreenSize.x * ScreenSize.w);
  2158.  
  2159. float fSharpScale = lerp( fSharpScaleInterior, ( lerp( fSharpScaleNight, fSharpScaleDay, JKNightDayFactor ) ), JKInteriorFactor);
  2160.  
  2161. r1 -= tex2D(_s0, _v0.xy + float2(-ScreenSize.y, ScreenSizeHoriz) * fSharpScale);
  2162. r1 -= tex2D(_s0, _v0.xy + float2(0.0, ScreenSizeHoriz) * fSharpScale);
  2163. r1 -= tex2D(_s0, _v0.xy + float2(ScreenSize.y, ScreenSizeHoriz) * fSharpScale);
  2164. r1 -= tex2D(_s0, _v0.xy + float2(ScreenSize.y, 0.0) * fSharpScale);
  2165. r1 -= tex2D(_s0, _v0.xy + float2(ScreenSize.y, -ScreenSizeHoriz) * fSharpScale);
  2166. r1 -= tex2D(_s0, _v0.xy + float2(0.0, -ScreenSizeHoriz) * fSharpScale);
  2167. r1 -= tex2D(_s0, _v0.xy + float2(-ScreenSize.y, -ScreenSizeHoriz) * fSharpScale);
  2168. r1 -= tex2D(_s0, _v0.xy + float2(-ScreenSize.y, 0.0) * fSharpScale);
  2169.  
  2170.  
  2171. #endif
  2172.  
  2173.  
  2174. //r1=tex2D(_s0, _v0.xy); // COLOR
  2175.  
  2176. r11=r1; //my bypass
  2177. _oC0.xyz=r1.xyz; // FOR FUTURE USE WITHOUT GAME COLOR CORRECTIONS
  2178.  
  2179.  
  2180. float4 color=_oC0;
  2181.  
  2182.  
  2183. color*=1.2;
  2184. color=max(color,0.0001); //KYO : decrease this value to increase black levels. I'm doing this to affect BLACKS only without touching anything else.
  2185.  
  2186. float4 Adaptation=tex2D(_s4, 0.5);
  2187. float grayadaptation=Luminance(Adaptation.xyz);
  2188.  
  2189. /////////////////////////////////////////////////////////////////////////////////////////////////
  2190. ///HD6 COLOR CODE////////////////////////////////////////////////////////////////////////////////
  2191. /////////////////////////////////////////////////////////////////////////////////////////////////
  2192.  
  2193. // HD6 - Alter Brightness using keyboard during gameplay
  2194.  
  2195. float3 tuctbrt1[2] = { uctbrt1[0], uctbrt1[1] };
  2196. float3 tuctbrt2[2] = { uctbrt2[0], uctbrt2[1] };
  2197. float3 tuctcon[2] = { uctcon[0], uctcon[1] };
  2198. float3 tuctsat[2] = { uctsat[0], uctsat[1] };
  2199.  
  2200. tuctbrt1[0] -= darkenby1[0];
  2201. tuctbrt1[1] -= darkenby1[1];
  2202.  
  2203. float h1 = lerp(-1,1,tempF1.x); // Increases speed it changes by when pressing key
  2204. h1 = lerp( h1, 1, lerp(hnd, 0, ji) ); // Removes affect during day
  2205. // h1 = h1 - (h1 % 0.1); // Changes it so incriments are in steps, remove this if you want smooth changes when pressing keys
  2206. 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
  2207.  
  2208. float h2 = lerp(-1,1,tempF1.y); // Increases speed it changes by when pressing key
  2209. h2 = lerp( 1, h2, lerp(0, hnd, ji) ); // Removes affect during night
  2210. // h2 = h2 - (h2 % 0.1); // Changes it so incriments are in steps, remove this if you want smooth changes when pressing keys
  2211.  
  2212. float h3 = lerp(-1,1,tempF1.z); // Increases speed it changes by when pressing key
  2213. h3 = lerp( h3, 1, ji ); // Removes affect in interior
  2214. // h3 = h3 - (h3 % 0.1); // Changes it so incriments are in steps, remove this if you want smooth changes when pressing keys
  2215.  
  2216. hbs = lerp( (hbs/2)-1, hbs, h2); // Reduce bloom as it gets darker, otherwise it just gets hazier, higher number reduces bloom more as it gets darker
  2217. hbs = max(0,hbs);
  2218. hbs = min(2,hbs); // should be able to go above 1, but not 2
  2219.  
  2220. vhnd = lerp(-2,hnd,h2);
  2221. vhnd = max(0,vhnd); // do not go below 0;
  2222. vhnd = min(1,vhnd); // not above 1, just incase people like surface of sun
  2223.  
  2224. cdhnd=bchnd=vhnd;
  2225.  
  2226. #if(COLORSAT_DAYNIGHT == 1)
  2227.  
  2228. float3 nsatn= lerp( ansati, ( lerp( ansatn, ansatd, hnd ) ), ji );
  2229. float3 oldcoln = color.xyz;
  2230.  
  2231. nsatn.rgb-= lerp( snsati, ( lerp( snsatn, snsatd, hnd ) ), ji );
  2232.  
  2233. nsatn.rb*= lerp( hd6MAGENTAInterior, ( lerp( hd6MAGENTANight, hd6MAGENTADay, hnd ) ), ji );
  2234. nsatn.bg*= lerp( hd6CYANInterior, ( lerp( hd6CYANNight, hd6CYANDay, hnd ) ), ji );
  2235. nsatn.rg*= lerp( hd6YELLOWInterior, ( lerp( hd6YELLOWNight, hd6YELLOWDay, hnd ) ), ji );
  2236.  
  2237. nsatn.rb-= lerp( hd6MAGENTAsubInterior, ( lerp( hd6MAGENTAsubNight, hd6MAGENTAsubDay, hnd ) ), ji );
  2238. nsatn.bg-= lerp( hd6CYANsubInterior, ( lerp( hd6CYANsubNight, hd6CYANsubDay, hnd ) ), ji );
  2239. nsatn.rg-= lerp( hd6YELLOWsubInterior, ( lerp( hd6YELLOWsubNight, hd6YELLOWsubDay, hnd ) ), ji );
  2240.  
  2241. color.xyz *=nsatn;
  2242.  
  2243. //++Changes appareance of colors, bloom color perception handled elsewhere++++++++++++++++++++++++++++++++++++++++++++++++++
  2244. float3 greycn = float3(0.299, 0.587, 0.114); // perception of color luminace
  2245. //float3 greycn = float3(0.811,0.523,0.996); // perception of color luminace
  2246. //float3 greycn = float3(0.333,0.333,0.333); // screw perception
  2247. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2248. color.xyz += (oldcoln.x-(oldcoln.x*nsatn.x)) * greycn.x;
  2249. color.xyz += (oldcoln.y-(oldcoln.y*nsatn.y)) * greycn.y;
  2250. color.xyz += (oldcoln.z-(oldcoln.z*nsatn.z)) * greycn.z;
  2251.  
  2252. #endif
  2253.  
  2254. #if(COLOR_TWEAKS == 1)
  2255. float3 uctbrt1t = float3( lerp( tuctbrt1[1].x, tuctbrt1[0].x, h1), lerp( tuctbrt1[1].y, tuctbrt1[0].y, h2), lerp( tuctbrt1[1].z, tuctbrt1[0].z, h3) );
  2256. float3 uctbrt2t = float3( lerp( tuctbrt2[1].x, tuctbrt2[0].x, h1), lerp( tuctbrt2[1].y, tuctbrt2[0].y, h2), lerp( tuctbrt2[1].z, tuctbrt2[0].z, h3) );
  2257. float3 uctcont = float3( lerp( tuctcon[1].x, tuctcon[0].x, h1), lerp( tuctcon[1].y, tuctcon[0].y, h2), lerp( tuctcon[1].z, tuctcon[0].z, h3) );
  2258. float3 uctsatt = float3( lerp( tuctsat[1].x, tuctsat[0].x, h1), lerp( tuctsat[1].y, tuctsat[0].y, h2), lerp( tuctsat[1].z, tuctsat[0].z, h3) );
  2259.  
  2260. float ctbrt1 = lerp( uctbrt1t.z,lerp( uctbrt1t.y, uctbrt1t.x, hnd ), ji );
  2261. float ctbrt2 = lerp( uctbrt2t.z, lerp( uctbrt2t.y, uctbrt2t.x, hnd ), ji );
  2262. float ctcon = lerp( uctcont.z,lerp( uctcont.y, uctcont.x, hnd ), ji );
  2263. float ctsat = lerp( uctsatt.z, lerp( uctsatt.y, uctsatt.x, hnd ), ji );
  2264.  
  2265. float3 ctLumCoeff = float3(0.2125, 0.7154, 0.0721);
  2266. float3 ctAvgLumin = float3(0.5, 0.5, 0.5);
  2267. float3 ctbrtColor = color.rgb * ctbrt1;
  2268.  
  2269. float3 ctintensity = dot(ctbrtColor, ctLumCoeff);
  2270. float3 ctsatColor = lerp(ctintensity, ctbrtColor, ctsat);
  2271. float3 cconColor = lerp(ctAvgLumin, ctsatColor, ctcon);
  2272.  
  2273. color.xyz = cconColor * ctbrt2;
  2274. float3 cbalance = lerp(rgbi, ( lerp (rgbn,rgbd, hnd) ), ji);
  2275. color.xyz = cbalance.xyz * color.xyz;
  2276. #endif
  2277.  
  2278. /////////////////////////////////////////////////////////////////////////////////////////////////
  2279. ///PRE BLOOM CODE////////////////////////////////////////////////////////////////////////////////
  2280. /////////////////////////////////////////////////////////////////////////////////////////////////
  2281.  
  2282. #if(PRE_BLOOM == 1)
  2283.  
  2284.  
  2285. float mavg;
  2286. float3 nsat;
  2287. float3 oldcol;
  2288. float4 xcolorbloom;
  2289.  
  2290. #if(CURVE_BLOOM == 1)
  2291.  
  2292.  
  2293.  
  2294. xcolorbloom = tex2D( _s3, _v0.xy );
  2295.  
  2296.  
  2297. //++Changes appareance of colors+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2298. float3 cbgreycn = float3(0.299, 0.587, 0.114); // perception of color luminace
  2299. //float3 cbgreycn = float3(0.811,0.523,0.996); // perception of color luminace
  2300. //float3 cbgreycn = float3(0.333,0.333,0.333); // screw perception
  2301. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2302.  
  2303. float bloomBrightness = lerp( lerp( BloomBrightnessDay, BloomBrightnessNight, JKNightDayFactor), BloomBrightnessInt, JKInteriorFactor);
  2304. float3 bloomSaturation = lerp( lerp( BloomSaturationDay, BloomSaturationNight, JKNightDayFactor), BloomSaturationInt, JKInteriorFactor);
  2305. float bloomContrast = lerp( lerp( BloomContrastDay, BloomContrastNight, JKNightDayFactor), BloomContrastInt, JKInteriorFactor);
  2306. float bloomThreshold = lerp( lerp( BloomThresholdDay, BloomThresholdNight, JKNightDayFactor), BloomThresholdInt, JKInteriorFactor);
  2307. float bloomCurve = lerp( lerp( BloomCurveDay, BloomCurveNight, JKNightDayFactor), BloomCurveInt, JKInteriorFactor);
  2308. float bloomavgbr = (color.x+color.y+color.z)/3;
  2309.  
  2310. #if(BLOOM_DEFUZZ == 1)
  2311. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  2312. xcolorbloom.xyz-=(mavg/3);
  2313. xcolorbloom.xyz+=(mavg*0.2);
  2314. xcolorbloom.xyz*(mavg*1.2);
  2315. #endif
  2316.  
  2317. #if(BLOOM_COLORIZATION == 1)
  2318. xcolorbloom.rgb*= lerp( lerp( curvebloommultDay, curvebloommultNight, JKNightDayFactor ), curvebloommultInterior, JKInteriorFactor );
  2319. xcolorbloom.rgb-= lerp( lerp( curvebloomsubDay, curvebloomsubNight, JKNightDayFactor ), curvebloomsubInterior, JKInteriorFactor );
  2320. xcolorbloom.rb*= lerp( lerp( curveMAGENTAbloomDay, curveMAGENTAbloomNight, JKNightDayFactor ), curveMAGENTAbloomInterior, JKInteriorFactor );
  2321. xcolorbloom.gb*= lerp( lerp( curveCYANbloomDay, curveCYANbloomNight, JKNightDayFactor ), curveCYANbloomInterior, JKInteriorFactor );
  2322. xcolorbloom.rg*= lerp( lerp( curveYELLOWbloomDay, curveYELLOWbloomNight, JKNightDayFactor ), curveYELLOWbloomInterior, JKInteriorFactor );
  2323. #endif
  2324.  
  2325. float4 bloomncolor = xcolorbloom;
  2326. //remove bloom from dark areas//////////////////////////////////
  2327. bloomncolor = pow(bloomncolor/bloomCurve, bloomThreshold + (bloomncolor*bloomncolor));
  2328. //adjust saturation
  2329. bloomncolor.xyz *= bloomSaturation;
  2330. bloomncolor.xyz += (xcolorbloom.x-(xcolorbloom.x*bloomSaturation.x)) * cbgreycn.x;
  2331. bloomncolor.xyz += (xcolorbloom.y-(xcolorbloom.y*bloomSaturation.y)) * cbgreycn.y;
  2332. bloomncolor.xyz += (xcolorbloom.z-(xcolorbloom.z*bloomSaturation.z)) * cbgreycn.z;
  2333. //adjust brightness/////////////////////////////////////////////
  2334. bloomncolor.xyz = pow(bloomncolor, 1.0 / max(0.0001, bloomBrightness));
  2335. //adjust contrast///////////////////////////////////////////////
  2336. bloomncolor.xyz = pow(bloomncolor, bloomContrast) / (pow(saturate(bloomncolor), bloomContrast) + pow(1.0 - saturate(bloomncolor), bloomContrast)); //weird adaptation//////////////////////////////////////////////
  2337. //sharpen///////////////////////////////////////////////////////
  2338. #if( SHARP_MODE == 1)
  2339. bloomncolor = max(0, lerp(0, bloomncolor, saturate(bloomavgbr*2)));
  2340. bloomncolor = max(0, lerp(bloomncolor, 1, saturate(bloomavgbr-0.5)*2));
  2341. #endif
  2342. //mix bloom/////////////////////////////////////////////////////
  2343. #if(BLOOM_LERP == 1)
  2344. color.xyz = lerp( color, bloomncolor, EBloomAmount );
  2345. #endif
  2346. #if(BLOOM_ADD == 1)
  2347. color.xyz += bloomncolor * EBloomAmount;
  2348. #endif
  2349. #if(BLOOM_LERP == 0)
  2350. #if(BLOOM_ADD == 0)
  2351. color.xyz = max(color, bloomncolor * EBloomAmount);
  2352. #endif
  2353. #endif
  2354. #endif
  2355.  
  2356. #if(ENB_BLOOM == 1)
  2357.  
  2358. float4 enbbloomcol=tex2D(_s3, _v0.xy);
  2359.  
  2360.  
  2361. // DEBUG OUTPUT
  2362. // return enbbloomcol;
  2363.  
  2364. if( enbbloomcol.r + enbbloomcol.g + enbbloomcol.b > 0.0 )
  2365. {
  2366.  
  2367. #if(BLOOM_DEFUZZ == 1)
  2368. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  2369. xcolorbloom.xyz-=(mavg/3);
  2370. xcolorbloom.xyz+=(mavg*0.2);
  2371. xcolorbloom.xyz*(mavg*1.2);
  2372. #endif
  2373.  
  2374. #if(BLOOM_COLORIZATION == 1)
  2375. enbbloomcol.rgb*= lerp( lerp( ENBbloommultDay, ENBbloommultNight, JKNightDayFactor ), ENBbloommultInterior, JKInteriorFactor );
  2376. enbbloomcol.rgb-= lerp( lerp( ENBbloomsubDay, ENBbloomsubNight, JKNightDayFactor ), ENBbloomsubInterior, JKInteriorFactor );
  2377. enbbloomcol.rb*= lerp( lerp( ENBMAGENTAbloomDay, ENBMAGENTAbloomNight, JKNightDayFactor ), ENBMAGENTAbloomInterior, JKInteriorFactor );
  2378. enbbloomcol.gb*= lerp( lerp( ENBCYANbloomDay, ENBCYANbloomNight, JKNightDayFactor ), ENBCYANbloomInterior, JKInteriorFactor );
  2379. enbbloomcol.rg*= lerp( lerp( ENBYELLOWbloomDay, ENBYELLOWbloomNight, JKNightDayFactor ), ENBYELLOWbloomInterior, JKInteriorFactor );
  2380. #endif
  2381.  
  2382. float fBloomSaturationSmooth =lerp( lerp( fBloomSaturationSmoothDay, fBloomSaturationSmoothNight, JKNightDayFactor ), fBloomSaturationSmoothInterior, JKInteriorFactor );
  2383. float fBloomSaturationCurve =lerp( lerp( fBloomSaturationCurveDay, fBloomSaturationCurveNight, JKNightDayFactor ), fBloomSaturationCurveInterior, JKInteriorFactor );
  2384. float fBloomSaturationMult =lerp( lerp( fBloomSaturationMultDay, fBloomSaturationMultNight, JKNightDayFactor ), fBloomSaturationMultInterior, JKInteriorFactor );
  2385.  
  2386. float fBloomIntensitySmooth =lerp( lerp( fBloomIntensitySmoothDay, fBloomIntensitySmoothNight, JKNightDayFactor ), fBloomIntensitySmoothInterior, JKInteriorFactor );
  2387. float fBloomIntensityCurve =lerp( lerp( fBloomIntensityCurveDay, fBloomIntensityCurveNight, JKNightDayFactor ), fBloomIntensityCurveInterior, JKInteriorFactor );
  2388. float fBloomIntensityMult =lerp( lerp( fBloomIntensityMultDay, fBloomIntensityMultNight, JKNightDayFactor ), fBloomIntensityMultInterior, JKInteriorFactor );
  2389. float fBloomIntensityMod =lerp( lerp( fBloomIntensityModDay, fBloomIntensityModNight, JKNightDayFactor ), fBloomIntensityModInterior, JKInteriorFactor );
  2390. float fBloomIntensityMax =lerp( lerp( fBloomIntensityMaxDay, fBloomIntensityMaxNight, JKNightDayFactor ), fBloomIntensityMaxInterior, JKInteriorFactor );
  2391.  
  2392. float3 bloomhsv = RGBtoHSV( enbbloomcol.rgb );
  2393. bloomhsv.y = lerp( bloomhsv.y, smoothstep( 0.0, 1.0, bloomhsv.y ), fBloomSaturationSmooth );
  2394. bloomhsv.y = pow( bloomhsv.y, fBloomSaturationCurve );
  2395. bloomhsv.y *= fBloomSaturationMult;
  2396. bloomhsv.z = lerp( bloomhsv.z, smoothstep( 0.0, 1.0, bloomhsv.z ), fBloomIntensitySmooth );
  2397. bloomhsv.z = pow( bloomhsv.z, fBloomIntensityCurve );
  2398. bloomhsv.z *= fBloomIntensityMult;
  2399. bloomhsv.z += fBloomIntensityMod;
  2400. bloomhsv.z = clamp( bloomhsv.z, 0.0, fBloomIntensityMax );
  2401. enbbloomcol.rgb = HSVtoRGB( bloomhsv );
  2402.  
  2403. #if(BLOOM_LERP == 1)
  2404. color.rgb = lerp( color.rgb, enbbloomcol.rgb, EBloomAmount );
  2405. #endif
  2406. #if(BLOOM_ADD == 1)
  2407. color.rgb += enbbloomcol.rgb * EBloomAmount;
  2408. #endif
  2409. #if(BLOOM_LERP == 0)
  2410. #if(BLOOM_ADD == 0)
  2411. color.rgb = max(color.xyz, enbbloomcol.xyz * EBloomAmount);
  2412. #endif
  2413. #endif
  2414.  
  2415. }
  2416. #endif
  2417.  
  2418.  
  2419. #if(DIFFUSE_BLOOM == 1)
  2420.  
  2421.  
  2422. xcolorbloom = tex2D( _s3, _v0.xy );
  2423.  
  2424.  
  2425. #if(BLOOM_DEFUZZ == 1)
  2426. // Heliosdouble cobbled together bloom defuzzer - increases contrast of bloom / stop it hazing low brightness values
  2427. // modulated by the overall brightness of the screen.
  2428.  
  2429. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  2430. xcolorbloom.xyz-=(mavg/3);
  2431. //xcolorbloom.xyz=min(xcolorbloom.xyz,0.0);
  2432. xcolorbloom.xyz+=(mavg*0.2);
  2433. xcolorbloom.xyz*(mavg*1.2);
  2434. #endif
  2435.  
  2436. #if( BLOOM_COLORIZATION == 1)
  2437. xcolorbloom.xyz*= lerp( lerp( diffbloommultDay, diffbloommultNight, JKNightDayFactor ), diffbloommultInterior, JKInteriorFactor );
  2438. xcolorbloom.xyz-= lerp( lerp( diffbloomsubDay, diffbloomsubNight, JKNightDayFactor ), diffbloomsubInterior, JKInteriorFactor );
  2439. xcolorbloom.xz*= lerp( lerp( diffMAGENTAbloomDay, diffMAGENTAbloomNight, JKNightDayFactor ), diffMAGENTAbloomInterior, JKInteriorFactor );
  2440. xcolorbloom.yz*= lerp( lerp( diffCYANbloomDay, diffCYANbloomNight, JKNightDayFactor ), diffCYANbloomInterior, JKInteriorFactor );
  2441. xcolorbloom.xy*= lerp( lerp( diffYELLOWbloomDay, diffYELLOWbloomNight, JKNightDayFactor ), diffYELLOWbloomInterior, JKInteriorFactor );
  2442. #endif
  2443. float Saturation = lerp( lerp( SatDay, SatNight, JKNightDayFactor ), SatInterior, JKInteriorFactor );
  2444. float Luma = lerp( lerp( LumaDay, LumaNight, JKNightDayFactor ), LumaInterior, JKInteriorFactor );
  2445. float Pow = lerp( lerp( PowDay, PowNight, JKNightDayFactor ), PowInterior, JKInteriorFactor );
  2446. float Pow2 = lerp( lerp( Pow2Day, Pow2Night, JKNightDayFactor ), Pow2Interior, JKInteriorFactor );
  2447.  
  2448. float3 cgray2=dot(xcolorbloom.xyz, Luma);
  2449. float3 poweredcolor2=pow(xcolorbloom.xyz, Saturation);
  2450. float newgray2=dot(poweredcolor2.xyz, Pow);
  2451. xcolorbloom.xyz=poweredcolor2.xyz*cgray2/(newgray2+Pow2);
  2452.  
  2453. color.xyz+=xcolorbloom.xyz*EBloomAmount;
  2454.  
  2455. #if( BLOOM_LERP == 1)
  2456. color.xyz = lerp( color.xyz, xcolorbloom.xyz, EBloomAmount );
  2457. #endif
  2458. #if( BLOOM_ADD == 1)
  2459. color.xyz += xcolorbloom.xyz * EBloomAmount;
  2460. #endif
  2461. #if(BLOOM_LERP == 0)
  2462. #if(BLOOM_ADD == 0)
  2463. color.xyz =max(color.xyz, xcolorbloom.xyz*EBloomAmount);
  2464. #endif
  2465. #endif
  2466. #endif
  2467.  
  2468. #if( HD6_BLOOM_CRISP == 1)
  2469.  
  2470.  
  2471. xcolorbloom = tex2D( _s3, _v0.xy );
  2472.  
  2473.  
  2474. float3 LumCoeff = lerp( LumCoeffInterior, ( lerp( LumCoeffNight, LumCoeffDay, JKNightDayFactor ) ), JKInteriorFactor);
  2475. float3 AvgLumin = lerp( AvgLuminInterior, ( lerp( AvgLuminNight, AvgLuminDay, JKNightDayFactor ) ), JKInteriorFactor);
  2476.  
  2477. #if( BLOOM_DEFUZZ == 1)
  2478. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  2479. xcolorbloom.xyz-=(mavg/3);
  2480. xcolorbloom.xyz+=(mavg*0.2);
  2481. xcolorbloom.xyz*(mavg*1.2);
  2482. #endif
  2483.  
  2484. #if( BLOOM_COLORIZATION == 1)
  2485. xcolorbloom.rgb*= lerp( lerp( crispbloommultDay, crispbloommultNight, JKNightDayFactor ), crispbloommultInterior, JKInteriorFactor );
  2486. xcolorbloom.rgb-= lerp( lerp( crispbloomsubDay, crispbloomsubNight, JKNightDayFactor ), crispbloomsubInterior, JKInteriorFactor );
  2487.  
  2488. xcolorbloom.rb*= lerp( lerp( crispMAGENTAbloomDay, crispMAGENTAbloomNight, JKNightDayFactor ), crispMAGENTAbloomInterior, JKInteriorFactor );
  2489. xcolorbloom.gb*= lerp( lerp( crispCYANbloomDay, crispCYANbloomNight, JKNightDayFactor ), crispCYANbloomInterior, JKInteriorFactor );
  2490. xcolorbloom.rg*= lerp( lerp( crispYELLOWbloomDay, crispYELLOWbloomNight, JKNightDayFactor ), crispYELLOWbloomInterior, JKInteriorFactor );
  2491. #endif
  2492.  
  2493. // Limits what triggers a bloom
  2494. float3 brightbloom = xcolorbloom - lerp( TrigInterior, ( lerp( TrigNight, TrigDay, JKNightDayFactor ) ), JKInteriorFactor);
  2495. brightbloom = max( brightbloom , 0);
  2496.  
  2497. // Limits bloom to superbright spots only
  2498. float3 superbright = xcolorbloom - lerp( SBrightInterior, ( lerp( SBrightNight, SBrightDay, JKNightDayFactor ) ), JKInteriorFactor);
  2499. superbright = max( superbright , 0 ) ; // crop so dont go any lower than black
  2500. //superbright = lerp( AvgLumin, superbright, 0.5); // Contrast
  2501. superbright *= 0.6;
  2502.  
  2503. // Bloom - Brightness, Contrast and Saturation
  2504. float3 brt = lerp( CBrightnessInterior, ( lerp( CBrightnessNight, CBrightnessDay, JKNightDayFactor ) ), JKInteriorFactor);
  2505. float3 con = lerp( CContrastInterior, ( lerp( CContrastNight, CContrastDay, JKNightDayFactor ) ), JKInteriorFactor);
  2506. float3 sat = lerp( CSaturationInterior, ( lerp( CSaturationNight, CSaturationDay, JKNightDayFactor ) ), JKInteriorFactor);
  2507. float3 brtColor = brightbloom * brt;
  2508. float3 cintensity = dot( brtColor, LumCoeff );
  2509. float3 satColor = lerp( cintensity, brtColor, sat );
  2510. float3 conColor = lerp( AvgLumin, satColor, con );
  2511. conColor -= 0.3;
  2512. brightbloom = conColor;
  2513.  
  2514. // These values compensates the brightness when no bloom is used
  2515. color.xyz += lerp( BrightnessModInterior, ( lerp( BrightnessModNight, BrightnessModDay, JKNightDayFactor ) ), JKInteriorFactor);
  2516. color.xyz *= lerp( BrightnessMultInterior, ( lerp( BrightnessMultNight, BrightnessMultDay, JKNightDayFactor ) ), JKInteriorFactor);
  2517.  
  2518. // Adds bloom while compensating for any brightness change
  2519. color.xyz += (( superbright * hbs ) * lerp( CompSBInterior, ( lerp( CompSBNight, CompSBDay, JKNightDayFactor ) ), JKInteriorFactor)); // Limits where the bloom will "bloom"
  2520. brightbloom -= ( superbright * 2 ); // removes superbright from brightbloom
  2521. brightbloom = max( brightbloom , 0.0 );
  2522. color.xyz += (( brightbloom * hbs ) * lerp( BloomStrInterior, ( lerp( BloomStrNight, BloomStrDay, JKNightDayFactor ) ), JKInteriorFactor)); // How strong the bloom will be
  2523.  
  2524. // This blends the the ENB and Skyrim bloom together, for a more hazey effect
  2525. color.xyz += (xcolorbloom.xyz * hbs) * lerp( BloomBlendInterior, ( lerp( BloomBlendNight, BloomBlendDay, JKNightDayFactor ) ), JKInteriorFactor); // How much the blend there will be
  2526. color.xyz *= lerp( BlendCompInterior, ( lerp( BlendCompNight, BlendCompDay, JKNightDayFactor ) ), JKInteriorFactor); // compensate for brightening caused by above bloom
  2527.  
  2528. #endif
  2529.  
  2530. #endif
  2531.  
  2532. /////////////////////////////////////////////////////////////////////////////////////////////////
  2533. ///HSV COLOR CODE////////////////////////////////////////////////////////////////////////////////
  2534. /////////////////////////////////////////////////////////////////////////////////////////////////
  2535.  
  2536. #if( HSV_CONTROLS == 1)
  2537. float fColorHueSmooth =lerp( lerp( fColorHueSmoothDay, fColorHueSmoothNight, JKNightDayFactor ), fColorHueSmoothInterior, JKInteriorFactor );
  2538. float fColorSaturationSmooth =lerp( lerp( fColorSaturationSmoothDay, fColorSaturationSmoothNight, JKNightDayFactor ), fColorSaturationSmoothInterior, JKInteriorFactor );
  2539. float fColorIntensitySmooth =lerp( lerp( fColorIntensitySmoothDay, fColorIntensitySmoothNight, JKNightDayFactor ), fColorIntensitySmoothInterior, JKInteriorFactor );
  2540.  
  2541. float fColorHueCurve =lerp( lerp( fColorHueCurveDay, fColorHueCurveNight, JKNightDayFactor ), fColorHueCurveInterior, JKInteriorFactor );
  2542. float fColorSaturationCurve =lerp( lerp( fColorSaturationCurveDay, fColorSaturationCurveNight, JKNightDayFactor ), fColorSaturationCurveInterior, JKInteriorFactor );
  2543. float fColorIntensityCurve =lerp( lerp( fColorIntensityCurveDay, fColorIntensityCurveNight, JKNightDayFactor ), fColorIntensityCurveInterior, JKInteriorFactor );
  2544.  
  2545. float fColorHueMult =lerp( lerp( fColorHueMultDay, fColorHueMultNight, JKNightDayFactor ), fColorHueMultInterior, 1.0 - JKInteriorFactor );
  2546. float fColorSaturationMult =lerp( lerp( fColorSaturationMultDay, fColorSaturationMultNight, JKNightDayFactor ), fColorSaturationMultInterior, JKInteriorFactor );
  2547. float fColorIntensityMult =lerp( lerp( fColorIntensityMultDay, fColorIntensityMultNight, JKNightDayFactor ), fColorIntensityMultInterior, JKInteriorFactor );
  2548.  
  2549. float fColorHueMod =lerp( lerp( fColorHueModDay, fColorHueModNight, JKNightDayFactor ), fColorHueModInterior, JKInteriorFactor );
  2550. float fColorSaturationMod =lerp( lerp( fColorSaturationModDay, fColorSaturationModNight, JKNightDayFactor ), fColorSaturationModInterior, JKInteriorFactor );
  2551. float fColorIntensityMod =lerp( lerp( fColorIntensityModDay, fColorIntensityModNight, JKNightDayFactor ), fColorIntensityModInterior, JKInteriorFactor );
  2552.  
  2553. float3 hsvcolor = RGBtoHSV( color.xyz );
  2554. hsvcolor.x = lerp( hsvcolor.x, smoothstep( 0.0, 1.0, hsvcolor.x ), fColorHueSmooth );
  2555. hsvcolor.y = lerp( hsvcolor.y, smoothstep( 0.0, 1.0, hsvcolor.y ), fColorSaturationSmooth );
  2556. hsvcolor.z = lerp( hsvcolor.z, smoothstep( 0.0, 1.0, hsvcolor.z ), fColorIntensitySmooth );
  2557. hsvcolor.x = pow( hsvcolor.x, fColorHueCurve );
  2558. hsvcolor.y = pow( hsvcolor.y, fColorSaturationCurve );
  2559. hsvcolor.z = pow( hsvcolor.z, fColorIntensityCurve );
  2560. hsvcolor.x = fColorHueMod + ( fColorHueMult * hsvcolor.x );
  2561. hsvcolor.y = fColorSaturationMod + ( fColorSaturationMult * hsvcolor.y );
  2562. hsvcolor.z = fColorIntensityMod + ( fColorIntensityMult * hsvcolor.z );
  2563.  
  2564. #if( HSV_EQUALIZER == 1)
  2565. hsvcolor.y = ColorEqualizerMod( hsvcolor.x, JKNightDayFactor, JKInteriorFactor ) + ( ColorEqualizerMult( hsvcolor.x, JKNightDayFactor, JKInteriorFactor ) * hsvcolor.y );
  2566. #endif
  2567.  
  2568. color.xyz = HSVtoRGB( hsvcolor );
  2569. #endif
  2570.  
  2571. #if( COLOR_FILTER == 1)
  2572. float3 EColorFilter =lerp( lerp( EColorFilterDay, EColorFilterNight, JKNightDayFactor ), EColorFilterInterior, JKInteriorFactor );
  2573.  
  2574. EColorFilter.xyz-= lerp( lerp( EColorFilterSubDay, EColorFilterSubNight, JKNightDayFactor ), EColorFilterSubInterior, JKInteriorFactor );
  2575.  
  2576. EColorFilter.xz*= lerp( lerp( MAGENTADay, MAGENTANight, JKNightDayFactor ), MAGENTAInterior, JKInteriorFactor );
  2577. EColorFilter.yz*= lerp( lerp( CYANDay, CYANNight, JKNightDayFactor ), CYANInterior, JKInteriorFactor );
  2578. EColorFilter.xy*= lerp( lerp( YELLOWDay, YELLOWNight, JKNightDayFactor ), YELLOWInterior, JKInteriorFactor );
  2579.  
  2580. EColorFilter.xz-= lerp( lerp( MAGENTAsubDay, MAGENTAsubNight, JKNightDayFactor ), MAGENTAsubInterior, JKInteriorFactor );
  2581. EColorFilter.yz-= lerp( lerp( CYANsubDay, CYANsubNight, JKNightDayFactor ), CYANsubInterior, JKInteriorFactor );
  2582. EColorFilter.xy-= lerp( lerp( YELLOWsubDay, YELLOWsubNight, JKNightDayFactor ), YELLOWsubInterior, JKInteriorFactor );
  2583.  
  2584. color.xyz*=EColorFilter;
  2585. #endif
  2586.  
  2587. /////////////////////////////////////////////////////////////////////////////////////////////////
  2588. ///BLEACH BYPASS CODE////////////////////////////////////////////////////////////////////////////
  2589. /////////////////////////////////////////////////////////////////////////////////////////////////
  2590.  
  2591. #if(BLEACH_BYPASS == 1)
  2592. float3 bleachBypassAmountRGB = lerp( lerp( BleachBypassAmountRGBDay, BleachBypassAmountRGBNight, JKNightDayFactor), BleachBypassAmountRGBInt, JKInteriorFactor);
  2593.  
  2594. float lum = saturate(Luminance(color.xyz));
  2595. float L = min(1,max(0,10*(lum- 0.45)));
  2596. float3 result1 = 2.0f * color.rgb * L;
  2597. float3 result2 = 1.0f - 2.0f*(1.0f-L)*(1.0f-color.rgb);
  2598. float3 newColor = lerp(result1,result2,L);
  2599. color.rgb = lerp(color.rgb, newColor.rgb, bleachBypassAmountRGB.rgb);
  2600. #endif
  2601.  
  2602. /////////////////////////////////////////////////////////////////////////////////////////////////
  2603. ///VIGNETTE CODE/////////////////////////////////////////////////////////////////////////////////
  2604. /////////////////////////////////////////////////////////////////////////////////////////////////
  2605.  
  2606. #if( HD6_VIGNETTE == 1)
  2607. // yes this is my own crazy creation after seing how boring the usual linear circle vignettes typically are
  2608. // no doubt I have done it in an overly convoluted way :-)
  2609.  
  2610. //float fExposureLevel = 1.0; // compensate for any change from vignette so center is same brightness
  2611. float2 inTex = _v0;
  2612. float4 voriginal = r1;
  2613. float4 vcolor = voriginal;
  2614. vcolor.xyz=1;
  2615. inTex -= 0.5; // Centers vignette
  2616. inTex.y += 0.01; // Move it off center and up so it obscures sky less
  2617. float vignette = 1.0 - dot( inTex, inTex );
  2618. vcolor *= pow( vignette, vignettepow );
  2619.  
  2620. // Round Vignette
  2621. float4 rvigtex = vcolor;
  2622. rvigtex.xyz = pow( vcolor, 1 );
  2623. rvigtex.xyz = lerp(float3(0.5, 0.5, 0.5), rvigtex.xyz, 2.0); // Increase Contrast
  2624. rvigtex.xyz = lerp(float3(1,1,1),rvigtex.xyz,rovigpwr); // Set strength of round vignette
  2625.  
  2626. // Square Vignette (just top and bottom of screen)
  2627. float4 vigtex = vcolor;
  2628. vcolor.xyz = float3(1,1,1);
  2629. float3 topv = min((inTex.y+0.5)*2,0.5) * 2; // Top vignette
  2630. float3 botv = min(((0-inTex.y)+0.5)*2,0.5) * 2; // Bottom vignette
  2631.  
  2632. topv= lerp(float3(1,1,1), topv, sqvigpwr.x);
  2633. botv= lerp(float3(1,1,1), botv, sqvigpwr.y);
  2634. vigtex.xyz = (topv)*(botv);
  2635.  
  2636. //vigtex.xyz = lerp(float3(1,1,1),vigtex.xyz,sqvigpwr); // Set strength of square vignette
  2637.  
  2638. // Add round and square together
  2639. vigtex.xyz*=rvigtex.xyz;
  2640. float3 nvigtex = lerp(vigtex.xyz,1,(1-vstrengthinterior)*(1-ji)); // Alter Strength at night
  2641. vigtex.xyz = lerp(vigtex.xyz,1,(1-vstrengthatnight)*(1-vhnd)); // Alter Strength at night
  2642.  
  2643. vigtex.xyz = lerp(vigtex.xyz, nvigtex.xyz, 1-ji);
  2644.  
  2645. vigtex.xyz = min(vigtex.xyz,1);
  2646. vigtex.xyz = max(vigtex.xyz,0);
  2647. //vigtex.xyz -= 0.5;
  2648. //(base < 0.5 ? (2.0 * base * blend) : (1.0 - 2.0 * (1.0 - base) * (1.0 - blend)))
  2649. //vigtex.xyz = vigtex.xyz < 0.5 ? (2.0 * color.xyz * vigtex.xyz) : (1 - 2 * (1 - color.xyz) * (1 - vigtex.xyz));
  2650. // Crap I keep forgetting overlay mode doesnt work in floating point/32bit/hdr dur bee durr
  2651.  
  2652. // Increase saturation where edges were darkenned
  2653. float3 vtintensity = dot(color.xyz, float3(0.2125, 0.7154, 0.0721));
  2654. color.xyz = lerp(vtintensity, color.xyz, ((((1-(vigtex.xyz*2))+2)-1)*vsatstrength)+1 );
  2655.  
  2656. //color.xyz+=0.02;
  2657. color.xyz *= (vigtex.xyz);
  2658. //color.xyz *= fExposureLevel;
  2659.  
  2660. #endif
  2661.  
  2662. #if( MT_VIGNETTE == 1)
  2663. float2 fVignetteCenter =lerp( lerp( fVignetteCenterDay, fVignetteCenterNight, JKNightDayFactor ), fVignetteCenterInterior, JKInteriorFactor );
  2664. float2 fVignetteScale =lerp( lerp( fVignetteScaleDay, fVignetteScaleNight, JKNightDayFactor ), fVignetteScaleInterior, JKInteriorFactor );
  2665. float fVignetteRadius =lerp( lerp( fVignetteRadiusDay, fVignetteRadiusNight, JKNightDayFactor ), fVignetteRadiusInterior, JKInteriorFactor );
  2666. float fVignetteSharpness =lerp( lerp( fVignetteSharpnessDay, fVignetteSharpnessNight, JKNightDayFactor ), fVignetteSharpnessInterior, JKInteriorFactor );
  2667. float fVignetteCurve =lerp( lerp( fVignetteCurveDay, fVignetteCurveNight, JKNightDayFactor ), fVignetteCurveInterior, JKInteriorFactor );
  2668.  
  2669. float2 VignettePosition = ( _v0.xy - fVignetteCenter ) * float2( ScreenSize.z, 1.0 );
  2670. VignettePosition /= fVignetteScale;
  2671. float VignetteDistance = distance( VignettePosition, float2(0.0 , 0.0) );
  2672. float VignetteEffect = max( 0.0, ( VignetteDistance - fVignetteRadius ) * fVignetteSharpness * 50.0 );
  2673. color.rgb *= max( 0.0, min( 1.0, 1.0 - pow( VignetteEffect, fVignetteCurve ) ) );
  2674. #endif
  2675.  
  2676.  
  2677. /////////////////////////////////////////////////////////////////////////////////////////////////
  2678. ///POSTPROCESSING METHODS////////////////////////////////////////////////////////////////////////
  2679. /////////////////////////////////////////////////////////////////////////////////////////////////
  2680.  
  2681.  
  2682.  
  2683. //Post Processing 0 by JawZ//////////////////////////////////////////////////////////////////
  2684.  
  2685. #if (POSTPROCESS==0)
  2686.  
  2687. float EBrightnessV0 = lerp( lerp( EBrightnessV0Day, EBrightnessV0Night, JKNightDayFactor ), EBrightnessV0Interior, JKInteriorFactor );
  2688. float EContrastV0 =lerp( lerp( EContrastV0Day, EContrastV0Night, JKNightDayFactor ), EContrastV0Interior, JKInteriorFactor );
  2689. float EColorSaturationV0 =lerp( lerp( EColorSaturationV0Day, EColorSaturationV0Night, JKNightDayFactor ), EColorSaturationV0Interior, JKInteriorFactor );
  2690. #if( ENABLE_TONEMAPPING == 1)
  2691. float EToneMappingCurveV0 =lerp( lerp( EToneMappingCurveV0Day, EToneMappingCurveV0Night, JKNightDayFactor ), EToneMappingCurveV0Interior, JKInteriorFactor );
  2692. #endif
  2693. color.xyz*=(EBrightnessV0);
  2694. float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
  2695. cgray=pow(cgray, EContrastV0);
  2696. float3 poweredcolor=pow(color.xyz, EColorSaturationV0);
  2697. float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
  2698. color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  2699. #if( ENABLE_TONEMAPPING == 1)
  2700. float3 luma=color.xyz;
  2701. float lumamax=300.0;
  2702. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV0);
  2703. #endif
  2704. #endif
  2705.  
  2706. //Post Processing 1 by ENB//////////////////////////////////////////////////////////////////
  2707.  
  2708. #if (POSTPROCESS==1)
  2709.  
  2710. float EAdaptationMinV1 =lerp( lerp( EAdaptationMinV1Day, EAdaptationMinV1Night, JKNightDayFactor ), EAdaptationMinV1Interior, JKInteriorFactor );
  2711. float EAdaptationMaxV1 =lerp( lerp( EAdaptationMaxV1Day, EAdaptationMaxV1Night, JKNightDayFactor ), EAdaptationMaxV1Interior, JKInteriorFactor );
  2712. float EContrastV1 =lerp( lerp( EContrastV1Day, EContrastV1Night, JKNightDayFactor ), EContrastV1Interior, JKInteriorFactor );
  2713. float EColorSaturationV1 =lerp( lerp( EColorSaturationV1Day, EColorSaturationV1Night, JKNightDayFactor ), EColorSaturationV1Interior, JKInteriorFactor );
  2714. float EToneMappingCurveV1 =lerp( lerp( EToneMappingCurveV1Day, EToneMappingCurveV1Night, JKNightDayFactor ), EToneMappingCurveV1Interior, JKInteriorFactor );
  2715.  
  2716. grayadaptation=max(grayadaptation, 0.0);
  2717. grayadaptation=min(grayadaptation, 50.0);
  2718. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV1+EAdaptationMinV1);//*tempF1.x
  2719.  
  2720. float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
  2721. cgray=pow(cgray, EContrastV1);
  2722. float3 poweredcolor=pow(color.xyz, EColorSaturationV1);
  2723. float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
  2724. color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  2725.  
  2726. float3 luma=color.xyz;
  2727. float lumamax=300.0;
  2728. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
  2729. #endif
  2730.  
  2731. //Post Processing 2 by ENB modified by JawZ//////////////////////////////////////////////////////////////////
  2732.  
  2733. #if (POSTPROCESS==2)
  2734.  
  2735. float EAdaptationMaxV2 =lerp( lerp( EAdaptationMaxV2Day, EAdaptationMaxV2Night, JKNightDayFactor ), EAdaptationMaxV2Interior, JKInteriorFactor );
  2736. float EAdaptationMinV2 =lerp( lerp( EAdaptationMinV2Day, EAdaptationMinV2Night, JKNightDayFactor ), EAdaptationMinV2Interior, JKInteriorFactor );
  2737. float EBrightnessV2 = lerp( lerp( EBrightnessV2Day, EBrightnessV2Night, JKNightDayFactor ), EBrightnessV2Interior, JKInteriorFactor );
  2738. float EIntensityContrastV2 =lerp( lerp( EIntensityContrastV2Day, EIntensityContrastV2Night, JKNightDayFactor ), EIntensityContrastV2Interior, JKInteriorFactor );
  2739. float EColorSaturationV2 =lerp( lerp( EColorSaturationV2Day, EColorSaturationV2Night, JKNightDayFactor ), EColorSaturationV2Interior, JKInteriorFactor );
  2740. float EBrightnessCurveV2 = lerp( lerp( EBrightnessCurveV2Day, EBrightnessCurveV2Night, JKNightDayFactor ), EBrightnessCurveV2Interior, JKInteriorFactor );
  2741. float EBrightnessPostCurveV2 = lerp( lerp( EBrightnessPostCurveV2Day, EBrightnessPostCurveV2Night, JKNightDayFactor ), EBrightnessPostCurveV2Interior, JKInteriorFactor );
  2742. float EToneMappingCurveV2 =lerp( lerp( EToneMappingCurveV2Day, EToneMappingCurveV2Night, JKNightDayFactor ), EToneMappingCurveV2Interior, JKInteriorFactor );
  2743. float EToneMappingOversaturationV2 =lerp( lerp( EToneMappingOversaturationV2Day, EToneMappingOversaturationV2Night, JKNightDayFactor ), EToneMappingOversaturationV2Interior, JKInteriorFactor );
  2744.  
  2745. grayadaptation=max(grayadaptation, 0.0);
  2746. grayadaptation=min(grayadaptation, 50.0);
  2747. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV2+EAdaptationMinV2);//*tempF1.x
  2748.  
  2749. color.xyz*=(EBrightnessV2);
  2750. color.xyz+=0.000001;
  2751. float3 xncol=normalize(color.xyz);
  2752. float3 scl=color.xyz/xncol.xyz;
  2753. scl=pow(scl, EIntensityContrastV2);
  2754. xncol.xyz=pow(xncol.xyz, EColorSaturationV2);
  2755. color.xyz=scl*xncol.xyz;
  2756. color.xyz=pow(color.xyz, EBrightnessCurveV2);
  2757. color.xyz*=(EBrightnessPostCurveV2);
  2758.  
  2759. float lumamax=EToneMappingOversaturationV2;
  2760. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV2);
  2761. #endif
  2762.  
  2763. //Post Processing 3 by ENB//////////////////////////////////////////////////////////////////
  2764.  
  2765. #if (POSTPROCESS==3)
  2766.  
  2767. float EAdaptationMaxV3 =lerp( lerp( EAdaptationMaxV3Day, EAdaptationMaxV3Night, JKNightDayFactor ), EAdaptationMaxV3Interior, JKInteriorFactor );
  2768. float EAdaptationMinV3 =lerp( lerp( EAdaptationMinV3Day, EAdaptationMinV3Night, JKNightDayFactor ), EAdaptationMinV3Interior, JKInteriorFactor );
  2769. float EToneMappingOversaturationV3 =lerp( lerp( EToneMappingOversaturationV3Day, EToneMappingOversaturationV3Night, JKNightDayFactor ), EToneMappingOversaturationV3Interior, JKInteriorFactor );
  2770. float EToneMappingCurveV3 =lerp( lerp( EToneMappingCurveV3Day, EToneMappingCurveV3Night, JKNightDayFactor ), EToneMappingCurveV3Interior, JKInteriorFactor );
  2771.  
  2772. grayadaptation=max(grayadaptation, 0.0);
  2773. grayadaptation=min(grayadaptation, 50.0);
  2774. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV3+EAdaptationMinV3);//*tempF1.x
  2775.  
  2776. float lumamax=EToneMappingOversaturationV3;
  2777. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
  2778.  
  2779. #endif
  2780.  
  2781. //Post Processing 4 by ENB//////////////////////////////////////////////////////////////////
  2782.  
  2783. #if (POSTPROCESS==4)
  2784.  
  2785. float EAdaptationMaxV4 =lerp( lerp( EAdaptationMaxV4Day, EAdaptationMaxV4Night, JKNightDayFactor ), EAdaptationMaxV4Interior, JKInteriorFactor );
  2786. float EAdaptationMinV4 =lerp( lerp( EAdaptationMinV4Day, EAdaptationMinV4Night, JKNightDayFactor ), EAdaptationMinV4Interior, JKInteriorFactor );
  2787. float EBrightnessCurveV4 =lerp( lerp( EBrightnessCurveV4Day, EBrightnessCurveV4Night, JKNightDayFactor ), EBrightnessCurveV4Interior, JKInteriorFactor );
  2788. float EBrightnessMultiplierV4 =lerp( lerp( EBrightnessMultiplierV4Day, EBrightnessMultiplierV4Night, JKNightDayFactor ), EBrightnessMultiplierV4Interior, JKInteriorFactor );
  2789. float EBrightnessToneMappingCurveV4 =lerp( lerp( EBrightnessToneMappingCurveV4Day, EBrightnessToneMappingCurveV4Night, JKNightDayFactor ), EBrightnessToneMappingCurveV4Interior, JKInteriorFactor );
  2790.  
  2791. grayadaptation=max(grayadaptation, 0.0);
  2792. grayadaptation=min(grayadaptation, 50.0);
  2793. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV4+EAdaptationMinV4);
  2794.  
  2795. float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
  2796. float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  2797. float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  2798. Y=pow(Y, EBrightnessCurveV4);
  2799. Y=Y*EBrightnessMultiplierV4;
  2800. // Y=Y/(Y+EBrightnessToneMappingCurveV4);
  2801. // float desaturatefact=saturate(Y*Y*Y*1.7);
  2802. // U=lerp(U, 0.0, desaturatefact);
  2803. // V=lerp(V, 0.0, desaturatefact);
  2804. color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  2805.  
  2806. color.xyz=max(color.xyz, 0.0);
  2807. color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
  2808. #endif
  2809.  
  2810. //Post Processing 5 by HD6 modified by JawZ//////////////////////////////////////////////////////////////////
  2811.  
  2812. #if (POSTPROCESS==5)
  2813.  
  2814. // float EBrightnessV5 =lerp( lerp( EBrightnessV5Day, EBrightnessV5Night, JKNightDayFactor ), EBrightnessV5Interior, JKInteriorFactor );
  2815. float EIntensityContrastV5 =lerp( lerp( EIntensityContrastV5Day, EIntensityContrastV5Night, JKNightDayFactor ), EIntensityContrastV5Interior, JKInteriorFactor );
  2816. float EColorSaturationV5 =lerp( lerp( EColorSaturationV5Day, EColorSaturationV5Night, JKNightDayFactor ), EColorSaturationV5Interior, JKInteriorFactor );
  2817. float HCompensateSatV5 =lerp( lerp( HCompensateSatV5Day, HCompensateSatV5Night, JKNightDayFactor ), HCompensateSatV5Interior, JKInteriorFactor );
  2818. float EToneMappingCurveV5 =lerp( lerp( EToneMappingCurveV5Day, EToneMappingCurveV5Night, JKNightDayFactor ), EToneMappingCurveV5Interior, JKInteriorFactor );
  2819.  
  2820. grayadaptation=max(grayadaptation, 0.0);
  2821. grayadaptation=min(grayadaptation, 50.0);
  2822. //color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV5+EAdaptationMinV5); //*tempF1.x // JZ - This is the original dynamic adaptation code.
  2823. color.xyz*=lerp( lerp( JKNightDayFactortweak.x, JKNightDayFactortweak.y, JKNightDayFactor ), JKNightDayFactortweak.z, JKInteriorFactor );
  2824.  
  2825. //color.xyz*=EBrightnessV5; // JZ - If you want to have a assigned brightness command to PP5
  2826. //color.xyz+=0.000001;
  2827. float3 xncol=normalize(color.xyz);
  2828. float3 scl=color.xyz/xncol.xyz;
  2829. scl=pow(scl, EIntensityContrastV5);
  2830. xncol.xyz=pow(xncol.xyz, EColorSaturationV5);
  2831. color.xyz=scl*xncol.xyz;
  2832. color.xyz*=HCompensateSatV5; // compensate for darkening caused my EcolorSat above
  2833.  
  2834. //float lumamax=EToneMappingOversaturationV5;
  2835. //color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV5);
  2836.  
  2837. color.xyz=color.xyz/(color.xyz + EToneMappingCurveV5);
  2838. //color.xyz=tex2D(_s0, _v0.xy);
  2839. //color.xyz=color.xyz-0.03; // JZ - Try using either *, + or / instead of -
  2840. //color.xyz/=10; // JZ - Try using either *, + or - instead of / and set it to 0.1
  2841. #endif
  2842.  
  2843. //Post Processing 6 by Kermles//////////////////////////////////////////////////////////////////
  2844.  
  2845. #if (POSTPROCESS==6)
  2846.  
  2847. //hd6/ppv2///////////////////////////////////////////
  2848. float EIntensityContrastV6 = lerp( lerp( EIntensityContrastV6Day, EIntensityContrastV6Night, JKNightDayFactor), EIntensityContrastV6Interior, JKInteriorFactor );
  2849. float EColorSaturationV6 = lerp( lerp( EColorSaturationV6Day, EColorSaturationV6Night, JKNightDayFactor), EColorSaturationV6Interior, JKInteriorFactor );
  2850. float EToneMappingCurveV6 = lerp( lerp( EToneMappingCurveV6Day, EToneMappingCurveV6Night, JKNightDayFactor), EToneMappingCurveV6Interior, JKInteriorFactor );
  2851. float EBrightnessV6 = lerp( lerp( EBrightnessV6Day, EBrightnessV6Night, JKNightDayFactor), EBrightnessV6Interior, JKInteriorFactor );
  2852. float EToneMappingOversaturationV6= lerp( lerp( EToneMappingOversaturationV6Day, EToneMappingOversaturationV6Night, JKNightDayFactor), EToneMappingOversaturationV6Interior, JKInteriorFactor );
  2853. float EAdaptationMaxV6 = lerp( lerp( EAdaptationMaxV6Day, EAdaptationMaxV6Night, JKNightDayFactor ), EAdaptationMaxV6Interior, JKInteriorFactor );
  2854. float EAdaptationMinV6 = lerp( lerp( EAdaptationMinV6Day, EAdaptationMinV6Night, JKNightDayFactor ), EAdaptationMinV6Interior, JKInteriorFactor );
  2855. float lumamax = EToneMappingOversaturationV6;
  2856. float3 xncol;
  2857. float3 scl;
  2858. //kermles////////////////////////////////////////////
  2859. float3 moodColor = float3(lerp( lerp( EMoodColorDay.x, EMoodColorNight.x, JKNightDayFactor), EMoodColorInt.x, JKInteriorFactor), lerp( lerp( EMoodColorDay.y, EMoodColorNight.y, JKNightDayFactor), EMoodColorInt.y, JKInteriorFactor),lerp( lerp( EMoodColorDay.z, EMoodColorNight.z, JKNightDayFactor), EMoodColorInt.z, JKInteriorFactor));
  2860. float moodAmount = lerp( lerp( EMoodAmountDay, EMoodAmountNight, JKNightDayFactor), EMoodAmountInt, JKInteriorFactor);
  2861. float moodThreshold = lerp( lerp( EMoodThresholdDay, EMoodThresholdNight, JKNightDayFactor), EMoodThresholdInt, JKInteriorFactor);
  2862. float moodCurve = lerp( lerp( EMoodCurveDay, EMoodCurveNight, JKNightDayFactor), EMoodCurveInt, JKInteriorFactor);
  2863. float3 shadowColor = float3(lerp( lerp( EShadowColorDay.x, EShadowColorNight.x, JKNightDayFactor), EShadowColorInt.x, JKInteriorFactor), lerp( lerp( EShadowColorDay.y, EShadowColorNight.y, JKNightDayFactor), EShadowColorInt.y, JKInteriorFactor),lerp( lerp( EShadowColorDay.z, EShadowColorNight.z, JKNightDayFactor), EShadowColorInt.z, JKInteriorFactor));
  2864. float shadowThreshold = lerp( lerp( EShadowThresholdDay, EShadowThresholdNight, JKNightDayFactor), EShadowThresholdInt, JKInteriorFactor);
  2865. float shadowAmount = lerp( lerp( EShadowAmountDay, EShadowAmountNight, JKNightDayFactor), EShadowAmountInt, JKInteriorFactor);
  2866. float shadowCurve = lerp( lerp( EShadowCurveDay, EShadowCurveNight, JKNightDayFactor), EShadowCurveInt, JKInteriorFactor);
  2867. float3 brightSpotColor = float3(lerp( lerp( EBrightSpotColorDay.x, EBrightSpotColorNight.x, JKNightDayFactor), EBrightSpotColorInt.x, JKInteriorFactor), lerp( lerp( EBrightSpotColorDay.y, EBrightSpotColorNight.y, JKNightDayFactor), EBrightSpotColorInt.y, JKInteriorFactor),lerp( lerp( EBrightSpotColorDay.z, EBrightSpotColorNight.z, JKNightDayFactor), EBrightSpotColorInt.z, JKInteriorFactor));
  2868. float brightSpotAmount = lerp( lerp( EBrightSpotAmountDay, EBrightSpotAmountNight, JKNightDayFactor), EBrightSpotAmountInt, JKInteriorFactor);
  2869. float brightSpotThreshold = lerp( lerp( EBrightSpotThresholdDay, EBrightSpotThresholdNight, JKNightDayFactor), EBrightSpotThresholdInt, JKInteriorFactor);
  2870. float brightSpotCurve = lerp( lerp( EBrightSpotCurveDay, EBrightSpotCurveNight, JKNightDayFactor), EBrightSpotCurveInt, JKInteriorFactor);
  2871. float EFinalContrastV6 = lerp( lerp( EFinalContrastV6Day, EFinalContrastV6Night, JKNightDayFactor), EFinalContrastV6Interior, JKInteriorFactor );
  2872. float EFinalExposureV6 = lerp( lerp( EFinalExposureV6Day, EFinalExposureV6Night, JKNightDayFactor), EFinalExposureV6Interior, JKInteriorFactor );
  2873. float PPAmount = 1.0; //controls interpolation between vanilla colors and PP6 colors
  2874. float avgbr;
  2875. float4 ncolor;
  2876. float4 oldcolor;
  2877. float3 hsvncolor;
  2878.  
  2879. grayadaptation = clamp(grayadaptation, 0, 50);
  2880. //store vanilla colors//////////////////////////////////////////
  2881. oldcolor = color;
  2882. //ppv2 modified by kermles//////////////////////////////////////
  2883. xncol = normalize(color.xyz);
  2884. scl = color.xyz/xncol.xyz;
  2885. xncol.xyz = pow(xncol.xyz, EColorSaturationV6);
  2886. color.xyz = scl*xncol.xyz;
  2887. color.xyz = pow(color, 1.0 / EBrightnessV6);
  2888. //convert to linear colorspace//////////////////////////////////
  2889. color.r = 1.0/(1.0+color.r);
  2890. color.g = 1.0/(1.0+color.g);
  2891. color.b = 1.0/(1.0+color.b);
  2892. //contrast//////////////////////////////////////////////////////
  2893. color.xyz = pow(color, EIntensityContrastV6) / (pow(color, EIntensityContrastV6) + pow((1.0 - color), EIntensityContrastV6));
  2894. //restore dynamic range/////////////////////////////////////////
  2895. color.r = (1.0/color.r)-1.0;
  2896. color.g = (1.0/color.g)-1.0;
  2897. color.b = (1.0/color.b)-1.0;
  2898. //tonemapping///////////////////////////////////////////////////
  2899. color.xyz = (color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV6);
  2900. #if( PRE_COLORATION == 1)
  2901. //mood coloring/////////////////////////////////////////////////
  2902. ncolor = color;
  2903. avgbr = Luminance(color.xyz);
  2904. moodColor = lerp(0.0, moodColor, saturate(avgbr*2));
  2905. moodColor = lerp(moodColor, 1, saturate(avgbr-0.5)*2);
  2906. ncolor.xyz = lerp(ncolor, moodColor, saturate(pow(avgbr, moodCurve + ((ncolor)*(1-moodColor)) / moodThreshold)));
  2907. color.xyz = lerp(color, ncolor, moodAmount);
  2908. //shadows///////////////////////////////////////////////////////
  2909. ncolor = color;
  2910. avgbr = Luminance(color.xyz);
  2911. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0+ncolor)* (2.55-shadowColor))*shadowThreshold)/shadowCurve);
  2912. #if( SHADOW_USE_ADDITION == 1)
  2913. color.xyz += ncolor*shadowAmount;
  2914. #else
  2915. color.xyz = lerp(color, max(color, ncolor), shadowAmount);
  2916. #endif
  2917. //brightspots///////////////////////////////////////////////////
  2918. avgbr = Luminance(color.xyz);
  2919. #if( BRIGHTSPOT_IGNORE_WHITES == 1)
  2920. brightSpotColor = lerp(0.0, brightSpotColor, saturate(avgbr*2));
  2921. brightSpotColor = lerp(brightSpotColor, 1, saturate(avgbr-0.5)*2);
  2922. #endif
  2923. ncolor = 1-color;
  2924. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0 + ncolor) * (brightSpotColor))*brightSpotThreshold)/brightSpotCurve);
  2925. color.xyz = lerp(color, 1-ncolor, brightSpotAmount);
  2926. #endif
  2927. //adaptation////////////////////////////////////////////////////
  2928. color.xyz /= (grayadaptation*EAdaptationMaxV6+EAdaptationMinV6);
  2929. #if( POST_COLORATION == 1)
  2930. //mood coloring/////////////////////////////////////////////////
  2931. ncolor = color;
  2932. avgbr = Luminance(color.xyz);
  2933. moodColor = lerp(0.0, moodColor, saturate(avgbr*2));
  2934. moodColor = lerp(moodColor, 1, saturate(avgbr-0.5)*2);
  2935. ncolor.xyz = lerp(ncolor, moodColor, saturate(pow(avgbr, moodCurve + ((ncolor)*(1-moodColor)) / moodThreshold)));
  2936. color.xyz = lerp(color, ncolor, moodAmount);
  2937. //shadows///////////////////////////////////////////////////////
  2938. ncolor = color;
  2939. avgbr = Luminance(color.xyz);
  2940. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0+ncolor)* (2.55-shadowColor))*shadowThreshold)/shadowCurve);
  2941. #if( SHADOW_USE_ADDITION == 1)
  2942. color.xyz += ncolor*shadowAmount;
  2943. #else
  2944. color.xyz = lerp(color, max(color, ncolor), shadowAmount);
  2945. #endif
  2946. //brightspots///////////////////////////////////////////////////
  2947. avgbr = Luminance(color.xyz);
  2948. #if( BRIGHTSPOT_IGNORE_WHITES == 1)
  2949. brightSpotColor = lerp(0.0, brightSpotColor, saturate(avgbr*2));
  2950. brightSpotColor = lerp(brightSpotColor, 1, saturate(avgbr-0.5)*2);
  2951. #endif
  2952. ncolor = 1-color;
  2953. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0 + ncolor) * (brightSpotColor))*brightSpotThreshold)/brightSpotCurve);
  2954. color.xyz = lerp(color, 1-ncolor, brightSpotAmount);
  2955. #endif
  2956. //dpeasant contrast code////////////////////////////////////////
  2957. color.xyz = lerp(color.xyz, 0.5 * (1 + sin((color.xyz - 0.5)*3.1415926)), EFinalContrastV6);
  2958. //dpeasant exposure code////////////////////////////////////////
  2959. color.rgb *= pow(2.0f, EFinalExposureV6);
  2960. //lerp between vanilla and pp6 colors///////////////////////////
  2961. color = lerp(oldcolor, color, PPAmount);
  2962. #endif
  2963.  
  2964. //Post Processing 7 by Kermles//////////////////////////////////////////////////////////////////
  2965.  
  2966. #if (POSTPROCESS==7)
  2967. //hd6/ppv2///////////////////////////////////////////
  2968. float EIntensityContrastV7 = lerp( lerp( EIntensityContrastV7Day, EIntensityContrastV7Night, JKNightDayFactor), EIntensityContrastV7Interior, JKInteriorFactor );
  2969. float EColorSaturationV7 = lerp( lerp( EColorSaturationV7Day, EColorSaturationV7Night, JKNightDayFactor), EColorSaturationV7Interior, JKInteriorFactor );
  2970. float EToneMappingCurveV7 = lerp( lerp( EToneMappingCurveV7Day, EToneMappingCurveV7Night, JKNightDayFactor), EToneMappingCurveV7Interior, JKInteriorFactor );
  2971. float EBrightnessV7 = lerp( lerp( EBrightnessV7Day, EBrightnessV7Night, JKNightDayFactor), EBrightnessV7Interior, JKInteriorFactor );
  2972. float EToneMappingOversaturationV7= lerp( lerp( EToneMappingOversaturationV7Day, EToneMappingOversaturationV7Night, JKNightDayFactor), EToneMappingOversaturationV7Interior, JKInteriorFactor );
  2973. float EAdaptationMaxV7 = lerp( lerp( EAdaptationMaxV7Day, EAdaptationMaxV7Night, JKNightDayFactor ), EAdaptationMaxV7Interior, JKInteriorFactor );
  2974. float EAdaptationMinV7 = lerp( lerp( EAdaptationMinV7Day, EAdaptationMinV7Night, JKNightDayFactor ), EAdaptationMinV7Interior, JKInteriorFactor );
  2975. float lumamax = EToneMappingOversaturationV7;
  2976. //kermles////////////////////////////////////////////
  2977. float EColorAdaptationStrengthV7 = lerp( lerp( EColorAdaptationStrengthV7Day, EColorAdaptationStrengthV7Night, JKNightDayFactor ), EColorAdaptationStrengthV7Interior, JKInteriorFactor );
  2978. float3 moodColor = float3(lerp( lerp( EMoodColorDay.x, EMoodColorNight.x, JKNightDayFactor), EMoodColorInt.x, JKInteriorFactor), lerp( lerp( EMoodColorDay.y, EMoodColorNight.y, JKNightDayFactor), EMoodColorInt.y, JKInteriorFactor),lerp( lerp( EMoodColorDay.z, EMoodColorNight.z, JKNightDayFactor), EMoodColorInt.z, JKInteriorFactor));
  2979. float moodAmount = lerp( lerp( EMoodAmountDay, EMoodAmountNight, JKNightDayFactor), EMoodAmountInt, JKInteriorFactor);
  2980. float moodThreshold = lerp( lerp( EMoodThresholdDay, EMoodThresholdNight, JKNightDayFactor), EMoodThresholdInt, JKInteriorFactor);
  2981. float moodCurve = lerp( lerp( EMoodCurveDay, EMoodCurveNight, JKNightDayFactor), EMoodCurveInt, JKInteriorFactor);
  2982. float3 shadowColor = float3(lerp( lerp( EShadowColorDay.x, EShadowColorNight.x, JKNightDayFactor), EShadowColorInt.x, JKInteriorFactor), lerp( lerp( EShadowColorDay.y, EShadowColorNight.y, JKNightDayFactor), EShadowColorInt.y, JKInteriorFactor),lerp( lerp( EShadowColorDay.z, EShadowColorNight.z, JKNightDayFactor), EShadowColorInt.z, JKInteriorFactor));
  2983. float shadowThreshold = lerp( lerp( EShadowThresholdDay, EShadowThresholdNight, JKNightDayFactor), EShadowThresholdInt, JKInteriorFactor);
  2984. float shadowAmount = lerp( lerp( EShadowAmountDay, EShadowAmountNight, JKNightDayFactor), EShadowAmountInt, JKInteriorFactor);
  2985. float shadowCurve = lerp( lerp( EShadowCurveDay, EShadowCurveNight, JKNightDayFactor), EShadowCurveInt, JKInteriorFactor);
  2986. float3 brightSpotColor = float3(lerp( lerp( EBrightSpotColorDay.x, EBrightSpotColorNight.x, JKNightDayFactor), EBrightSpotColorInt.x, JKInteriorFactor), lerp( lerp( EBrightSpotColorDay.y, EBrightSpotColorNight.y, JKNightDayFactor), EBrightSpotColorInt.y, JKInteriorFactor),lerp( lerp( EBrightSpotColorDay.z, EBrightSpotColorNight.z, JKNightDayFactor), EBrightSpotColorInt.z, JKInteriorFactor));
  2987. float brightSpotAmount = lerp( lerp( EBrightSpotAmountDay, EBrightSpotAmountNight, JKNightDayFactor), EBrightSpotAmountInt, JKInteriorFactor);
  2988. float brightSpotThreshold = lerp( lerp( EBrightSpotThresholdDay, EBrightSpotThresholdNight, JKNightDayFactor), EBrightSpotThresholdInt, JKInteriorFactor);
  2989. float brightSpotCurve = lerp( lerp( EBrightSpotCurveDay, EBrightSpotCurveNight, JKNightDayFactor), EBrightSpotCurveInt, JKInteriorFactor);
  2990. float hsvDesatCurve = lerp( lerp( EHSVDesatCurveDay, EHSVDesatCurveNight, JKNightDayFactor), EHSVDesatCurveInt, JKInteriorFactor); //controls desaturation strength
  2991. float EFinalContrastV7 = lerp( lerp( EFinalContrastV7Day, EFinalContrastV7Night, JKNightDayFactor), EFinalContrastV7Interior, JKInteriorFactor );
  2992. float EFinalExposureV7 = lerp( lerp( EFinalExposureV7Day, EFinalExposureV7Night, JKNightDayFactor), EFinalExposureV7Interior, JKInteriorFactor );
  2993. float PPAmount = 1.0; //controls interpolation between vanilla colors and PP6 colors
  2994. float4 ncolor;
  2995. float avgbr;
  2996.  
  2997. grayadaptation = clamp(grayadaptation, 0, 50);
  2998. //store vanilla colors//////////////////////////////////////////
  2999. float4 oldcolor = color;
  3000. //convert to hsv////////////////////////////////////////////////
  3001. float3 hsvncolor = RGBtoHSV7( color.xyz );
  3002. //desaturate based on original saturation///////////////////////
  3003. hsvncolor.y = pow( hsvncolor.y, hsvDesatCurve );
  3004. //saturation////////////////////////////////////////////////////
  3005. hsvncolor.y = hsvncolor.y*EColorSaturationV7;
  3006. //convert back to rgb///////////////////////////////////////////
  3007. color.xyz = HSVtoRGB7( hsvncolor );
  3008. //brightness////////////////////////////////////////////////////
  3009. color.xyz = pow(color, 1.0 / max(0.0001, EBrightnessV7));
  3010. //convert to linear colorspace//////////////////////////////////
  3011. color.r = 1.0/(1.0+color.r);
  3012. color.g = 1.0/(1.0+color.g);
  3013. color.b = 1.0/(1.0+color.b);
  3014. //contrast//////////////////////////////////////////////////////
  3015. color.xyz = pow(color, EIntensityContrastV7) / (pow(color, EIntensityContrastV7) + pow((1.0 - color), EIntensityContrastV7));
  3016. //restore dynamic range/////////////////////////////////////////
  3017. color.r = (1.0/color.r)-1.0;
  3018. color.g = (1.0/color.g)-1.0;
  3019. color.b = (1.0/color.b)-1.0;
  3020. color.xyz = (color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV7);
  3021. #if( PRE_COLORATION == 1)
  3022. //mood coloring/////////////////////////////////////////////////
  3023. ncolor = color;
  3024. avgbr = Luminance(color.xyz);
  3025. moodColor = lerp(0.0, moodColor, saturate(avgbr*2));
  3026. moodColor = lerp(moodColor, 1, saturate(avgbr-0.5)*2);
  3027. ncolor.xyz = lerp(ncolor, moodColor, saturate(pow(avgbr, moodCurve + ((ncolor)*(1-moodColor)) / moodThreshold)));
  3028. color.xyz = lerp(color, ncolor, moodAmount);
  3029. //shadows///////////////////////////////////////////////////////
  3030. ncolor = max(0.0, color);
  3031. avgbr = Luminance(color.xyz);
  3032. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0+ncolor)* (2.55-shadowColor))*shadowThreshold)/shadowCurve);
  3033. #if( SHADOW_USE_ADDITION == 1)
  3034. color.xyz += max(color, ncolor)*shadowAmount;
  3035. #else
  3036. color.xyz = lerp(color, max(color,ncolor), shadowAmount);
  3037. #endif
  3038. //brightspots///////////////////////////////////////////////////
  3039. avgbr = Luminance(color.xyz);
  3040. #if( BRIGHTSPOT_IGNORE_WHITES == 1)
  3041. brightSpotColor = lerp(0.0, brightSpotColor, saturate(avgbr*2));
  3042. brightSpotColor = lerp(brightSpotColor, 1, saturate(avgbr-0.5)*2);
  3043. #endif
  3044. ncolor = 1-color;
  3045. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0 + ncolor) * (brightSpotColor))*brightSpotThreshold)/brightSpotCurve);
  3046. color.xyz = lerp(color, 1-ncolor, brightSpotAmount);
  3047. #endif
  3048. color.xyz /= (grayadaptation*EAdaptationMaxV7+EAdaptationMinV7);
  3049. #if( POST_COLORATION == 1)
  3050. //mood coloring/////////////////////////////////////////////////
  3051. ncolor = color;
  3052. avgbr = Luminance(color.xyz);
  3053. moodColor = lerp(0.0, moodColor, saturate(avgbr*2));
  3054. moodColor = lerp(moodColor, 1, saturate(avgbr-0.5)*2);
  3055. ncolor.xyz = lerp(ncolor, moodColor, saturate(pow(avgbr, moodCurve + ((ncolor)*(1-moodColor)) / moodThreshold)));
  3056. color.xyz = lerp(color, ncolor, moodAmount);
  3057. //shadows///////////////////////////////////////////////////////
  3058. ncolor = color;
  3059. avgbr = Luminance(color.xyz);
  3060. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0+ncolor)* (2.55-shadowColor))*shadowThreshold)/shadowCurve);
  3061. #if( SHADOW_USE_ADDITION == 1)
  3062. color.xyz += ncolor*shadowAmount;
  3063. #else
  3064. color.xyz = lerp(color, max(color,ncolor), shadowAmount);
  3065. #endif
  3066. //brightspots///////////////////////////////////////////////////
  3067. avgbr = Luminance(color.xyz);
  3068. #if( BRIGHTSPOT_IGNORE_WHITES == 1)
  3069. brightSpotColor = lerp(0.0, brightSpotColor, saturate(avgbr*2));
  3070. brightSpotColor = lerp(brightSpotColor, 1, saturate(avgbr-0.5)*2);
  3071. #endif
  3072. ncolor = 1-color;
  3073. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0 + ncolor) * (brightSpotColor))*brightSpotThreshold)/brightSpotCurve);
  3074. color.xyz = lerp(color, 1-ncolor, brightSpotAmount);
  3075. #endif
  3076. #if( COLOR_ADAPTATION == 1)
  3077. avgbr = Luminance(color.xyz);
  3078. grayadaptation = saturate(grayadaptation);
  3079. //convert to hsv////////////////////////////////////////////////
  3080. hsvncolor = RGBtoHSV( color.xyz );
  3081. hsvncolor.y = max( hsvncolor.y, 0 );
  3082. //desaturate based on adaptation///////////////////////
  3083. hsvncolor.y = hsvncolor.y/(1+((1-avgbr)*(1-grayadaptation))*EColorAdaptationStrengthV7);
  3084. //convert back to rgb///////////////////////////////////////////
  3085. color.xyz = HSVtoRGB( hsvncolor );
  3086. #endif
  3087. //dpeasant contrast code////////////////////////////////////////
  3088. color.xyz = lerp(color.xyz, 0.5 * (1 + sin((color.xyz - 0.5)*3.1415926)), EFinalContrastV7);
  3089. //dpeasant exposure code////////////////////////////////////////
  3090. color.rgb *= pow(2.0f, EFinalExposureV7);
  3091. //lerp between vanilla and pp6 colors///////////////////////////
  3092. color = lerp(oldcolor, color, PPAmount);
  3093. #endif
  3094.  
  3095. //Improved Tonemapping by Brodiggan Gale modified by Kermles//////////////////////////////////////////////////////////////////
  3096.  
  3097. #if POSTPROCESS == 8
  3098. float saturationMin = lerp( lerp( EMinSaturationPowerDay, EMinSaturationPowerNight, JKNightDayFactor), EMinSaturationPowerInt, JKInteriorFactor);
  3099. float saturationMax = lerp( lerp( EMaxSaturationPowerDay, EMaxSaturationPowerNight, JKNightDayFactor), EMaxSaturationPowerInt, JKInteriorFactor);
  3100. float brightCurve = lerp( lerp( EBrightCurveDay, EBrightCurveNight, JKNightDayFactor), EBrightCurveInt, JKInteriorFactor);
  3101. float contrastCurve = lerp( lerp( EContrastCurveDay, EContrastCurveNight, JKNightDayFactor), EContrastCurveInt, JKInteriorFactor);
  3102. float contrastThreshold = lerp( lerp( EContrastThresholdDay, EContrastThresholdNight, JKNightDayFactor), EContrastThresholdInt, JKInteriorFactor);
  3103. float EToneMappingOversaturationV8= lerp( lerp( EToneMappingOversaturationV8Day, EToneMappingOversaturationV8Night, JKNightDayFactor), EToneMappingOversaturationV8Interior, JKInteriorFactor );
  3104. float EToneMappingCurveV8 = lerp( lerp( EToneMappingCurveV8Day, EToneMappingCurveV8Night, JKNightDayFactor), EToneMappingCurveV8Interior, JKInteriorFactor );
  3105. float EAdaptationMaxV8 = lerp( lerp( EAdaptationMaxV8Day, EAdaptationMaxV8Night, JKNightDayFactor ), EAdaptationMaxV8Interior, JKInteriorFactor );
  3106. float EAdaptationMinV8 = lerp( lerp( EAdaptationMinV8Day, EAdaptationMinV8Night, JKNightDayFactor ), EAdaptationMinV8Interior, JKInteriorFactor );
  3107. float3 moodColor = float3(lerp( lerp( EMoodColorDay.x, EMoodColorNight.x, JKNightDayFactor), EMoodColorInt.x, JKInteriorFactor), lerp( lerp( EMoodColorDay.y, EMoodColorNight.y, JKNightDayFactor), EMoodColorInt.y, JKInteriorFactor),lerp( lerp( EMoodColorDay.z, EMoodColorNight.z, JKNightDayFactor), EMoodColorInt.z, JKInteriorFactor));
  3108. float moodAmount = lerp( lerp( EMoodAmountDay, EMoodAmountNight, JKNightDayFactor), EMoodAmountInt, JKInteriorFactor);
  3109. float moodThreshold = lerp( lerp( EMoodThresholdDay, EMoodThresholdNight, JKNightDayFactor), EMoodThresholdInt, JKInteriorFactor);
  3110. float moodCurve = lerp( lerp( EMoodCurveDay, EMoodCurveNight, JKNightDayFactor), EMoodCurveInt, JKInteriorFactor);
  3111. float3 shadowColor = float3(lerp( lerp( EShadowColorDay.x, EShadowColorNight.x, JKNightDayFactor), EShadowColorInt.x, JKInteriorFactor), lerp( lerp( EShadowColorDay.y, EShadowColorNight.y, JKNightDayFactor), EShadowColorInt.y, JKInteriorFactor),lerp( lerp( EShadowColorDay.z, EShadowColorNight.z, JKNightDayFactor), EShadowColorInt.z, JKInteriorFactor));
  3112. float shadowThreshold = lerp( lerp( EShadowThresholdDay, EShadowThresholdNight, JKNightDayFactor), EShadowThresholdInt, JKInteriorFactor);
  3113. float shadowAmount = lerp( lerp( EShadowAmountDay, EShadowAmountNight, JKNightDayFactor), EShadowAmountInt, JKInteriorFactor);
  3114. float shadowCurve = lerp( lerp( EShadowCurveDay, EShadowCurveNight, JKNightDayFactor), EShadowCurveInt, JKInteriorFactor);
  3115. float3 brightSpotColor = float3(lerp( lerp( EBrightSpotColorDay.x, EBrightSpotColorNight.x, JKNightDayFactor), EBrightSpotColorInt.x, JKInteriorFactor), lerp( lerp( EBrightSpotColorDay.y, EBrightSpotColorNight.y, JKNightDayFactor), EBrightSpotColorInt.y, JKInteriorFactor),lerp( lerp( EBrightSpotColorDay.z, EBrightSpotColorNight.z, JKNightDayFactor), EBrightSpotColorInt.z, JKInteriorFactor));
  3116. float brightSpotAmount = lerp( lerp( EBrightSpotAmountDay, EBrightSpotAmountNight, JKNightDayFactor), EBrightSpotAmountInt, JKInteriorFactor);
  3117. float brightSpotThreshold = lerp( lerp( EBrightSpotThresholdDay, EBrightSpotThresholdNight, JKNightDayFactor), EBrightSpotThresholdInt, JKInteriorFactor);
  3118. float brightSpotCurve = lerp( lerp( EBrightSpotCurveDay, EBrightSpotCurveNight, JKNightDayFactor), EBrightSpotCurveInt, JKInteriorFactor);
  3119. float EFinalContrastV8 = lerp( lerp( EFinalContrastV8Day, EFinalContrastV8Night, JKNightDayFactor), EFinalContrastV8Interior, JKInteriorFactor );
  3120. float EFinalExposureV8 = lerp( lerp( EFinalExposureV8Day, EFinalExposureV8Night, JKNightDayFactor), EFinalExposureV8Interior, JKInteriorFactor );
  3121. float4 ncolor;
  3122. float avgbr;
  3123. grayadaptation = clamp(grayadaptation, 0, 50);
  3124. color.x = 1/(1+color.x);
  3125. color.y = 1/(1+color.y);
  3126. color.z = 1/(1+color.z);
  3127. float luminance = max(color.x, max(color.y, color.z)); // Too low or high of a luminance value will cause some artifacting in the steps to follow
  3128. color.xyz = saturate(pow(color.xyz / luminance, lerp(saturationMin, saturationMax, peakCurve(0.0, 1.0, (color.x+color.y+color.z)/3, 1.8)))) * luminance; // Increase/Decrease Saturation
  3129. color.xyz = color.xyz * (1.0 + compoundCurve(0.0, 1.0, luminance, contrastCurve, contrastThreshold) - luminance); //Contrast Tonemapping
  3130. color.xyz = color.xyz * (1.0 + color.xyz/brightCurve)/(color.xyz + (1/brightCurve)); //Brightness Tonemapping
  3131. color.x = (1/color.x)-1;
  3132. color.y = (1/color.y)-1;
  3133. color.z = (1/color.z)-1;
  3134. color.xyz = (color.xyz * (1.0 + color.xyz/EToneMappingOversaturationV8))/(color.xyz + EToneMappingCurveV8);
  3135. #if( PRE_COLORATION == 1)
  3136. //mood coloring/////////////////////////////////////////////////
  3137. ncolor = color;
  3138. avgbr = Luminance(color.xyz);
  3139. moodColor = lerp(0.0, moodColor, saturate(avgbr*2));
  3140. moodColor = lerp(moodColor, 1, saturate(avgbr-0.5)*2);
  3141. ncolor.xyz = lerp(ncolor, moodColor, saturate(pow(avgbr, moodCurve + ((ncolor)*(1-moodColor)) / moodThreshold)));
  3142. color.xyz = lerp(color, ncolor, moodAmount);
  3143. //shadows///////////////////////////////////////////////////////
  3144. ncolor = color;
  3145. avgbr = Luminance(color.xyz);
  3146. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0+ncolor)* (2.55-shadowColor))*shadowThreshold)/shadowCurve);
  3147. #if( SHADOW_USE_ADDITION == 1)
  3148. color.xyz += max(color, ncolor)*shadowAmount;
  3149. #else
  3150. color.xyz = lerp(color, max(color,ncolor), shadowAmount);
  3151. #endif
  3152. //brightspots///////////////////////////////////////////////////
  3153. avgbr = Luminance(color.xyz);
  3154. #if( BRIGHTSPOT_IGNORE_WHITES == 1)
  3155. brightSpotColor = lerp(0.0, brightSpotColor, saturate(avgbr*2));
  3156. brightSpotColor = lerp(brightSpotColor, 1, saturate(avgbr-0.5)*2);
  3157. #endif
  3158. ncolor = 1-color;
  3159. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0 + ncolor) * (brightSpotColor))*brightSpotThreshold)/brightSpotCurve);
  3160. #if( BRIGHTSPOT_USE_SUBTRACTION == 1)
  3161. color.xyz -= ncolor*brightSpotAmount;
  3162. #else
  3163. color.xyz = lerp(color, 1-ncolor, brightSpotAmount);
  3164. #endif
  3165. #endif
  3166. color.xyz /= (grayadaptation*EAdaptationMaxV8+EAdaptationMinV8);
  3167. #if( POST_COLORATION == 1)
  3168. //mood coloring/////////////////////////////////////////////////
  3169. ncolor = max(0.0001,color);
  3170. avgbr = Luminance(color.xyz);
  3171. moodColor = lerp(0.0001, moodColor, saturate(avgbr*2));
  3172. moodColor = lerp(moodColor, 1, saturate(avgbr-0.5)*2);
  3173. ncolor.xyz = lerp(ncolor, moodColor, saturate(pow(avgbr, moodCurve + ((ncolor)*(1-moodColor)) / moodThreshold)));
  3174. color.xyz = lerp(color, ncolor, moodAmount);
  3175. //shadows///////////////////////////////////////////////////////
  3176. ncolor = max(0.0001, color);
  3177. avgbr = Luminance(color.xyz);
  3178. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0+ncolor)* (2.55-shadowColor))*shadowThreshold)/shadowCurve);
  3179. #if( SHADOW_USE_ADDITION == 1)
  3180. color.xyz += max(color, ncolor)*shadowAmount;
  3181. #else
  3182. color.xyz = lerp(color, max(color,ncolor), shadowAmount);
  3183. #endif
  3184. //brightspots///////////////////////////////////////////////////
  3185. avgbr = Luminance(color.xyz);
  3186. #if( BRIGHTSPOT_IGNORE_WHITES == 1)
  3187. brightSpotColor = lerp(0.0001, brightSpotColor, saturate(avgbr*2));
  3188. brightSpotColor = lerp(brightSpotColor, 1, saturate(avgbr-0.5)*2);
  3189. #endif
  3190. ncolor = 1-color;
  3191. ncolor.xyz = max(ncolor, pow(ncolor, ((1.0 + ncolor) * (brightSpotColor))*brightSpotThreshold)/brightSpotCurve);
  3192. color.xyz = lerp(color, 1-ncolor, brightSpotAmount);
  3193. #endif
  3194. //dpeasant contrast code////////////////////////////////////////
  3195. color.xyz = lerp(color.xyz, 0.5 * (1 + sin((color.xyz - 0.5)*3.1415926)), EFinalContrastV8);
  3196. //dpeasant exposure code////////////////////////////////////////
  3197. color.rgb *= pow(2.0f, EFinalExposureV8);
  3198. #endif
  3199.  
  3200. /////////////////////////////////////////////////////////////////////////////////////////////////
  3201. ///POST BLOOM CODE///////////////////////////////////////////////////////////////////////////////
  3202. /////////////////////////////////////////////////////////////////////////////////////////////////
  3203.  
  3204. #if( POST_BLOOM == 1)
  3205.  
  3206. float mavg;
  3207. float3 nsat;
  3208. float3 oldcol;
  3209. float4 xcolorbloom;
  3210.  
  3211. #if(CURVE_BLOOM == 1)
  3212.  
  3213.  
  3214. xcolorbloom = tex2D( _s3, _v0.xy );
  3215.  
  3216.  
  3217. //++Changes appareance of colors+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3218. float3 cbgreycn = float3(0.299, 0.587, 0.114); // perception of color luminace
  3219. //float3 cbgreycn = float3(0.811,0.523,0.996); // perception of color luminace
  3220. //float3 cbgreycn = float3(0.333,0.333,0.333); // screw perception
  3221. //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  3222.  
  3223. float bloomBrightness = lerp( lerp( BloomBrightnessDay, BloomBrightnessNight, JKNightDayFactor), BloomBrightnessInt, JKInteriorFactor);
  3224. float3 bloomSaturation = lerp( lerp( BloomSaturationDay, BloomSaturationNight, JKNightDayFactor), BloomSaturationInt, JKInteriorFactor);
  3225. float bloomContrast = lerp( lerp( BloomContrastDay, BloomContrastNight, JKNightDayFactor), BloomContrastInt, JKInteriorFactor);
  3226. float bloomThreshold = lerp( lerp( BloomThresholdDay, BloomThresholdNight, JKNightDayFactor), BloomThresholdInt, JKInteriorFactor);
  3227. float bloomCurve = lerp( lerp( BloomCurveDay, BloomCurveNight, JKNightDayFactor), BloomCurveInt, JKInteriorFactor);
  3228. float bloomavgbr = (color.x+color.y+color.z)/3;
  3229.  
  3230. #if(BLOOM_DEFUZZ == 1)
  3231. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  3232. xcolorbloom.xyz-=(mavg/3);
  3233. xcolorbloom.xyz+=(mavg*0.2);
  3234. xcolorbloom.xyz*(mavg*1.2);
  3235. #endif
  3236.  
  3237. #if(BLOOM_COLORIZATION == 1)
  3238. xcolorbloom.rgb*= lerp( lerp( curvebloommultDay, curvebloommultNight, JKNightDayFactor ), curvebloommultInterior, JKInteriorFactor );
  3239. xcolorbloom.rgb-= lerp( lerp( curvebloomsubDay, curvebloomsubNight, JKNightDayFactor ), curvebloomsubInterior, JKInteriorFactor );
  3240. xcolorbloom.rb*= lerp( lerp( curveMAGENTAbloomDay, curveMAGENTAbloomNight, JKNightDayFactor ), curveMAGENTAbloomInterior, JKInteriorFactor );
  3241. xcolorbloom.gb*= lerp( lerp( curveCYANbloomDay, curveCYANbloomNight, JKNightDayFactor ), curveCYANbloomInterior, JKInteriorFactor );
  3242. xcolorbloom.rg*= lerp( lerp( curveYELLOWbloomDay, curveYELLOWbloomNight, JKNightDayFactor ), curveYELLOWbloomInterior, JKInteriorFactor );
  3243. #endif
  3244.  
  3245. float4 bloomncolor = xcolorbloom;
  3246. //remove bloom from dark areas//////////////////////////////////
  3247. bloomncolor = pow(bloomncolor/bloomCurve, bloomThreshold + (bloomncolor*bloomncolor));
  3248. //adjust saturation
  3249. bloomncolor.xyz *= bloomSaturation;
  3250. bloomncolor.xyz += (xcolorbloom.x-(xcolorbloom.x*bloomSaturation.x)) * cbgreycn.x;
  3251. bloomncolor.xyz += (xcolorbloom.y-(xcolorbloom.y*bloomSaturation.y)) * cbgreycn.y;
  3252. bloomncolor.xyz += (xcolorbloom.z-(xcolorbloom.z*bloomSaturation.z)) * cbgreycn.z;
  3253. //adjust brightness/////////////////////////////////////////////
  3254. bloomncolor.xyz = pow(bloomncolor, 1.0 / max(0.0001, bloomBrightness));
  3255. //adjust contrast///////////////////////////////////////////////
  3256. bloomncolor.xyz = pow(bloomncolor, bloomContrast) / (pow(saturate(bloomncolor), bloomContrast) + pow(1.0 - saturate(bloomncolor), bloomContrast));
  3257. //sharpen///////////////////////////////////////////////////////
  3258. #if(SHARP_MODE == 1)
  3259. bloomncolor = max(0, lerp(0, bloomncolor, saturate(bloomavgbr*2)));
  3260. bloomncolor = max(0, lerp(bloomncolor, 1, saturate(bloomavgbr-0.5)*2));
  3261. #endif
  3262. //mix bloom/////////////////////////////////////////////////////
  3263. #if(BLOOM_LERP == 1)
  3264. color.xyz = lerp( color, bloomncolor, EBloomAmount );
  3265. #endif
  3266. #if(BLOOM_ADD == 1)
  3267. color.xyz += bloomncolor * EBloomAmount;
  3268. #endif
  3269. #if(BLOOM_LERP == 0)
  3270. #if(BLOOM_ADD == 0)
  3271. color.xyz = max(color, bloomncolor * EBloomAmount);
  3272. #endif
  3273. #endif
  3274. #endif
  3275.  
  3276. #if( ENB_BLOOM == 1)
  3277.  
  3278.  
  3279. float4 enbbloomcol=tex2D(_s3, _v0.xy);
  3280.  
  3281.  
  3282. // DEBUG OUTPUT
  3283. // return enbbloomcol;
  3284.  
  3285. if( enbbloomcol.r + enbbloomcol.g + enbbloomcol.b > 0.0 )
  3286. {
  3287. #if( BLOOM_COLORIZATION == 1)
  3288. enbbloomcol.rgb*= lerp( lerp( ENBbloommultDay, ENBbloommultNight, JKNightDayFactor ), ENBbloommultInterior, JKInteriorFactor );
  3289. enbbloomcol.rgb-= lerp( lerp( ENBbloomsubDay, ENBbloomsubNight, JKNightDayFactor ), ENBbloomsubInterior, JKInteriorFactor );
  3290. enbbloomcol.rb*= lerp( lerp( ENBMAGENTAbloomDay, ENBMAGENTAbloomNight, JKNightDayFactor ), ENBMAGENTAbloomInterior, JKInteriorFactor );
  3291. enbbloomcol.gb*= lerp( lerp( ENBCYANbloomDay, ENBCYANbloomNight, JKNightDayFactor ), ENBCYANbloomInterior, JKInteriorFactor );
  3292. enbbloomcol.rg*= lerp( lerp( ENBYELLOWbloomDay, ENBYELLOWbloomNight, JKNightDayFactor ), ENBYELLOWbloomInterior, JKInteriorFactor );
  3293. #endif
  3294.  
  3295. float fBloomSaturationSmooth =lerp( lerp( fBloomSaturationSmoothDay, fBloomSaturationSmoothNight, JKNightDayFactor ), fBloomSaturationSmoothInterior, JKInteriorFactor );
  3296. float fBloomSaturationCurve =lerp( lerp( fBloomSaturationCurveDay, fBloomSaturationCurveNight, JKNightDayFactor ), fBloomSaturationCurveInterior, JKInteriorFactor );
  3297. float fBloomSaturationMult =lerp( lerp( fBloomSaturationMultDay, fBloomSaturationMultNight, JKNightDayFactor ), fBloomSaturationMultInterior, JKInteriorFactor );
  3298.  
  3299. float fBloomIntensitySmooth =lerp( lerp( fBloomIntensitySmoothDay, fBloomIntensitySmoothNight, JKNightDayFactor ), fBloomIntensitySmoothInterior, JKInteriorFactor );
  3300. float fBloomIntensityCurve =lerp( lerp( fBloomIntensityCurveDay, fBloomIntensityCurveNight, JKNightDayFactor ), fBloomIntensityCurveInterior, JKInteriorFactor );
  3301. float fBloomIntensityMult =lerp( lerp( fBloomIntensityMultDay, fBloomIntensityMultNight, JKNightDayFactor ), fBloomIntensityMultInterior, JKInteriorFactor );
  3302. float fBloomIntensityMod =lerp( lerp( fBloomIntensityModDay, fBloomIntensityModNight, JKNightDayFactor ), fBloomIntensityModInterior, JKInteriorFactor );
  3303. float fBloomIntensityMax =lerp( lerp( fBloomIntensityMaxDay, fBloomIntensityMaxNight, JKNightDayFactor ), fBloomIntensityMaxInterior, JKInteriorFactor );
  3304.  
  3305. float3 bloomhsv = RGBtoHSV( enbbloomcol.rgb );
  3306. bloomhsv.y = lerp( bloomhsv.y, smoothstep( 0.0, 1.0, bloomhsv.y ), fBloomSaturationSmooth );
  3307. bloomhsv.y = pow( bloomhsv.y, fBloomSaturationCurve );
  3308. bloomhsv.y *= fBloomSaturationMult;
  3309. bloomhsv.z = lerp( bloomhsv.z, smoothstep( 0.0, 1.0, bloomhsv.z ), fBloomIntensitySmooth );
  3310. bloomhsv.z = pow( bloomhsv.z, fBloomIntensityCurve );
  3311. bloomhsv.z *= fBloomIntensityMult;
  3312. bloomhsv.z += fBloomIntensityMod;
  3313. bloomhsv.z = clamp( bloomhsv.z, 0.0, fBloomIntensityMax );
  3314. enbbloomcol.rgb = HSVtoRGB( bloomhsv );
  3315.  
  3316. #if( BLOOM_DEFUZZ == 1)
  3317. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  3318. xcolorbloom.xyz-=(mavg/3);
  3319. xcolorbloom.xyz+=(mavg*0.2);
  3320. xcolorbloom.xyz*(mavg*1.2);
  3321. #endif
  3322.  
  3323. #if( BLOOM_LERP == 1)
  3324. color.rgb = lerp( color.rgb, enbbloomcol.rgb, EBloomAmount );
  3325. #endif
  3326. #if( BLOOM_ADD == 1)
  3327. color.rgb += enbbloomcol.rgb * EBloomAmount;
  3328. #endif
  3329. #if( BLOOM_LERP == 0)
  3330. #if( BLOOM_ADD == 0)
  3331. color.rgb = max(color.xyz, enbbloomcolor.xyz * EBloomAmount);
  3332. #endif
  3333. #endif
  3334.  
  3335. }
  3336. #endif
  3337.  
  3338. #if( DIFFUSE_BLOOM == 1)
  3339.  
  3340.  
  3341. xcolorbloom = tex2D( _s3, _v0.xy );
  3342.  
  3343.  
  3344. #if( BLOOM_DEFUZZ == 1)
  3345. // Heliosdouble cobbled together bloom defuzzer - increases contrast of bloom / stop it hazing low brightness values
  3346. // modulated by the overall brightness of the screen.
  3347.  
  3348. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  3349. xcolorbloom.xyz-=(mavg/3);
  3350. //xcolorbloom.xyz=min(xcolorbloom.xyz,0.0);
  3351. xcolorbloom.xyz+=(mavg*0.2);
  3352. xcolorbloom.xyz*(mavg*1.2);
  3353. #endif
  3354.  
  3355. #if( BLOOM_COLORIZATION == 1)
  3356. xcolorbloom.xyz*= lerp( lerp( diffbloommultDay, diffbloommultNight, JKNightDayFactor ), diffbloommultInterior, JKInteriorFactor );
  3357. xcolorbloom.xyz-= lerp( lerp( diffbloomsubDay, diffbloomsubNight, JKNightDayFactor ), diffbloomsubInterior, JKInteriorFactor );
  3358. xcolorbloom.xz*= lerp( lerp( diffMAGENTAbloomDay, diffMAGENTAbloomNight, JKNightDayFactor ), diffMAGENTAbloomInterior, JKInteriorFactor );
  3359. xcolorbloom.yz*= lerp( lerp( diffCYANbloomDay, diffCYANbloomNight, JKNightDayFactor ), diffCYANbloomInterior, JKInteriorFactor );
  3360. xcolorbloom.xy*= lerp( lerp( diffYELLOWbloomDay, diffYELLOWbloomNight, JKNightDayFactor ), diffYELLOWbloomInterior, JKInteriorFactor );
  3361. #endif
  3362. float Saturation = lerp( lerp( SatDay, SatNight, JKNightDayFactor ), SatInterior, JKInteriorFactor );
  3363. float Luma = lerp( lerp( LumaDay, LumaNight, JKNightDayFactor ), LumaInterior, JKInteriorFactor );
  3364. float Pow = lerp( lerp( PowDay, PowNight, JKNightDayFactor ), PowInterior, JKInteriorFactor );
  3365. float Pow2 = lerp( lerp( Pow2Day, Pow2Night, JKNightDayFactor ), Pow2Interior, JKInteriorFactor );
  3366.  
  3367. float3 cgray2=dot(xcolorbloom.xyz, Luma);
  3368. float3 poweredcolor2=pow(xcolorbloom.xyz, Saturation);
  3369. float newgray2=dot(poweredcolor2.xyz, Pow);
  3370. xcolorbloom.xyz=poweredcolor2.xyz*cgray2/(newgray2+Pow2);
  3371.  
  3372. color.xyz+=xcolorbloom.xyz*EBloomAmount;
  3373.  
  3374. #if( BLOOM_LERP == 1)
  3375. color.xyz = lerp( color.xyz, xcolorbloom.xyz, EBloomAmount );
  3376. #endif
  3377. #if( BLOOM_ADD == 1)
  3378. color.xyz += xcolorbloom.xyz * EBloomAmount;
  3379. #endif
  3380. #if( BLOOM_LERP == 0)
  3381. #if( BLOOM_ADD == 0)
  3382. color.xyz =max(color.xyz, xcolorbloom.xyz*EBloomAmount);
  3383. #endif
  3384. #endif
  3385. #endif
  3386.  
  3387.  
  3388. #if( BLOOM_CRISP == 1)
  3389.  
  3390. xcolorbloom = tex2D( _s3, _v0.xy );
  3391.  
  3392. float3 LumCoeff = lerp( LumCoeffInterior, ( lerp( LumCoeffNight, LumCoeffDay, JKNightDayFactor ) ), JKInteriorFactor);
  3393. float3 AvgLumin = lerp( AvgLuminInterior, ( lerp( AvgLuminNight, AvgLuminDay, JKNightDayFactor ) ), JKInteriorFactor);
  3394.  
  3395. #if( BLOOM_DEFUZZ == 1)
  3396. // Heliosdouble cobbled together bloom defuzzer - increases contrast of bloom / stop it hazing low brightness values
  3397. // modulated by the overall brightness of the screen.
  3398.  
  3399. mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)/3);
  3400. xcolorbloom.xyz-=(mavg/3);
  3401. //xcolorbloom.xyz=min(xcolorbloom.xyz,0.0);
  3402. xcolorbloom.xyz+=(mavg*0.2);
  3403. xcolorbloom.xyz*(mavg*1.2);
  3404. #endif
  3405.  
  3406. #if( BLOOM_COLORIZATION == 1)
  3407.  
  3408. xcolorbloom.rgb*= lerp( lerp( crispbloommultDay, crispbloommultNight, JKNightDayFactor ), crispbloommultInterior, JKInteriorFactor );
  3409. xcolorbloom.rgb-= lerp( lerp( crispbloomsubDay, crispbloomsubNight, JKNightDayFactor ), crispbloomsubInterior, JKInteriorFactor );
  3410.  
  3411. xcolorbloom.rb*= lerp( lerp( crispMAGENTAbloomDay, crispMAGENTAbloomNight, JKNightDayFactor ), crispMAGENTAbloomInterior, JKInteriorFactor );
  3412. xcolorbloom.gb*= lerp( lerp( crispCYANbloomDay, crispCYANbloomNight, JKNightDayFactor ), crispCYANbloomInterior, JKInteriorFactor );
  3413. xcolorbloom.rg*= lerp( lerp( crispYELLOWbloomDay, crispYELLOWbloomNight, JKNightDayFactor ), crispYELLOWbloomInterior, JKInteriorFactor );
  3414.  
  3415. //color.xyz+=xcolorbloom.xyz*EBloomAmount;
  3416.  
  3417. #endif
  3418.  
  3419. // Limits what triggers a bloom
  3420. float3 brightbloom = xcolorbloom - lerp( TrigInterior, ( lerp( TrigNight, TrigDay, JKNightDayFactor ) ), JKInteriorFactor);
  3421. brightbloom = max( brightbloom , 0);
  3422.  
  3423. // Limits bloom to superbright spots only
  3424. float3 superbright = xcolorbloom - lerp( SBrightInterior, ( lerp( SBrightNight, SBrightDay, JKNightDayFactor ) ), JKInteriorFactor);
  3425. superbright = max( superbright , 0 ) ; // crop so dont go any lower than black
  3426. //superbright = lerp( AvgLumin, superbright, 0.5); // Contrast
  3427. superbright *= 0.6;
  3428.  
  3429. // Bloom - Brightness, Contrast and Saturation
  3430. float3 brt = lerp( CBrightnessInterior, ( lerp( CBrightnessNight, CBrightnessDay, JKNightDayFactor ) ), JKInteriorFactor);
  3431. float3 con = lerp( CContrastInterior, ( lerp( CContrastNight, CContrastDay, JKNightDayFactor ) ), JKInteriorFactor);
  3432. float3 sat = lerp( CSaturationInterior, ( lerp( CSaturationNight, CSaturationDay, JKNightDayFactor ) ), JKInteriorFactor);
  3433. float3 brtColor = brightbloom * brt;
  3434. float3 cintensity = dot( brtColor, LumCoeff );
  3435. float3 satColor = lerp( cintensity, brtColor, sat );
  3436. float3 conColor = lerp( AvgLumin, satColor, con );
  3437. conColor -= 0.3;
  3438. brightbloom = conColor;
  3439.  
  3440. // These values compensates the brightness when no bloom is used
  3441. color.xyz += lerp( BrightnessModInterior, ( lerp( BrightnessModNight, BrightnessModDay, JKNightDayFactor ) ), JKInteriorFactor);
  3442. color.xyz *= lerp( BrightnessMultInterior, ( lerp( BrightnessMultNight, BrightnessMultDay, JKNightDayFactor ) ), JKInteriorFactor);
  3443.  
  3444. // Adds bloom while compensating for any brightness change
  3445. color.xyz += (( superbright * hbs ) * lerp( CompSBInterior, ( lerp( CompSBNight, CompSBDay, JKNightDayFactor ) ), JKInteriorFactor)); // Limits where the bloom will "bloom"
  3446. brightbloom -= ( superbright * 2 ); // removes superbright from brightbloom
  3447. brightbloom = max( brightbloom , 0.0 );
  3448. color.xyz += (( brightbloom * hbs ) * lerp( BloomStrInterior, ( lerp( BloomStrNight, BloomStrDay, JKNightDayFactor ) ), JKInteriorFactor)); // How strong the bloom will be
  3449.  
  3450. // This blends the the ENB and Skyrim bloom together, for a more hazey effect
  3451. color.xyz += (xcolorbloom.xyz * hbs) * lerp( BloomBlendInterior, ( lerp( BloomBlendNight, BloomBlendDay, JKNightDayFactor ) ), JKInteriorFactor); // How much the blend there will be
  3452. color.xyz *= lerp( BlendCompInterior, ( lerp( BlendCompNight, BlendCompDay, JKNightDayFactor ) ), JKInteriorFactor); // compensate for brightening caused by above bloom
  3453.  
  3454. #endif
  3455.  
  3456. #endif
  3457.  
  3458. /////////////////////////////////////////////////////////////////////////////////////////////////
  3459. ///ADVANCED COLOR CONTROL CODE///////////////////////////////////////////////////////////////////
  3460. /////////////////////////////////////////////////////////////////////////////////////////////////
  3461.  
  3462. #if( COLOR_POLARIZATION == 1)
  3463. float3 GuideHue = lerp( lerp( GuideHueDay, GuideHueNight, JKNightDayFactor), GuideHueInt, JKInteriorFactor);
  3464. float Amount = lerp( lerp( AmountDay, AmountNight, JKNightDayFactor), AmountInt, JKInteriorFactor);
  3465. float DesatCorr = lerp( lerp( DesatCorrDay, DesatCorrNight, JKNightDayFactor), DesatCorrInt, JKInteriorFactor);
  3466. float Concentrate = lerp( lerp( ConcentrateDay, ConcentrateNight, JKNightDayFactor), ConcentrateInt, JKInteriorFactor);
  3467.  
  3468. float4 rgbaTex = color;
  3469. float3 hsvTex = RGBtoHSV7(rgbaTex.rgb);
  3470. float3 huePole1 = RGBtoHSV7(GuideHue); // uniform
  3471. float3 huePole2 = hsv_complement(huePole1); // uniform
  3472. float dist1 = abs(hsvTex.x - huePole1.x); if (dist1>0.5) dist1 = 1.0-dist1;
  3473. float dist2 = abs(hsvTex.x - huePole2.x); if (dist2>0.5) dist2 = 1.0-dist2;
  3474. float dsc = smoothstep(0,DesatCorr,hsvTex.y);
  3475. float3 newHsv = hsvTex;
  3476. // #define FORCEHUE
  3477. #ifdef FORCEHUE
  3478. if (dist1 < dist2) {
  3479. newHsv = huePole1;
  3480. } else {
  3481. newHsv = huePole2;
  3482. }
  3483. #else /* ! FORCEHUE */
  3484. if (dist1 < dist2) {
  3485. float c = dsc * Amount * (1.0 - pow((dist1*2.0),1.0/Concentrate));
  3486. newHsv.x = hue_lerp(hsvTex.x,huePole1.x,c);
  3487. newHsv.y = lerp(hsvTex.y,huePole1.y,c);
  3488. } else {
  3489. float c = dsc * Amount * (1.0 - pow((dist2*2.0),1.0/Concentrate));
  3490. newHsv.x = hue_lerp(hsvTex.x,huePole2.x,c);
  3491. newHsv.y = lerp(hsvTex.y,huePole1.y,c);
  3492. }
  3493. #endif /* ! FORCEHUE */
  3494. float3 newRGB = HSVtoRGB7(newHsv);
  3495. #ifdef FORCEHUE
  3496. newRGB = lerp(rgbaTex.rgb,newRGB,Amount);
  3497. #endif /* FORCEHUE */
  3498. color.xyz = newRGB;
  3499. #endif
  3500.  
  3501. #if(COLOR_GRADING == 1)
  3502. float3 RedVector = lerp(lerp(RedVectorDay, RedVectorNight, JKNightDayFactor), RedVectorInt, JKInteriorFactor);
  3503. float3 GreenVector = lerp(lerp(GreenVectorDay, GreenVectorNight, JKNightDayFactor), GreenVectorInt, JKInteriorFactor);
  3504. float3 BlueVector = lerp(lerp(BlueVectorDay, BlueVectorNight, JKNightDayFactor), BlueVectorInt, JKInteriorFactor);
  3505.  
  3506. float3 texCol = color.xyz;
  3507. float rm = dot(texCol.xyz,RedVector);
  3508. float gm = dot(texCol.xyz,GreenVector);
  3509. float bm = dot(texCol.xyz,BlueVector);
  3510. color.xyz= float3(rm, gm, bm);
  3511. #endif
  3512.  
  3513. /////////////////////////////////////////////////////////////////////////////////////////////////
  3514. ///SEPIA TONE CODE///////////////////////////////////////////////////////////////////////////////
  3515. /////////////////////////////////////////////////////////////////////////////////////////////////
  3516. #if( SEPIATONE == 1)
  3517. float fSepiaExposure =lerp( lerp( fSepiaExposureDay, fSepiaExposureNight, JKNightDayFactor ), fSepiaExposureInterior, JKInteriorFactor );
  3518. float3 fSepiaColor =lerp( lerp( fSepiaColorDay, fSepiaColorNight, JKNightDayFactor ), fSepiaColorInterior, JKInteriorFactor );
  3519. float fSepiaDesaturation =lerp( lerp( fSepiaDesaturationDay, fSepiaDesaturationNight, JKNightDayFactor ), fSepiaDesaturationInterior, JKInteriorFactor );
  3520.  
  3521. float SepiaWeight = float3( 0.2125, 0.7154, 0.0721 );
  3522. float SepiaLuminance = min( 1.0, dot( color, SepiaWeight ) * fSepiaExposure ) ;
  3523. float3 SepiaColor = fSepiaColor * SepiaLuminance;
  3524. color.rgb = lerp( color.rgb, SepiaColor, fSepiaDesaturation );
  3525. #endif
  3526.  
  3527.  
  3528.  
  3529. //TONEMAPPERS
  3530.  
  3531. #if (TVLEVELS==1)
  3532.  
  3533. float DARK_LEVEL = lerp( lerp( DARK_LEVEL_DAY, DARK_LEVEL_NIGHT, JKNightDayFactor ), DARK_LEVEL_INT, JKInteriorFactor );
  3534. float BRIGHT_LEVEL = lerp( lerp( BRIGHT_LEVEL_DAY, BRIGHT_LEVEL_NIGHT, JKNightDayFactor ), BRIGHT_LEVEL_INT, JKInteriorFactor );
  3535.  
  3536.  
  3537. #define const_1 (DARK_LEVEL/255.0)
  3538. #define const_2 (255.0/(255.0-BRIGHT_LEVEL))
  3539.  
  3540. color.xyz = (color.xyz - const_1) * const_2;
  3541.  
  3542. #endif
  3543.  
  3544.  
  3545. #if (VIBRANCE==1)
  3546.  
  3547. float Vibrance =lerp( lerp( VibranceDay, VibranceNight, JKNightDayFactor ), VibranceInterior, JKInteriorFactor );
  3548.  
  3549. float3 VlumCoeff = float3(0.2126, 0.7152, 0.0722);
  3550. float vibranceluma = dot(VlumCoeff, color.xyz);
  3551.  
  3552. float max_color = max(color.x, max(color.y,color.z)); //Find the strongest color
  3553. float min_color = min(color.x, max(color.y,color.z)); //Find the weakest color
  3554. float color_saturation = max_color - min_color;
  3555.  
  3556. color.xyz = lerp(vibranceluma, color.xyz, (1.0 + (Vibrance * (1.0 - (sign(Vibrance) * color_saturation)))));
  3557. #endif
  3558.  
  3559.  
  3560. #if (SPHERICAL == 1)
  3561.  
  3562. float sphericalAmount =lerp( lerp( sphericalAmountDay, sphericalAmountNight, JKNightDayFactor ), sphericalAmountInterior, JKInteriorFactor );
  3563.  
  3564. float3 signedColor = color.rgb * 2.0 - 1.0;
  3565. float3 sphericalColor = sqrt(1.0 - signedColor.rgb * signedColor.rgb);
  3566. sphericalColor = sphericalColor * 0.5 + 0.5;
  3567. sphericalColor *= color.rgb;
  3568. color.rgb += sphericalColor.rgb * sphericalAmount;
  3569. color.rgb *= 0.95;
  3570.  
  3571. #endif
  3572.  
  3573. #if (CINEONDPX == 1 )
  3574. color = DPXPass(color, JKInteriorFactor, JKNightDayFactor);
  3575. #endif
  3576.  
  3577.  
  3578. #if (MASTEREFFECT_TONEMAP == 1)
  3579. color = TonemapPass(color, JKInteriorFactor, JKNightDayFactor);
  3580. #endif
  3581.  
  3582. #if (CROSSPROCESS == 1)
  3583. color = CrossProcess_PS(color, JKInteriorFactor, JKNightDayFactor);
  3584. #endif
  3585.  
  3586. /*
  3587. #define SAGE_BLOOM 1
  3588.  
  3589. #if ( SAGE_BLOOM == 1)
  3590.  
  3591. float SAGEBloomDownsampling = 6;
  3592. float SAGEBloomThreshold = 0.25;
  3593. float SAGEBloomIntensity = 10.2;
  3594.  
  3595. float4 sagebloomcol = tex2Dlod(_s0, float4(IN.txcoord0.xy,0,SAGEBloomDownsampling));
  3596. sagebloomcol = max(_c6, sagebloomcol - SAGEBloomThreshold);
  3597. sagebloomcol = saturate(sagebloomcol * SAGEBloomIntensity);
  3598.  
  3599. color = 1-(1-color)*(1-sagebloomcol);
  3600. #endif
  3601. */
  3602.  
  3603.  
  3604. /////////////////////////////////////////////////////////////////////////////////////////////////
  3605. ///FINAL COLOR CONTROL CODE//////////////////////////////////////////////////////////////////////
  3606. /////////////////////////////////////////////////////////////////////////////////////////////////
  3607.  
  3608. #if(FINAL_ADJUSTMENTS == 1)
  3609. float3 FinalSaturation = lerp( lerp( SaturationDay, SaturationNight, JKNightDayFactor), SaturationInt, JKInteriorFactor );
  3610. float FinalBrightness = lerp( lerp( BrightnessDay, BrightnessNight, JKNightDayFactor), BrightnessInt, JKInteriorFactor );
  3611. float FinalContrast = clamp(lerp( lerp( ContrastDay, ContrastNight, JKNightDayFactor), ContrastInt, JKInteriorFactor ), -1.0, 1.0);
  3612. //convert to linear colorspace
  3613. color.r = 1.0/(1.0+color.r);
  3614. color.g = 1.0/(1.0+color.g);
  3615. color.b = 1.0/(1.0+color.b);
  3616. //reverse gamma correction
  3617. color.rgb = pow(color.rgb, 2.2);
  3618. //saturate
  3619. color.rgb = lerp(dot(color.rgb,(float3(0.299, 0.587, 0.114))), color.rgb, FinalSaturation);
  3620. //brighten
  3621. color.rgb /= FinalBrightness;
  3622. //adjust contrast
  3623. float factor = (1.0156862745098039215686274509804 * (FinalContrast + 1.0)) / (1.0156862745098039215686274509804 - FinalContrast);
  3624. float newRed = saturate(factor * (color.r - 0.5078431372549019607843137254902) + 0.5078431372549019607843137254902);
  3625. float newGreen = saturate(factor * (color.g - 0.5078431372549019607843137254902) + 0.5078431372549019607843137254902);
  3626. float newBlue = saturate(factor * (color.b - 0.5078431372549019607843137254902) + 0.5078431372549019607843137254902);
  3627. color.rgb = float3(newRed, newGreen, newBlue);
  3628. //restore gamma correction
  3629. color.rgb = pow(color.rgb, 0.45454545454545454545454545454545);
  3630. //restore dynamic range
  3631. color.r = (1.0/color.r)-1.0;
  3632. color.g = (1.0/color.g)-1.0;
  3633. color.b = (1.0/color.b)-1.0;
  3634. #endif
  3635. /////////////////////////////////////////////////////////////////////////////////////////////////
  3636. ///ENB PALETTE CODE//////////////////////////////////////////////////////////////////////////////
  3637. /////////////////////////////////////////////////////////////////////////////////////////////////
  3638. #if( ENB_PALETTE == 1)
  3639. float palmix =lerp( lerp( palmixDay, palmixNight, JKNightDayFactor ), palmixInterior, JKInteriorFactor );
  3640.  
  3641. float3 enbpalcol = tex2D( _s7, 0.5 ).rgb;
  3642. float enbpallum = ( enbpalcol.r + enbpalcol.g + enbpalcol.b );
  3643. if( enbpallum > 0.0 )
  3644. {
  3645. color.rgb = saturate(color.rgb);
  3646. float3 brightness = Adaptation.xyz;
  3647. brightness=max(brightness.x, max(brightness.y, brightness.z));
  3648. float3 palette=0.0;
  3649. float4 uvsrc=0.0;
  3650. uvsrc.x=color.r;
  3651. uvsrc.y=brightness.r;
  3652. palette.r=tex2D(_s7, uvsrc).r;
  3653. uvsrc.x=color.g;
  3654. uvsrc.y=brightness.g;
  3655. palette.g=tex2D(_s7, uvsrc).g;
  3656. uvsrc.x=color.b;
  3657. uvsrc.y=brightness.b;
  3658. palette.b=tex2D(_s7, uvsrc).b;
  3659. color.rgb=palette.rgb * palmix;
  3660. }
  3661. #endif
  3662.  
  3663. /////////////////////////////////////////////////////////////////////////////////////////////////
  3664. ///ENB LENS DIRT CODE////////////////////////////////////////////////////////////////////////////
  3665. /////////////////////////////////////////////////////////////////////////////////////////////////
  3666.  
  3667. #if ( ENB_PALETTE_LENSDIRT == 1)
  3668. float4 lensdirtpal = tex2D(_s8, _v0.xy);
  3669. float4 lensdirtbloom = tex2D(_s3, _v0.xy);
  3670.  
  3671. lensdirtbloom.xyz -= LensDirtThreshold;
  3672. lensdirtbloom.xyz *= LensDirtPower;
  3673. lensdirtbloom.xyz=max(lensdirtbloom.xyz, 0.0);
  3674.  
  3675. float lensdirtbloomgray = dot(lensdirtbloom.xyz, 0.333);
  3676.  
  3677. color.xyz += lensdirtpal.xyz * lensdirtbloomgray;
  3678. #endif
  3679.  
  3680.  
  3681.  
  3682. /*
  3683. float4 dereinering = tex2D(_s10, _v0.xy);
  3684.  
  3685. float ringsum = (dereinering.x + dereinering.y + dereinering.z)/3;
  3686.  
  3687. if(ringsum < 0.95)
  3688. {
  3689. color = dereinering;
  3690. }
  3691. */
  3692.  
  3693.  
  3694. /*
  3695. float HighSat = 1;
  3696. float HighDeSatPower = 2.0;
  3697. float HighDeSatThreshold = 0.85;
  3698.  
  3699. float HighDeSatLum = dot(color.rgb, 0.333);
  3700. HighDeSatLum -= HighDeSatThreshold;
  3701. HighDeSatLum = max(HighDeSatLum,0);
  3702.  
  3703.  
  3704. HighSat -= HighDeSatLum*HighDeSatPower;
  3705.  
  3706.  
  3707. float HighLuma = dot(color.xyz,float3(0.27, 0.67, 0.06));
  3708. float3 HighNcolor = normalize(color);
  3709. HighNcolor.xyz = pow(HighNcolor.xyz, HighSat);
  3710. float HighNluma = dot(HighNcolor.xyz,float3(0.27, 0.67, 0.06));
  3711. color.xyz = HighNcolor.xyz*HighLuma/HighNluma;
  3712.  
  3713.  
  3714. color *= 1.076;
  3715. */
  3716.  
  3717.  
  3718.  
  3719.  
  3720.  
  3721. /////////////////////////////////////////////////////////////////////////////////////////////////
  3722. ///FILM GRAIN CODE///////////////////////////////////////////////////////////////////////////////
  3723. /////////////////////////////////////////////////////////////////////////////////////////////////
  3724. #if( ENABLE_GRAIN == 1)
  3725. float fGrainMotion =lerp( lerp( fGrainMotionDay, fGrainMotionNight, JKNightDayFactor ), fGrainMotionInterior, JKInteriorFactor );
  3726. float fGrainSaturation =lerp( lerp( fGrainSaturationDay, fGrainSaturationNight, JKNightDayFactor ), fGrainSaturationInterior, JKInteriorFactor );
  3727. float fGrainIntensity =lerp( lerp( fGrainIntensityDay, fGrainIntensityNight, JKNightDayFactor ), fGrainIntensityInterior, JKInteriorFactor );
  3728.  
  3729. float GrainTimerSeed = Timer.x * fGrainMotion;
  3730. float2 GrainTexCoordSeed = _v0.xy * 1.0;
  3731. float2 GrainSeed1 = GrainTexCoordSeed + float2( 0.0, GrainTimerSeed );
  3732. float2 GrainSeed2 = GrainTexCoordSeed + float2( GrainTimerSeed, 0.0 );
  3733. float2 GrainSeed3 = GrainTexCoordSeed + float2( GrainTimerSeed, GrainTimerSeed );
  3734. float GrainNoise1 = random( GrainSeed1 );
  3735. float GrainNoise2 = random( GrainSeed2 );
  3736. float GrainNoise3 = random( GrainSeed3 );
  3737. float GrainNoise4 = ( GrainNoise1 + GrainNoise2 + GrainNoise3 ) * 0.333333333;
  3738. float3 GrainNoise = float3( GrainNoise4, GrainNoise4, GrainNoise4 );
  3739. float3 GrainColor = float3( GrainNoise1, GrainNoise2, GrainNoise3 );
  3740. color.rgb += ( lerp( GrainNoise, GrainColor, fGrainSaturation ) * fGrainIntensity ) - ( fGrainIntensity * 0.5);
  3741. #endif
  3742.  
  3743.  
  3744. #if ( BORDER == 1)
  3745.  
  3746. #define BUFFER_RCP_WIDTH (1/ScreenSize.x)
  3747. #define BUFFER_RCP_HEIGHT (1/(ScreenSize.x * ScreenSize.w))
  3748.  
  3749. #define pixxx BUFFER_RCP_WIDTH
  3750. #define piyyy BUFFER_RCP_HEIGHT
  3751. #define pixxxel float2(pixxx,piyyy)
  3752.  
  3753. float2 distancefromcenter = abs(_v0.xy - 0.5);
  3754. bool2 screen_border = step(0.5 - pixxxel,distancefromcenter);
  3755. color.xyz = (!dot(screen_border, 1.0)) ? color.xyz : 0.0;
  3756.  
  3757. #endif
  3758.  
  3759.  
  3760.  
  3761. #if ( SINCITY == 1)
  3762. float sinlumi = dot(color.rgb, float3(0.30f,0.59f,0.11f));
  3763. if(color.r > (color.g + 0.2f) && color.r > (color.b + 0.025f))
  3764. {
  3765. color.rgb = float3(sinlumi, 0, 0)*1.5;
  3766. }
  3767. else
  3768. {
  3769. color.rgb = sinlumi;
  3770. }
  3771. #endif
  3772.  
  3773.  
  3774.  
  3775. #if ( COLORMOD == 1)
  3776.  
  3777. color.xyz = (color.xyz - dot(color.xyz, 0.333)) * ColormodChroma + dot(color.xyz, 0.333);
  3778.  
  3779. color.x = (pow(color.x, ColormodGammaR) - 0.5) * ColormodContrastR + 0.5 + ColormodBrightnessR;
  3780. color.y = (pow(color.y, ColormodGammaG) - 0.5) * ColormodContrastG + 0.5 + ColormodBrightnessB;
  3781. color.z = (pow(color.z, ColormodGammaB) - 0.5) * ColormodContrastB + 0.5 + ColormodBrightnessB;
  3782.  
  3783.  
  3784. #endif
  3785.  
  3786.  
  3787.  
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793. _oC0.w=1.0;
  3794.  
  3795. _oC0.xyz=color.xyz;
  3796. return _oC0;
  3797. }
  3798.  
  3799. /////////////////////////////////////////////////////////////////////////////////////////////////
  3800. ///FLIP TECHNIQUE CODE///////////////////////////////////////////////////////////////////////////
  3801. /////////////////////////////////////////////////////////////////////////////////////////////////
  3802.  
  3803. //switch between vanilla and mine post processing
  3804. technique Shader_GTASA <string UIName="ENBSeries";>
  3805. {
  3806. pass p0
  3807. {
  3808. VertexShader = compile vs_3_0 VS_Quad();
  3809. PixelShader = compile ps_3_0 PS_GTASA();
  3810.  
  3811. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  3812. ZEnable=FALSE;
  3813. ZWriteEnable=FALSE;
  3814. CullMode=NONE;
  3815. AlphaTestEnable=FALSE;
  3816. AlphaBlendEnable=FALSE;
  3817. SRGBWRITEENABLE=FALSE;
  3818. }
  3819. }
  3820.  
  3821.  
  3822.  
  3823. //original shader of post processing
  3824. float4 PS_ORIG(VS_OUTPUT_POST IN) : COLOR
  3825. {
  3826. float4 _oC0=tex2D(_s0, IN.txcoord0.xy);
  3827. _oC0.w=1.0;
  3828. return _oC0;
  3829. }
  3830.  
  3831. technique Shader_ORIGINALPOSTPROCESS <string UIName="Vanilla";>
  3832. {
  3833. pass p0
  3834. {
  3835. VertexShader = compile vs_3_0 VS_Quad();
  3836. PixelShader = compile ps_3_0 PS_ORIG();
  3837. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  3838. ZEnable=FALSE;
  3839. ZWriteEnable=FALSE;
  3840. CullMode=NONE;
  3841. AlphaTestEnable=FALSE;
  3842. AlphaBlendEnable=FALSE;
  3843. SRGBWRITEENABLE=FALSE;
  3844. }
  3845. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement