SHARE
TWEET

enbeffect.fx - Seasons of Skyrim

a guest Jan 21st, 2016 216 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //++++++++++++++++++++++++++++++++++++++++++++
  2. // ENBSeries effect file
  3. // visit http://enbdev.com for updates
  4. // Copyright (c) 2007-2011 Boris Vorontsov
  5. //
  6. // Using decompiled shader of TES Skyrim
  7. //++++++++++++++++++++++++++++++++++++++++++++
  8.  
  9. //++++++++++++++++++++++++++++++++++++++++++++
  10. // Additions and Tweaking by HD6 (HeliosDoubleSix) and Bronze316
  11. // MOD by HD6: http://www.skyrimnexus.com/downloads/file.php?id=4142
  12.  
  13. // Seasons of Skyrim ENB (2015) - by Bronze316
  14.  
  15. // http://skyrim.nexusmods.com/mods/15983
  16. // http://skyrim.nexusmods.com/mods/20781
  17. // http://skyrim.nexusmods.com/mods/23812
  18.  
  19.  
  20. // these are typically denoted by 'HD6'
  21. // given I have no shader writing experience,
  22. // will undoubtedly be retarded to a seasoned professional, I welcome any advice!
  23. // thanks Boris!
  24. //++++++++++++++++++++++++++++++++++++++++++++
  25.  
  26. // CREDITS
  27.  
  28. // JawZ: Author of DN-IE code, redesigned file layout.          //
  29. //                                                              //
  30. // HeliosDoubleSix/HD6: Author of initial                       //
  31. // Bloom Screen, Bloom Crisp, Bloom Defuzz,                     //
  32. // Bloom No Black, Color Tweaks and Vignette.                   //
  33. //                                                              //
  34. // MTichenor: Author of initial Vanilla Adaptation,             //
  35. // Vanilla Bloom and Flip factor
  36.  
  37. #define POSTPROCESS                 2   // Choose which post-processing effect to use 2.
  38. #define APPLYGAMECOLORCORRECTION    1   // This will deactivate the use of Vanilla post-processing and only use ENB own post-processing.
  39. #define ENB_FLIPTECHNIQUE           0   // This will turn every effect in here off + SSAO, Reflections, Skylighting, Detailed Shadows, Sun Rays, ImageBasedLighting and Rain.
  40.  
  41. //
  42.  
  43. #define FLIP_INT_EXT                0   // Flips the interior and exterior factor, so that interior settings affect exteriors and vice versa.
  44. #define FLIP_NIGHT_DAY              0   // Flips the day and night factor, so that day settings affect nights and vice versa.
  45.  
  46. //
  47.  
  48. #define ENB_ADAPTATION          1   // Enables ENB dynamic Adaptation settings.
  49. #define HD6_ADAPTATION          1   // Enables HD6 static Skyrim Adaptation settings.
  50. #define VANILLA_ADAPTATION      0   // Enables Skyrim Adaptation settings.
  51. #define VANILLA_BLOOM           0   // Enables Skyrim Bloom settings.
  52.  
  53. //
  54.  
  55. #define HD6_BLOOM               1   // 1,2. 1 = Bloom Crisp - alternate crisp bloom, no hazey mud. 2 = Bloom Screen alternate bloom (using screen mode).
  56. #define HD6_BLOOM_NOBLACK       0   // Brightens the dark spots of bloom.
  57. #define HD6_BLOOM_DEFUZZ        0   // HD6 attempt to remove some of the haze from the bloom.
  58.  
  59. //
  60.  
  61. #define HD6_COLOR_TWEAKS        1   // Enables a set of Contrast, Brightness and Saturation controls, with in-game adjustment.
  62. #define HD6_COLORSAT            1   // Adjusts the RGB values seperately, Red, Green and Blue + Magenta, Cyan and Yellow color
  63. #define HD6_BLOOM_DEBLUEIFY     1   // With this enabled you can adjust the coloization of the bloom. Same settings as "KOLORIZER" but affects only bloom.
  64. #define PALETTE_MIXER           1   // Enable settings to adjust the enbpalette.bmp
  65. #define HD6_VIGNETTE            1
  66.  
  67. //
  68.  
  69. #if (POSTPROCESS==1)
  70.  
  71. //EXTERIOR                                  Night, Day
  72. float2  EContrastV1Ext              = float2( 1.0, 1.0 );   // Higher amounts make the dark areas darker while making the bright spot brighter.
  73. float2  EColorSaturationV1Ext       = float2( 1.0, 1.0 );   // Adds more color to the screen.
  74. float2  EToneMappingCurveV1Ext      = float2( 1.0, 1.0 );   // Increasing this darkens the image and makes the bright spots less intense, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  75. float2  EToneMappingOversatV1Ext    = float2( 1.0, 1.0 );   // Similar to EToneMappingCurve but more subtle and makes the bright spots less intense and less colorful.
  76.  
  77. //INTERIOR                                  Night, Day
  78. float2  EContrastV1Int              = float2( 1.0, 1.0 );
  79. float2  EColorSaturationV1Int       = float2( 1.0, 1.0 );
  80. float2  EToneMappingCurveV1Int      = float2( 1.0, 1.0 );
  81. float2  EToneMappingOversatV1Int    = float2( 1.0, 1.0 );
  82. #endif
  83.  
  84. #if (POSTPROCESS==2) // Modifications and tweaks by Bronze316
  85.  
  86. //EXTERIOR                                  Night, Day
  87. float2  EBrightnessV2Ext    = float2( 1.0, 1.0 );
  88. float2  EIntensityContrastV2Ext = float2( 1.475, 1.725 );
  89. float2  EColorSaturationV2Ext   = float2( 1.697842, 1.985612 );
  90. float2  EToneMappingCurveV2Ext  = float2( 8.0, 8.0 );
  91. float2  EToneMappingOversatV2Ext= float2( 1358.3, 3177.0 );
  92. float2  EBlacknessV2Ext     = float2( 0.000001, 0.000001 );
  93.  
  94. float2  EPostBrightnessV2Ext    = float2( 0.848921, 0.992806 );
  95.  
  96. //INTERIOR                                  Night, Day
  97. float2  EBrightnessV2Int    = float2( 1.0, 1.0 );
  98. float2  EIntensityContrastV2Int = float2( 1.475, 1.475 );
  99. float2  EColorSaturationV2Int   = float2( 1.697842, 1.697842 );
  100. float2  EToneMappingCurveV2Int  = float2( 8.0, 8.0 );
  101. float2  EToneMappingOversatV2Int= float2( 2037.5, 2037.5 );
  102. float2  EBlacknessV2Int     = float2( 0.000001, 0.000001 );
  103.  
  104. float2  EPostBrightnessV2Int    = float2( 1.273382, 1.273382 );
  105.  
  106. #endif
  107.  
  108. #if (POSTPROCESS==3)
  109.  
  110. //EXTERIOR                                  Night, Day
  111. float2  EToneMappingCurveV3Ext      = float2( 4.0, 4.0 );   // Increasing this darkens the image, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  112. float2  EToneMapOversatV3Ext        = float2( 60.0, 60.0 ); // Increasing this darkens the image and makes the bright spots less intense, Explanation of Tonemapping - http://en.wikipedia.org/wiki/Tone_mapping
  113.  
  114. //INTERIOR                                  Night, Day
  115. float2  EToneMappingCurveV3Int      = float2( 4.0, 4.0 );
  116. float2  EToneMapOversatV3Int        = float2( 60.0, 60.0 );
  117. #endif
  118.  
  119. #if (POSTPROCESS==4)
  120.  
  121. //EXTERIOR                                    Night, Day
  122. float2  EBrightnessCurveV4Ext       = float2( 0.7, 0.7 );   // A sort of contrast setting
  123. float2  EBrightMultiplierV4Ext      = float2( 0.45, 0.45 ); // A different kind of brightness setting
  124. float2  EBrightToneMapCurveV4Ext    = float2( 0.5, 0.5 );   // Behaves in similar ways as EToneMappingCurve
  125.  
  126. //INTERIOR                                    Night, Day
  127. float2  EBrightnessCurveV4Int       = float2( 0.7, 0.7 );
  128. float2  EBrightMultiplierV4Int      = float2( 0.45, 0.45 );
  129. float2  EBrightToneMapCurveV4Int    = float2( 0.5, 0.5 );
  130. #endif
  131.  
  132. #if (POSTPROCESS==5)
  133.  
  134. //EXTERIOR                                  Night, Day
  135. float2  EBrightnessV5Ext            = float2( 3.1, 1.5 );   // Adjust the brightness of the scene.
  136. float2  EPostBrightnessV5Ext        = float2( 1.3, 1.3 );   // Brightness that is rendered after the saturation and contrast. Compensates for darkening caused by those methods.
  137. float2  EIntensityContrastV5Ext     = float2( 3.475, 3.475 );   // Adjust the Contrast of the whole scene. Makes bright areas brighter and dark areas darker.
  138. float2  EColorSaturationV5Ext       = float2( 3.3, 3.3 );   // Adjust the entire scene saturation. Adds more or less color if you increase or decrease the value
  139. float2  EToneMappingCurveV5Ext      = float2( 8.0, 8.0 );   // A type of contrast that darkens everything, in simplest terms.
  140.  
  141. //INTERIOR                                  Night, Day
  142. float2  EBrightnessV5Int            = float2( 3.1, 1.5 );
  143. float2  EPostBrightnessV5Int        = float2( 1.3, 1.3 );
  144. float2  EIntensityContrastV5Int     = float2( 3.475, 3.475 );
  145. float2  EColorSaturationV5Int       = float2( 3.3, 3.3 );
  146. float2  EToneMappingCurveV5Int      = float2( 8.0, 8.0 );
  147. #endif
  148.  
  149. //
  150.  
  151. #if (ENB_ADAPTATION==1)
  152.  
  153. //EXTERIOR                                  Night, Day
  154.     float2 EAdaptationMinExt    = float2( 0.06, 0.15 ); // Determines the lowest amount the Adaptation will adjust the brightness.
  155.     float2 EAdaptationMaxExt    = float2( 0.09, 0.225 ); // Determines the highest amount the Adaptation will adjust the brightness.
  156.  
  157. //INTERIOR                                  Night, Day
  158.     float2 EAdaptationMinInt    = float2( 0.06, 0.06 );
  159.     float2 EAdaptationMaxInt    = float2( 0.09, 0.09 );
  160. #endif
  161.  
  162. #if (HD6_ADAPTATION==1)
  163.  
  164. //EXTERIOR                                  Night, Day
  165.     float2 EAdaptationStaticExt     = float2( 0.5, 0.5 );   // Adjust Skyrim min or max setting, range 0 to 1
  166.     float2 EAdaptationCompExt   = float2( 1.0, 1.0 );   // Compensates for any loss in brightness.
  167.  
  168. //INTERIOR                                  Night, Day
  169.     float2 EAdaptationStaticInt = float2( 0.5, 0.5 );
  170.     float2 EAdaptationCompInt   = float2( 1.0, 1.0 );
  171. #endif
  172.  
  173. #if (VANILLA_ADAPTATION==1)
  174.  
  175. //EXTERIOR                                  Night, Day
  176. float2 fVanillaAdaptAmbientExt      = float2( 0.36, -0.28 );    // Controls how much ambient luminosity there is from vanilla adaptation code.
  177. float2 fVanillaAdaptChangeExt       = float2( 0.0, 0.0 );   // Controls how much the brightness changes when looking up and down. Affects ambient too.
  178.  
  179. //INTERIOR                                  Night, Day
  180. float2 fVanillaAdaptAmbientInt      = float2( 0.36, 0.36 );
  181. float2 fVanillaAdaptChangeInt       = float2( 0.0, 0.0 );
  182. #endif
  183.  
  184. #if (VANILLA_BLOOM==1)
  185.  
  186. //EXTERIOR                                  Night, Day
  187. float2 fVanillaBloomExt         = float2( 1.0, 1.0 ); // Controls the intensity of vanilla bloom effect.
  188. float2 fVanillaBloomConExt      = float2( 0.0, 0.0 ); // This clamps the vanilla bloom to bright spots and darkens the dark areas.
  189.  
  190. //INTERIOR                                  Night, Day
  191. float2 fVanillaBloomInt         = float2( 1.0, 1.0 );
  192. float2 fVanillaBloomConInt      = float2( 0.0, 0.0 );
  193. #endif
  194.  
  195. //
  196.  
  197. #if (HD6_BLOOM==1)          // Bloom Crisp
  198.  
  199. //EXTERIOR                          Night, Day
  200. float2 bBrightnessExt       = float2( 1.0, 1.0 );   // Adjust bloom brightness.
  201. float2 bContrastExt         = float2( 1.1, 1.0 );   // Adjust bloom contrast.
  202. float2 bSaturationExt       = float2( 0.8, 0.7 );   // Adjust bloom saturation.
  203. float2 bTriggerExt          = float2( 0.18, 0.0 );  // Darkens bloom and thus limits bloom to trigger.
  204. float2 bLimiterExt          = float2( 0.7, 0.7 );   // Limits the amount of bloom.
  205. float2 bAddCompensateExt    = float2( 0.12, 0.23 ); // Compensate scene brightness by adding regular Brightness on top of the bloom.
  206. float2 bMultCompensateExt   = float2( 1.1, 1.4 );   // Compensate scene brightness by multiplying regular Brightness on top of the bloom.
  207. float2 bBrtSpotStrengthExt  = float2( 1.0, 1.0 );   // Brightens only the super bright spots.
  208. float2 bBrtSpotStrength2Ext = float2( 1.0, 1.0 );   // Brightens only bright spots.
  209. float2 bBlendOriginalExt    = float2( 0.7, 0.6 );   // Blends in some additional bloom
  210. float2 bCompOriginalExt     = float2( 0.8, 0.7 );   // Compensate scene brightness caused by BlendOriginal, multiplies regular scene Brightness.
  211.  
  212. //INTERIOR                          Night, Day
  213. float2 bBrightnessInt       = float2( 1.0, 1.0 );
  214. float2 bContrastInt         = float2( 1.1, 1.1 );
  215. float2 bSaturationInt       = float2( 0.8, 0.8 );
  216. float2 bTriggerInt          = float2( 0.18, 0.18 );
  217. float2 bLimiterInt          = float2( 0.7, 0.7 );
  218. float2 bAddCompensateInt    = float2( 0.12, 0.12 );
  219. float2 bMultCompensateInt   = float2( 1.1, 1.1 );
  220. float2 bBrtSpotStrengthInt  = float2( 1.0, 1.0 );
  221. float2 bBrtSpotStrength2Int = float2( 1.0, 1.0 );
  222. float2 bBlendOriginalInt    = float2( 0.7, 0.7 );
  223. float2 bCompOriginalInt     = float2( 0.8, 0.8 );
  224. #endif
  225.  
  226. #if (HD6_BLOOM==2)          // Bloom Screen
  227.  
  228. //EXTERIOR                  Night, Day
  229. float2 BloomMultExt = float2( 10.0, 10.0 ); // Increase the intensity of the bloom
  230.  
  231. //INTERIOR                  Night, Day
  232. float2 BloomMultInt = float2( 10.0, 10.0 );
  233. #endif
  234.  
  235. #if (HD6_BLOOM_NOBLACK==1)
  236.  
  237. //EXTERIOR                      Night, Day
  238. float2 BloomBlacknessExt = float2( 0.12, 0.12 ); // Controls the amount of vanilla bloom effect.
  239. //INTERIOR
  240. float2 BloomBlacknessInt = float2( 0.12, 0.12 );
  241. #endif
  242.  
  243. #if (HD6_BLOOM_DEFUZZ==1)
  244.  
  245. //EXTERIOR                      Night, Day
  246. float2 DefuzzAlphaExt   = float2( 0.333, 0.333 );   // Adjust the bloom RGB Alpha channel.
  247. float2 DefuzzSubExt     = float2( 0.3, 0.3 );   // Subtract the bloom intensity.
  248. float2 DefuzzAddExt     = float2( 0.22, 0.22 ); // Add bloom intensity.
  249.  
  250. //INTERIOR                      Night, Day
  251. float2 DefuzzAlphaInt   = float2( 0.333, 0.333 );
  252. float2 DefuzzSubInt     = float2( 0.3, 0.3 );
  253. float2 DefuzzAddInt     = float2( 0.22, 0.22 );
  254. #endif
  255.  
  256. //
  257.  
  258. #if (HD6_COLOR_TWEAKS==1)
  259.  
  260. //EXTERIOR                           Red, Green, Blue
  261. float3 ctRGBExtDay          = float3( 1.0, 1.0, 1.0 );  // RGB balance Day
  262. float3 ctRGBExtNight        = float3( 1.0, 1.0, 1.0 );  // RGB balance Night
  263.  
  264. //                                  Night, Day
  265. float2 ctPreBrightnessExt   = float2( 1.00, 1.00 ); // Brightness applied before Contrast
  266. float2 ctPostBrightnessExt  = float2( 1.00, 1.00 ); // Brightness applied after Contrast
  267. float2 ctContrastExt        = float2( 1.15, 1.20 ); // Contrast
  268. float2 ctSaturationExt      = float2( 1.00, 1.00 ); // Saturation
  269. float2 ctDarkenExt      = float2( 0.0, 0.0 );   // Saturation
  270.  
  271. //INTERIOR                           Red, Green, Blue
  272. float3 ctRGBIntDay          = float3( 1.0, 1.0, 1.0 );  // RGB balance Day
  273. float3 ctRGBIntNight        = float3( 1.0, 1.0, 1.0 );  // RGB balance Night
  274.  
  275. //                                  Night, Day
  276. float2 ctPreBrightnessInt   = float2( 1.00, 1.00 ); // Brightness applied before Contrast
  277. float2 ctPostBrightnessInt  = float2( 1.00, 1.00 ); // Brightness applied after Contrast
  278. float2 ctContrastInt        = float2( 1.2175, 1.2175 ); // Contrast
  279. float2 ctSaturationInt      = float2( 1.00, 1.00 ); // Saturation
  280. float2 ctDarkenInt      = float2( 0.0, 0.0 );   // Saturation
  281. #endif
  282.  
  283. #if (HD6_COLORSAT==1)
  284.  
  285. //EXTERIOR                       Red, Green, Blue
  286. float3 RGBSatExtDay     = float3( 1.05, 1, 1.025 );
  287. float3 RGBSatExtNight   = float3( 1, 0.95, 1.05 );
  288.  
  289. //INTERIOR                       Red, Green, Blue
  290. float3 RGBSatIntDay     = float3( 1, 0.9375, 1.0625 );
  291. float3 RGBSatIntNight   = float3( 1, 0.9375, 1.0625 );
  292. #endif
  293.  
  294. #if (HD6_BLOOM_DEBLUEIFY==1)
  295.  
  296. //EXTERIOR                       Red, Green, Blue
  297. float3 DebluifyExtDay   = float3( 1.14, 1.14, 1.14 );
  298. float3 DebluifyExtNight = float3( 1.14, 1.14, 1.14 );
  299.  
  300. //INTERIOR                       Red, Green, Blue
  301. float3 DebluifyIntDay   = float3( 1.14, 1.14, 1.14 );
  302. float3 DebluifyIntNight = float3( 1.14, 1.14, 1.14 );
  303. #endif
  304.  
  305. #if (PALETTE_MIXER==1)
  306.  
  307. //EXTERIOR                          Night, Day
  308. float2 palmixExt        = float2( 1.05, 1.05 );
  309. float2 PaletteMinExt        = float2( 1.05, 1.05 );
  310. float2 PaletteMaxExt        = float2( 1.05, 1.05 );
  311.  
  312. //INTERIOR                          Night, Day
  313. float2 palmixInt        = float2( 1.05, 1.05 );
  314. float2 PaletteMinInt        = float2( 1.05, 1.05 );
  315. float2 PaletteMaxInt        = float2( 1.05, 1.05 );
  316. #endif
  317.  
  318. //
  319.  
  320. #if (HD6_VIGNETTE==1)
  321.  
  322. //EXTERIOR                          Night, Day
  323. float2 VignetteRoundExt     = float2( 0.4, 0.4 ); // Determines how round the vignette should be.
  324. float2 VignetteSquareTopExt = float2( 0, 0 ); // Determines how square the vignette should be. Adjusts the top of the screen
  325. float2 VignetteSquareBotExt = float2( 0.1, 0.1 ); // Determines how square the vignette should be. Adjusts the bottom of the screen
  326. float2 VignetteSatExt       = float2( 0.85, 0.85 ); // Determines how saturated the vignette should be.
  327. float2 VignetteContrastExt  = float2( 1.5, 1.5 ); // Determines how much contrast the vignette should have.
  328. float2 VignetteStrengthExt  = float2( 0.85, 0.85 ); // Determines how strong the vignette should be depending on time of day.
  329.  
  330. //INTERIOR                          Night, Day
  331. float2 VignetteRoundInt     = float2( 0.4, 0.4 );
  332. float2 VignetteSquareTopInt = float2( 0, 0 );
  333. float2 VignetteSquareBotInt = float2( 0.1, 0.1 );
  334. float2 VignetteSatInt       = float2( 0.85, 0.85 );
  335. float2 VignetteContrastInt  = float2( 1.5, 1.5 );
  336. float2 VignetteStrengthInt  = float2( 0.85, 0.85 );
  337. #endif
  338.  
  339. //
  340.  
  341. //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
  342. float4  tempF1;          // 1,2,3,4
  343. float4  tempF2;          // 5,6,7,8
  344. float4  tempF3;          // 9,0
  345. float4  Timer;           // x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
  346. float4  ScreenSize;      // x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
  347. float   ENightDayFactor; // changes in range 0..1, 0 means that night time, 1 - day time
  348. float   EInteriorFactor; // changes 0 or 1. 0 means that exterior, 1 - interior
  349. float   EBloomAmount;    // enb version of bloom applied, ignored if original post processing used
  350.  
  351.  
  352. texture2D texs0;//color
  353. texture2D texs1;//bloom skyrim
  354. texture2D texs2;//adaptation skyrim
  355. texture2D texs3;//bloom enb
  356. texture2D texs4;//adaptation enb
  357. texture2D texs7;//palette enb
  358.  
  359. sampler2D _s0 = sampler_state
  360. {
  361.     Texture   = <texs0>;
  362.     MinFilter = POINT;//
  363.     MagFilter = POINT;//
  364.     MipFilter = NONE;//LINEAR;
  365.     AddressU  = Clamp;
  366.     AddressV  = Clamp;
  367.     SRGBTexture=FALSE;
  368.     MaxMipLevel=0;
  369.     MipMapLodBias=0;
  370. };
  371.  
  372. sampler2D _s1 = sampler_state
  373. {
  374.     Texture   = <texs1>;
  375.     MinFilter = LINEAR;//
  376.     MagFilter = LINEAR;//
  377.     MipFilter = NONE;//LINEAR;
  378.     AddressU  = Clamp;
  379.     AddressV  = Clamp;
  380.     SRGBTexture=FALSE;
  381.     MaxMipLevel=0;
  382.     MipMapLodBias=0;
  383. };
  384.  
  385. sampler2D _s2 = sampler_state
  386. {
  387.     Texture   = <texs2>;
  388.     MinFilter = LINEAR;//
  389.     MagFilter = LINEAR;//
  390.     MipFilter = NONE;//LINEAR;
  391.     AddressU  = Clamp;
  392.     AddressV  = Clamp;
  393.     SRGBTexture=FALSE;
  394.     MaxMipLevel=0;
  395.     MipMapLodBias=0;
  396. };
  397.  
  398. sampler2D _s3 = sampler_state
  399. {
  400.     Texture   = <texs3>;
  401.     MinFilter = LINEAR;//
  402.     MagFilter = LINEAR;//
  403.     MipFilter = NONE;//LINEAR;
  404.     AddressU  = Clamp;
  405.     AddressV  = Clamp;
  406.     SRGBTexture=FALSE;
  407.     MaxMipLevel=0;
  408.     MipMapLodBias=0;
  409. };
  410.  
  411. sampler2D _s4 = sampler_state
  412. {
  413.     Texture   = <texs4>;
  414.     MinFilter = LINEAR;//
  415.     MagFilter = LINEAR;//
  416.     MipFilter = NONE;//LINEAR;
  417.     AddressU  = Clamp;
  418.     AddressV  = Clamp;
  419.     SRGBTexture=FALSE;
  420.     MaxMipLevel=0;
  421.     MipMapLodBias=0;
  422. };
  423.  
  424. sampler2D _s7 = sampler_state
  425. {
  426.     Texture   = <texs7>;
  427.     MinFilter = LINEAR;
  428.     MagFilter = LINEAR;
  429.     MipFilter = NONE;
  430.     AddressU  = Clamp;
  431.     AddressV  = Clamp;
  432.     SRGBTexture=FALSE;
  433.     MaxMipLevel=0;
  434.     MipMapLodBias=0;
  435. };
  436.  
  437. struct VS_OUTPUT_POST
  438. {
  439.     float4 vpos  : POSITION;
  440.     float2 txcoord0 : TEXCOORD0;
  441. };
  442. struct VS_INPUT_POST
  443. {
  444.     float3 pos  : POSITION;
  445.     float2 txcoord0 : TEXCOORD0;
  446. };
  447.  
  448. VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
  449. {
  450.     VS_OUTPUT_POST OUT;
  451.  
  452.     OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  453.  
  454.     OUT.txcoord0.xy=IN.txcoord0.xy;
  455.  
  456.     return OUT;
  457. }
  458.  
  459.  
  460. //skyrim shader specific externals, do not modify
  461. float4  _c1 : register(c1);
  462. float4  _c2 : register(c2);
  463. float4  _c3 : register(c3);
  464. float4  _c4 : register(c4);
  465. float4  _c5 : register(c5);
  466.  
  467. float4 PS_D6EC7DD1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
  468. {
  469.     float4 _oC0=0.0; //output
  470.     float4 _c6=float4(0, 0, 0, 0);
  471.     float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
  472.     float4 r0;
  473.     float4 r1;
  474.     float4 r2;
  475.     float4 r3;
  476.     float4 r4;
  477.     float4 r5;
  478.     float4 r6;
  479.     float4 r7;
  480.     float4 r8;
  481.     float4 r9;
  482.     float4 r10;
  483.     float4 r11;
  484.     float4 _v0=0.0;
  485.     _v0.xy=IN.txcoord0.xy;
  486.  //color
  487.     r1=tex2D(_s0, _v0.xy);
  488.  //apply bloom
  489.     float4  xcolorbloom=tex2D(_s3, _v0.xy);
  490.  //my bypass
  491.     r11=r1;
  492.  //for future use without game color corrections
  493.     _oC0.xyz=r1.xyz;
  494.  
  495.  
  496. // Flip Code for DN-IE, now with interpolation
  497.    float JKNightDayFactor=(0, 1, ENightDayFactor);
  498.    float JKInteriorFactor=(0, 1, EInteriorFactor);
  499. #if (FLIP_INT_EXT==1)
  500.    JKInteriorFactor=(EInteriorFactor, 0, 1);
  501. #endif
  502. #if (FLIP_NIGHT_DAY==1)
  503.    JKNightDayFactor=(ENightDayFactor, 0, 1);
  504. #endif
  505.  
  506.  
  507. #if (APPLYGAMECOLORCORRECTION==1)
  508.     //apply original
  509.     r0.x=1.0/_c2.y;
  510. #if (VANILLA_ADAPTATION==1)
  511.         float   fVanillaAdaptAmbient = lerp(fVanillaAdaptAmbientExt.x, fVanillaAdaptAmbientExt.y, JKNightDayFactor);
  512.         float   fVanillaAdaptChange = lerp(fVanillaAdaptChangeExt.x, fVanillaAdaptChangeExt.y, JKNightDayFactor);
  513.     if ( JKInteriorFactor ) {
  514.         fVanillaAdaptAmbient = lerp(fVanillaAdaptAmbientInt.x, fVanillaAdaptAmbientInt.y, JKNightDayFactor);
  515.         fVanillaAdaptChange = lerp(fVanillaAdaptChangeInt.x, fVanillaAdaptChangeInt.y, JKNightDayFactor);
  516.     };
  517.  
  518.     r1=tex2D(_s2, _v0);
  519.     r1.x = lerp( 0.2, r1.x, fVanillaAdaptAmbient );
  520.     r1.y = lerp( r1.x, r1.y, fVanillaAdaptChange );
  521.     r0.yz=r1.xy * _c1.y;
  522. #endif
  523. #if (VANILLA_ADAPTATION==0)
  524.     r1.x = 0.1;
  525.         r1.y = 0.1;
  526.     r1.z = 0.1;// Bronze316 - I might need this
  527.     r0.yz=r1.xy * _c1.y;
  528.  
  529.     // Bronze316 - vanilla adaptation works better this way
  530.  
  531.    
  532.     r0.w=1.0/r0.y;
  533.     r0.z=r0.w * r0.z;
  534.     r1=tex2D(_s0, _v0);
  535.     r1.xyz=r1 * _c1.y;
  536.     r0.w=dot(_c7.xyz, r1.xyz);
  537.     r1.w=r0.w * r0.z;
  538.     r0.z=r0.z * r0.w + _c7.w;
  539.     r0.z=1.0/r0.z;
  540.     r0.x=r1.w * r0.x + _c7.w;
  541.     r0.x=r0.x * r1.w;
  542.     r0.x=r0.z * r0.x;
  543.     if (r0.w<0) r0.x=_c6.x;
  544.     r0.z=1.0/r0.w;
  545.     r0.z=r0.z * r0.x;
  546.     r0.x=saturate(-r0.x + _c2.x);
  547. //    r2=tex2D(_s3, _v0);//enb bloom
  548.  
  549. #endif // APPLYGAMECOLORCORRECTION
  550.  
  551. #if (VANILLA_BLOOM==1)
  552.         float   fVanillaBloom = lerp(fVanillaBloomExt.x, fVanillaBloomExt.y, JKNightDayFactor);
  553.         float   fVanillaBloomCon = lerp(fVanillaBloomConExt.x, fVanillaBloomConExt.y, JKNightDayFactor);
  554.     if ( JKInteriorFactor ) {
  555.         fVanillaBloom = lerp(fVanillaBloomInt.x, fVanillaBloomInt.y, JKNightDayFactor);
  556.         fVanillaBloomCon = lerp(fVanillaBloomConInt.x, fVanillaBloomConInt.y, JKNightDayFactor);
  557.     };
  558.  
  559.     r2=tex2D(_s1, _v0) * fVanillaBloom - fVanillaBloomCon;
  560. #endif
  561. #if (VANILLA_BLOOM==0)
  562.     r2=0.0;
  563. #endif
  564.     r2.xyz=r2 * _c1.y;
  565.     r2.xyz=r0.x * r2;
  566.     r1.xyz=r1 * r0.z + r2;
  567.     r0.x=dot(r1.xyz, _c7.xyz);
  568.     r1.w=_c7.w;
  569.     r2=lerp(r0.x, r1, _c3.x);
  570.     r1=r0.x * _c4 - r2;
  571.     r1=_c4.w * r1 + r2;
  572.     r1=_c3.w * r1 - r0.y; //khajiit night vision _c3.w
  573.     r0=_c3.z * r1 + r0.y;
  574.     r1=-r0 + _c5;
  575.     _oC0=_c5.w * r1 + r0;
  576. #endif
  577.  
  578.     float4 color=_oC0;
  579.  //adaptation in time
  580.     float4  Adaptation=tex2D(_s4, 0.0);
  581.     float   grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
  582.  
  583. #if (HD6_COLORSAT==1)
  584.  
  585.     float3  RGBSat = lerp(RGBSatExtNight, RGBSatExtDay, JKNightDayFactor);
  586. if ( JKInteriorFactor ) {
  587.     RGBSat = lerp(RGBSatIntNight, RGBSatIntDay, JKNightDayFactor);
  588. };
  589.  
  590.     float3 nsatn=RGBSat; // So it has less to different/no effect during day
  591.     float3 oldcoln = color.xyz; // store old values
  592.     color.xyz *= nsatn; // adjust saturation   
  593.  
  594.     // spread lost luminace over everything
  595.     float3 greycn = float3(0.333,0.333,0.333); // screw perception
  596.  
  597.     color.xyz += (oldcoln.x-(oldcoln.x*nsatn.x)) * greycn.x;
  598.     color.xyz += (oldcoln.y-(oldcoln.y*nsatn.y)) * greycn.y;
  599.     color.xyz += (oldcoln.z-(oldcoln.z*nsatn.z)) * greycn.z;
  600. #endif
  601.  
  602. #if (HD6_BLOOM_NOBLACK==1)
  603.  
  604.     float   BloomBlackness = lerp(BloomBlacknessExt.x, BloomBlacknessExt.y, JKNightDayFactor);
  605. if ( JKInteriorFactor ) {
  606.     BloomBlackness = lerp(BloomBlacknessInt.x, BloomBlacknessInt.y, JKNightDayFactor);
  607. };
  608.  
  609.     float lowestvalue=min(min(xcolorbloom.x,xcolorbloom.y),xcolorbloom.z);
  610.     float3 lowestpossible=xcolorbloom.xyz-lowestvalue;
  611.     xcolorbloom.xyz=max(xcolorbloom.xyz,lowestpossible+BloomBlackness);
  612. #endif
  613.  
  614. #if (HD6_BLOOM_DEBLUEIFY==1)
  615.  
  616.     float3  nsat = lerp(DebluifyExtNight, DebluifyExtDay, JKNightDayFactor);
  617. if ( JKInteriorFactor ) {
  618.     nsat = lerp(DebluifyIntNight, DebluifyIntDay, JKNightDayFactor);
  619. };
  620.  
  621.  // store old values
  622.     float3 oldcol=xcolorbloom.xyz;
  623.  // adjust saturation
  624.     xcolorbloom.xyz *= nsat;
  625.  // spread lost luminace over everything
  626.     float3 greyc = float3(0.333,0.333,0.333); // screw perception
  627.  
  628.     xcolorbloom.xyz += (oldcol.x-(oldcol.x*nsat.x)) * greyc.x;
  629.     xcolorbloom.xyz += (oldcol.y-(oldcol.y*nsat.y)) * greyc.y;
  630.     xcolorbloom.xyz += (oldcol.z-(oldcol.z*nsat.z)) * greyc.z;
  631. #endif
  632.  
  633. #if (HD6_BLOOM_DEFUZZ==1)
  634.  
  635.     float   DefuzzAlpha = lerp(DefuzzAlphaExt.x, DefuzzAlphaExt.y, JKNightDayFactor);
  636.     float   DefuzzSub = lerp(DefuzzSubExt.x, DefuzzSubExt.y, JKNightDayFactor);
  637.     float   DefuzzAdd = lerp(DefuzzAddExt.x, DefuzzAddExt.y, JKNightDayFactor);
  638. if ( JKInteriorFactor ) {
  639.     DefuzzAlpha = lerp(DefuzzAlphaInt.x, DefuzzAlphaInt.y, JKNightDayFactor);
  640.     DefuzzSub = lerp(DefuzzSubInt.x, DefuzzSubInt.y, JKNightDayFactor);
  641.     DefuzzAdd = lerp(DefuzzAddInt.x, DefuzzAddInt.y, JKNightDayFactor);
  642. };
  643.  
  644.     float mavg=((xcolorbloom.x+xcolorbloom.y+xcolorbloom.z)*DefuzzAlpha);
  645.     xcolorbloom.xyz-=(mavg*DefuzzSub);
  646.     xcolorbloom.xyz+=(mavg*DefuzzAdd);
  647.     xcolorbloom.xyz*(mavg*1.2);
  648. #endif
  649.  
  650. #if (HD6_COLOR_TWEAKS==1)
  651.  
  652. float reduceNight = JKNightDayFactor;
  653.     reduceNight = lerp( 1, reduceNight, JKNightDayFactor ); // Removes affect during night
  654. float hbs = lerp( EBloomAmount/2, EBloomAmount, reduceNight);
  655.     hbs = max(0,hbs);
  656.     hbs = min(2,hbs);
  657.  
  658.  
  659.     float3 ctRGB = lerp(ctRGBExtNight, ctRGBExtDay, JKNightDayFactor);
  660.     float ctbrt1 = lerp(ctPreBrightnessExt.x,ctPreBrightnessExt.y,JKNightDayFactor);
  661.     float ctbrt2 = lerp(ctPostBrightnessExt.x,ctPostBrightnessExt.y,JKNightDayFactor);
  662.     float ctcon  = lerp(ctContrastExt.x,ctContrastExt.y,JKNightDayFactor);
  663.     float ctsat  = lerp(ctSaturationExt.x,ctSaturationExt.y,JKNightDayFactor);
  664.     ctbrt1 -= lerp(ctDarkenExt.x,ctDarkenExt.y,JKNightDayFactor);
  665. if ( JKInteriorFactor ) {
  666.     ctRGB = lerp(ctRGBIntNight, ctRGBIntDay, JKNightDayFactor);
  667.     ctbrt1 = lerp(ctPreBrightnessInt.x,ctPreBrightnessInt.y,JKNightDayFactor);
  668.     ctbrt2 = lerp(ctPostBrightnessInt.x,ctPostBrightnessInt.y,JKNightDayFactor);
  669.     ctcon  = lerp(ctContrastInt.x,ctContrastInt.y,JKNightDayFactor);
  670.     ctsat  = lerp(ctSaturationInt.x,ctSaturationInt.y,JKNightDayFactor);
  671.     ctbrt1 -= lerp(ctDarkenInt.x,ctDarkenInt.y,JKNightDayFactor);
  672. };
  673.  
  674.     float3 ctLumCoeff = float3(0.2125, 0.7154, 0.0721);            
  675.     float3 ctAvgLumin = float3(0.5, 0.5, 0.5);
  676.     float3 ctbrtColor = color.rgb * ctbrt1;
  677.  
  678.     float3 ctintensity = dot(ctbrtColor, ctLumCoeff);
  679.     float3 ctsatColor = lerp(ctintensity, ctbrtColor, ctsat);
  680.     float3 cconColor = lerp(ctAvgLumin, ctsatColor, ctcon);
  681.  
  682.     color.xyz = cconColor * ctbrt2;
  683.     float3 cbalance = ctRGB;
  684.     color.xyz = cbalance.xyz * color.xyz;
  685. #endif
  686.  
  687. #if (HD6_BLOOM==1)      // Bloom Crisp
  688.  
  689.     float brt = lerp(bBrightnessExt.x, bBrightnessExt.y, JKNightDayFactor);
  690.     float con = lerp(bContrastExt.x, bContrastExt.y, JKNightDayFactor);
  691.     float sat = lerp(bSaturationExt.x, bSaturationExt.y, JKNightDayFactor);
  692.     float trig = lerp(bTriggerExt.x, bTriggerExt.y, JKNightDayFactor);
  693.     float limit = lerp(bLimiterExt.x, bLimiterExt.y, JKNightDayFactor);
  694.     float addcomp = lerp(bAddCompensateExt.x, bAddCompensateExt.y, JKNightDayFactor);
  695.     float multcomp = lerp(bMultCompensateExt.x, bMultCompensateExt.y, JKNightDayFactor);
  696.     float sbrightstr = lerp(bBrtSpotStrengthExt.x, bBrtSpotStrengthExt.y, JKNightDayFactor);
  697.     float sbrightstr2 = lerp(bBrtSpotStrength2Ext.x, bBrtSpotStrength2Ext.y, JKNightDayFactor);
  698.     float orgblend = lerp(bBlendOriginalExt.x, bBlendOriginalExt.y, JKNightDayFactor);
  699.     float orgcomp = lerp(bCompOriginalExt.x, bCompOriginalExt.y, JKNightDayFactor);
  700. if ( JKInteriorFactor ) {
  701.     brt = lerp(bBrightnessInt.x, bBrightnessInt.y, JKNightDayFactor);
  702.     con = lerp(bContrastInt.x, bContrastInt.y, JKNightDayFactor);
  703.     sat = lerp(bSaturationInt.x, bSaturationInt.y, JKNightDayFactor);
  704.     trig = lerp(bTriggerInt.x, bTriggerInt.y, JKNightDayFactor);
  705.     limit = lerp(bLimiterInt.x, bLimiterInt.y, JKNightDayFactor);
  706.     addcomp = lerp(bAddCompensateInt.x, bAddCompensateInt.y, JKNightDayFactor);
  707.     multcomp = lerp(bMultCompensateInt.x, bMultCompensateInt.y, JKNightDayFactor);
  708.     sbrightstr = lerp(bBrtSpotStrengthInt.x, bBrtSpotStrengthInt.y, JKNightDayFactor);
  709.     sbrightstr2 = lerp(bBrtSpotStrength2Int.x, bBrtSpotStrength2Int.y, JKNightDayFactor);
  710.     orgblend = lerp(bBlendOriginalInt.x, bBlendOriginalInt.y, JKNightDayFactor);
  711.     orgcomp = lerp(bCompOriginalInt.x, bCompOriginalInt.y, JKNightDayFactor);
  712. };
  713.  
  714.     float3 LumCoeff = float3( 0.2125, 0.7154, 0.0721 );
  715.     float3 AvgLumin = float3( 0.5, 0.5, 0.5 );
  716.  
  717.     float3 brightbloom = ( xcolorbloom - trig); // darkens and thus limits what triggers a bloom, used in part to stop snow at night glowing blue
  718.     brightbloom = max( brightbloom , 0);
  719.  
  720.     float3 superbright = xcolorbloom - limit; // crop it to only include superbright elemnts like sky and fire
  721.     superbright = max( superbright , 0 ) ; // crop so dont go any lower than black
  722.     superbright *= 0.6;
  723.  
  724.   // HD6 - Bloom - Brightness, Contrast, Saturation adjustment
  725.     float3 brtColor = brightbloom * brt;
  726.     float3 cintensity = dot( brtColor, LumCoeff );
  727.     float3 satColor = lerp( cintensity, brtColor, sat );
  728.     float3 conColor = lerp( AvgLumin, satColor, con );
  729.     conColor -= 0.3;
  730.     brightbloom = conColor;
  731.  
  732.   // These 2 should compensate so when even when no bloom exists it still matches brightness of scene without ENB
  733.     color.xyz += addcomp; // regular color
  734.     color.xyz *= multcomp; // regular color
  735.  
  736.   #if (HD6_BLOOM==1 && HD6_COLOR_TWEAKS==1)
  737.   // Now Add bloom and compensate for any brightness changes that introduces
  738.     color.xyz += (( superbright * hbs ) * sbrightstr);
  739.     brightbloom -= ( superbright * 2 ); // removes superbright from brightbloom so I dont bloom the brightest area twice
  740.     brightbloom = max( brightbloom , 0.0 );
  741.     color.xyz += (( brightbloom * hbs ) * sbrightstr2);
  742.  
  743.   // Blend in some of the original bloom to bring back SOME of the hazy glow of the day, none at night
  744.     color.xyz += (xcolorbloom.xyz * hbs) * orgblend;
  745.     color.xyz *= orgcomp; // regular color
  746.  
  747.   #elif (HD6_BLOOM==1 && HD6_COLOR_TWEAKS==0)
  748.   // Now Add bloom and compensate for any brightness changes that introduces
  749.     color.xyz += (( superbright ) * sbrightstr);
  750.     brightbloom -= ( superbright * 2 ); // removes superbright from brightbloom so I dont bloom the brightest area twice
  751.     brightbloom = max( brightbloom , 0.0 );
  752.     color.xyz += (( brightbloom ) * sbrightstr2);
  753.  
  754.   // Blend in some of the original bloom to bring back SOME of the hazy glow of the day, none at night
  755.     color.xyz += (xcolorbloom.xyz) * orgblend;
  756.     color.xyz *= orgcomp; // compensate for brightening caused by above bloom
  757.   #endif
  758.  
  759. #elif (HD6_BLOOM==2)        // Bloom Screen
  760.  
  761.     float   BloomMult = lerp(BloomMultExt.x, BloomMultExt.y, JKNightDayFactor);
  762. if ( JKInteriorFactor ) {
  763.     BloomMult = lerp(BloomMultInt.x, BloomMultInt.y, JKNightDayFactor);
  764. };
  765.  
  766.     color+=((color/1)*EBloomAmount); // compensate if bloom disabled   
  767.     xcolorbloom=max(xcolorbloom,0); // will cause color shift/desaturation also
  768.  
  769.     float tmult = BloomMult;
  770.     color/=tmult; xcolorbloom/=tmult; // Screen mode wont work with floating point numbers / big numbers, so I reduce it first
  771.  
  772.     color.x = 1.0 - ((1.0 - color.x) * (1.0 - xcolorbloom.x));
  773.     color.y = 1.0 - ((1.0 - color.y) * (1.0 - xcolorbloom.y));
  774.     color.z = 1.0 - ((1.0 - color.z) * (1.0 - xcolorbloom.z));
  775.     color*=tmult;
  776.  
  777. #elif (HD6_BLOOM==0)        // Enabled Bloom for enbseries.ini controls
  778.     color.xyz+=xcolorbloom.xyz*EBloomAmount;
  779. #endif
  780.  
  781. #if (HD6_VIGNETTE==1)  
  782.  
  783.         float3  rovigpwr = lerp(VignetteRoundExt.x, VignetteRoundExt.y, JKNightDayFactor);
  784.         float3  sqtoppwr = lerp(VignetteSquareTopExt.x, VignetteSquareTopExt.y, JKNightDayFactor);
  785.         float3  sqbotpwr = lerp(VignetteSquareBotExt.x, VignetteSquareBotExt.y, JKNightDayFactor);
  786.         float   vsatstrength = lerp(VignetteSatExt.x, VignetteSatExt.y, JKNightDayFactor);
  787.         float   vignettepow = lerp(VignetteContrastExt.x, VignetteContrastExt.y, JKNightDayFactor);
  788.         float   vstrength = lerp(VignetteStrengthExt.x, VignetteStrengthExt.y, JKNightDayFactor);
  789.     if ( JKInteriorFactor ) {
  790.         rovigpwr = lerp(VignetteRoundInt.x, VignetteRoundInt.y, JKNightDayFactor);
  791.         sqtoppwr = lerp(VignetteSquareTopInt.x, VignetteSquareTopInt.y, JKNightDayFactor);
  792.         sqbotpwr = lerp(VignetteSquareBotInt.x, VignetteSquareBotInt.y, JKNightDayFactor);
  793.         vsatstrength = lerp(VignetteSatInt.x, VignetteSatInt.y, JKNightDayFactor);
  794.         vignettepow = lerp(VignetteContrastInt.x, VignetteContrastInt.y, JKNightDayFactor);
  795.         vstrength = lerp(VignetteStrengthInt.x, VignetteStrengthInt.y, JKNightDayFactor);
  796.     };
  797.  
  798.     float2 inTex = _v0;
  799.     float4 voriginal = r1;
  800.     float4 vcolor = voriginal;
  801.     vcolor.xyz=1;
  802.     inTex -= 0.5; // Centers vignette
  803.     inTex.y += 0.01; // Move it off center and up so it obscures sky less
  804.     float vignette = 1.0 - dot( inTex, inTex );
  805.     vcolor *= pow( vignette, vignettepow );
  806.  
  807.  // Round Vignette
  808.     float4 rvigtex = vcolor;
  809.     rvigtex.xyz = pow( vcolor, 1 );
  810.     rvigtex.xyz = lerp(float3(0.5, 0.5, 0.5), rvigtex.xyz, 2.0); // Increase Contrast
  811.     rvigtex.xyz = lerp(float3(1,1,1),rvigtex.xyz,rovigpwr); // Set strength of round vignette
  812.  
  813.  // Square Vignette (just top and bottom of screen)
  814.     float4 vigtex = vcolor;
  815.     vcolor.xyz = float3(1,1,1);
  816.     float3 topv = min((inTex.y+0.5)*2,0.5) * 2; // Top vignette
  817.     float3 botv = min(((0-inTex.y)+0.5)*2,0.5) * 2; // Bottom vignette
  818.  
  819.     topv= lerp(float3(1,1,1), topv, sqtoppwr.x);
  820.     botv= lerp(float3(1,1,1), botv, sqbotpwr.y);
  821.     vigtex.xyz = (topv)*(botv);
  822.  
  823.  // Add round and square together
  824.     vigtex.xyz*=rvigtex.xyz;
  825.     vigtex.xyz = lerp(vigtex.xyz,float3(1,1,1),(1-vstrength)); // Alter Strength at night
  826.  
  827.     vigtex.xyz = min(vigtex.xyz,1);
  828.     vigtex.xyz = max(vigtex.xyz,0);
  829.  
  830.  // Increase saturation where edges were darkenned
  831.     float3 vtintensity = dot(color.xyz, float3(0.2125, 0.7154, 0.0721));
  832.     color.xyz = lerp(vtintensity, color.xyz, ((((1-(vigtex.xyz*2))+2)-1)*vsatstrength)+1  );
  833.  
  834.     color.xyz *= (vigtex.xyz);
  835. #endif
  836.  
  837. #if (HD6_ADAPTATION==1)
  838.  
  839.     float   EAdaptationStatic = lerp(EAdaptationStaticExt.x, EAdaptationStaticExt.y, JKNightDayFactor);
  840.     float   EAdaptationComp = lerp(EAdaptationCompExt.x, EAdaptationCompExt.y, JKNightDayFactor);
  841. if ( JKInteriorFactor ) {
  842.     EAdaptationStatic = lerp(EAdaptationStaticInt.x, EAdaptationStaticInt.y, JKNightDayFactor);
  843.     EAdaptationComp = lerp(EAdaptationCompInt.x, EAdaptationCompInt.y, JKNightDayFactor);
  844. };
  845.  
  846.     float toobright = max(0,tex2D(_s2, _v0).xyz - EAdaptationStatic);
  847.     color.xyz *= EAdaptationComp-(0.5 * toobright);
  848. #endif
  849.  
  850. #if (ENB_ADAPTATION==1)
  851.  
  852.     float   EAdaptationMin = lerp(EAdaptationMinExt.x, EAdaptationMinExt.y, JKNightDayFactor);
  853.     float   EAdaptationMax = lerp(EAdaptationMaxExt.x, EAdaptationMaxExt.y, JKNightDayFactor);
  854. if ( JKInteriorFactor ) {
  855.     EAdaptationMin = lerp(EAdaptationMinInt.x, EAdaptationMinInt.y, JKNightDayFactor);
  856.     EAdaptationMax = lerp(EAdaptationMaxInt.x, EAdaptationMaxInt.y, JKNightDayFactor);
  857. };
  858.  
  859.     grayadaptation=max(grayadaptation, 0.0);
  860.     grayadaptation=min(grayadaptation, 50.0);
  861.     color.xyz=color.xyz/(grayadaptation*EAdaptationMax+EAdaptationMin);
  862. #endif
  863.  
  864. #if (PALETTE_MIXER==1)
  865.  
  866.     float   palmix = lerp(palmixExt.x, palmixExt.y, JKNightDayFactor);
  867.     float   PaletteMin = lerp(PaletteMinExt.x, PaletteMinExt.y, JKNightDayFactor);
  868.     float   PaletteMax = lerp(PaletteMaxExt.x, PaletteMaxExt.y, JKNightDayFactor);
  869. if ( JKInteriorFactor ) {
  870.     palmix = lerp(palmixInt.x, palmixInt.y, JKNightDayFactor);
  871.     PaletteMin = lerp(PaletteMinInt.x, PaletteMinInt.y, JKNightDayFactor);
  872.     PaletteMax = lerp(PaletteMaxInt.x, PaletteMaxInt.y, JKNightDayFactor);
  873. };
  874.  
  875.     color.xyz*=lerp( PaletteMin, PaletteMax, palmix);
  876. #endif
  877.  
  878. #if (POSTPROCESS==1)
  879.  
  880.     float   EContrastV1 = lerp(EContrastV1Int.x, EContrastV1Int.y, JKNightDayFactor);
  881.     float   EColorSaturationV1 = lerp(EColorSaturationV1Int.x, EColorSaturationV1Int.y, JKNightDayFactor);
  882.     float   EToneMappingCurveV1 = lerp(EToneMappingCurveV1Int.x, EToneMappingCurveV1Int.y, JKNightDayFactor);
  883.     float   EToneMappingOversaturationV1 = lerp(EToneMappingOversatV1Int.x, EToneMappingOversatV1Int.y, JKNightDayFactor);
  884. if ( JKInteriorFactor ) {
  885.     EContrastV1 = lerp(EContrastV1Ext.x, EContrastV1Ext.y, JKNightDayFactor);
  886.     EColorSaturationV1 = lerp(EColorSaturationV1Ext.x, EColorSaturationV1Ext.y, JKNightDayFactor);
  887.     EToneMappingCurveV1 = lerp(EToneMappingCurveV1Ext.x, EToneMappingCurveV1Ext.y, JKNightDayFactor);
  888.     EToneMappingOversaturationV1 = lerp(EToneMappingOversatV1Ext.x, EToneMappingOversatV1Ext.y, JKNightDayFactor);
  889. };
  890.  
  891.     float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
  892.     cgray=pow(cgray, EContrastV1);
  893.     float3 poweredcolor=pow(color.xyz, EColorSaturationV1);
  894.     float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
  895.     color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  896.  
  897.     float3  luma=color.xyz;
  898.     float   lumamax=EToneMappingOversaturationV1;
  899.     color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
  900. #endif
  901.  
  902. #if (POSTPROCESS==2)
  903.     float   EBrightnessV2 = lerp(EBrightnessV2Ext.x, EBrightnessV2Ext.y, JKNightDayFactor);
  904.     float   EIntensityContrastV2 = lerp(EIntensityContrastV2Ext.x, EIntensityContrastV2Ext.y, JKNightDayFactor);
  905.     float   EColorSaturationV2 = lerp(EColorSaturationV2Ext.x, EColorSaturationV2Ext.y, JKNightDayFactor);
  906.     float   EToneMappingCurveV2 = lerp(EToneMappingCurveV2Ext.x, EToneMappingCurveV2Ext.y, JKNightDayFactor);
  907.     float   EToneMappingOversaturationV2 = lerp(EToneMappingOversatV2Ext.x, EToneMappingOversatV2Ext.y, JKNightDayFactor);
  908.     float   EBlacknessV2 = lerp(EBlacknessV2Ext.x, EBlacknessV2Ext.y, JKNightDayFactor);
  909.     float   EPostBrightnessV2 = lerp(EPostBrightnessV2Ext.x, EPostBrightnessV2Ext.y, JKNightDayFactor);
  910. if ( JKInteriorFactor ) {
  911.     EBrightnessV2 = lerp(EBrightnessV2Int.x, EBrightnessV2Int.y, JKNightDayFactor);
  912.     EIntensityContrastV2 = lerp(EIntensityContrastV2Int.x, EIntensityContrastV2Int.y, JKNightDayFactor);
  913.     EColorSaturationV2 = lerp(EColorSaturationV2Int.x, EColorSaturationV2Int.y, JKNightDayFactor);
  914.     EToneMappingCurveV2 = lerp(EToneMappingCurveV2Int.x, EToneMappingCurveV2Int.y, JKNightDayFactor);
  915.     EToneMappingOversaturationV2 = lerp(EToneMappingOversatV2Int.x, EToneMappingOversatV2Int.y, JKNightDayFactor);
  916.     EBlacknessV2 = lerp(EBlacknessV2Int.x, EBlacknessV2Int.y, JKNightDayFactor);
  917.     EPostBrightnessV2 = lerp(EPostBrightnessV2Int.x, EPostBrightnessV2Int.y, JKNightDayFactor);
  918. };
  919.  
  920.     color.xyz*=(EBrightnessV2);
  921.     color.xyz+=EBlacknessV2;
  922.     float3 xncol=normalize(color.xyz);
  923.     float3 scl=color.xyz/xncol.xyz;
  924.     scl=pow(scl, EIntensityContrastV2);
  925.     xncol.xyz=pow(xncol.xyz, EColorSaturationV2);
  926.     color.xyz=scl*xncol.xyz;
  927.     color.xyz*=EPostBrightnessV2;
  928.     float   lumamax=EToneMappingOversaturationV2;
  929.     color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV2);
  930. #endif
  931.  
  932. #if (POSTPROCESS==3)
  933.  
  934.     float   EToneMappingOversaturationV3 = lerp(EToneMapOversatV3Int.x, EToneMapOversatV3Int.y, JKNightDayFactor);
  935.     float   EToneMappingCurveV3 = lerp(EToneMappingCurveV3Int.x, EToneMappingCurveV3Int.y, JKNightDayFactor);
  936. if ( JKInteriorFactor ) {
  937.     EToneMappingOversaturationV3 = lerp(EToneMapOversatV3Ext.x, EToneMapOversatV3Ext.y, JKNightDayFactor);
  938.     EToneMappingCurveV3 = lerp(EToneMappingCurveV3Ext.x, EToneMappingCurveV3Ext.y, JKNightDayFactor);
  939. };
  940.  
  941.     float   lumamax=EToneMappingOversaturationV3;
  942.     color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
  943. #endif
  944.  
  945. #if (POSTPROCESS==4)
  946.     float   EBrightnessCurveV4 = lerp(EBrightnessCurveV4Ext.x, EBrightnessCurveV4Ext.y, JKNightDayFactor);
  947.     float   EBrightnessMultiplierV4 = lerp(EBrightMultiplierV4Ext.x, EBrightMultiplierV4Ext.y, JKNightDayFactor);
  948.     float   EBrightnessToneMappingCurveV4 = lerp(EBrightToneMapCurveV4Ext.x, EBrightToneMapCurveV4Ext.y, JKNightDayFactor);
  949. if ( JKInteriorFactor ) {
  950.     EBrightnessCurveV4 = lerp(EBrightnessCurveV4Int.x, EBrightnessCurveV4Int.y, JKNightDayFactor);
  951.     EBrightnessMultiplierV4 = lerp(EBrightMultiplierV4Int.x, EBrightMultiplierV4Int.y, JKNightDayFactor);
  952.     EBrightnessToneMappingCurveV4 = lerp(EBrightToneMapCurveV4Int.x, EBrightToneMapCurveV4Int.y, JKNightDayFactor);
  953. };
  954.  
  955.     float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
  956.     float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  957.     float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  958.     Y=pow(Y, EBrightnessCurveV4);
  959.     Y=Y*EBrightnessMultiplierV4;
  960.     color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  961.  
  962.     color.xyz=max(color.xyz, 0.0);
  963.     color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
  964. #endif
  965.  
  966. #if (POSTPROCESS==5)
  967.  
  968.     float   EBrightnessV5 = lerp(EBrightnessV5Ext.x, EBrightnessV5Ext.y, JKNightDayFactor);
  969.     float   EIntensityContrastV5 = lerp(EIntensityContrastV5Ext.x,EIntensityContrastV5Ext.y, JKNightDayFactor);
  970.     float   EColorSaturationV5 = lerp(EColorSaturationV5Ext.x, EColorSaturationV5Ext.y, JKNightDayFactor);
  971.     float   EPostBrightnessV5 = lerp(EPostBrightnessV5Ext.x, EPostBrightnessV5Ext.y, JKNightDayFactor);
  972.     float   EToneMappingCurveV5 = lerp(EToneMappingCurveV5Ext.x, EToneMappingCurveV5Ext.y, JKNightDayFactor);
  973. if ( JKInteriorFactor ) {
  974.     EBrightnessV5 = lerp(EBrightnessV5Int.x, EBrightnessV5Int.y, JKNightDayFactor);
  975.     EIntensityContrastV5 = lerp(EIntensityContrastV5Int.x,EIntensityContrastV5Int.y, JKNightDayFactor);
  976.     EColorSaturationV5 = lerp(EColorSaturationV5Int.x, EColorSaturationV5Int.y, JKNightDayFactor);
  977.     EPostBrightnessV5 = lerp(EPostBrightnessV5Int.x, EPostBrightnessV5Int.y, JKNightDayFactor);
  978.     EToneMappingCurveV5 = lerp(EToneMappingCurveV5Int.x, EToneMappingCurveV5Int.y, JKNightDayFactor);
  979. };
  980.  
  981.     color.xyz*=EBrightnessV5;
  982.     float3 xncol=normalize(color.xyz);
  983.     float3 scl=color.xyz/xncol.xyz;
  984.     scl=pow(scl, EIntensityContrastV5);
  985.     xncol.xyz=pow(xncol.xyz, EColorSaturationV5);
  986.     color.xyz=scl*xncol.xyz;
  987.     color.xyz*=EPostBrightnessV5;
  988.     color.xyz=color.xyz/(color.xyz + EToneMappingCurveV5);
  989. #endif
  990.  
  991. #ifdef E_CC_PALETTE
  992.  
  993.     color.rgb=saturate(color.rgb);
  994.     float3  brightness=Adaptation.xyz; //tex2D(_s4, 0.5); //adaptation luminance
  995.     brightness=(brightness/(brightness+1.0));//new version
  996.     brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
  997.  
  998.     float3  palette;
  999.     float4  uvsrc=0.0;
  1000.     uvsrc.y=brightness.r;
  1001.     uvsrc.x=color.r;
  1002.     palette.r=tex2Dlod(_s7, uvsrc).r;
  1003.     uvsrc.x=color.g;
  1004.     uvsrc.y=brightness.g;
  1005.     palette.g=tex2Dlod(_s7, uvsrc).g;
  1006.     uvsrc.x=color.b;
  1007.     uvsrc.y=brightness.b;
  1008.     palette.b=tex2Dlod(_s7, uvsrc).b;  
  1009.  
  1010.  #if (PALETTE_MIXER==1)
  1011.     color.rgb=lerp( color.rgb, palette.rgb, palmix );
  1012.  #else
  1013.     color.rgb=palette.rgb;
  1014.  #endif
  1015. #endif
  1016.  
  1017.     _oC0.w=1.0;
  1018.     _oC0.xyz=color.xyz;
  1019.     return _oC0;
  1020. }
  1021.  
  1022.  
  1023. #if (ENB_FLIPTECHNIQUE==0)  //switch between vanilla and mine post processing
  1024. technique Shader_D6EC7DD1
  1025. #else
  1026. technique Shader_ORIGINALPOSTPROCESS
  1027. #endif
  1028. {
  1029.     pass p0
  1030.     {
  1031.         VertexShader  = compile vs_3_0 VS_Quad();
  1032.         PixelShader  = compile ps_3_0 PS_D6EC7DD1();
  1033.  
  1034.         ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1035.         ZEnable=FALSE;
  1036.         ZWriteEnable=FALSE;
  1037.         CullMode=NONE;
  1038.         AlphaTestEnable=FALSE;
  1039.         AlphaBlendEnable=FALSE;
  1040.         SRGBWRITEENABLE=FALSE;
  1041.     }
  1042. }
  1043.  
  1044. #if (ENB_FLIPTECHNIQUE==0)  //original shader of post processing
  1045. technique Shader_ORIGINALPOSTPROCESS
  1046. #else
  1047. technique Shader_D6EC7DD1
  1048. #endif
  1049. {
  1050.     pass p0
  1051.     {
  1052.         VertexShader  = compile vs_3_0 VS_Quad();
  1053.         PixelShader=
  1054.     asm
  1055.     {
  1056. // Parameters:
  1057. //   sampler2D Avg;
  1058. //   sampler2D Blend;
  1059. //   float4 Cinematic;
  1060. //   float4 ColorRange;
  1061. //   float4 Fade;
  1062. //   sampler2D Image;
  1063. //   float4 Param;
  1064. //   float4 Tint;
  1065. // Registers:
  1066. //   Name         Reg   Size
  1067. //   ------------ ----- ----
  1068. //   ColorRange   c1       1
  1069. //   Param        c2       1
  1070. //   Cinematic    c3       1
  1071. //   Tint         c4       1
  1072. //   Fade         c5       1
  1073. //   Image        s0       1
  1074. //   Blend        s1       1
  1075. //   Avg          s2       1
  1076. //s0 bloom result
  1077. //s1 color
  1078. //s2 is average color
  1079.  
  1080.     ps_3_0
  1081.     def c6, 0, 0, 0, 0
  1082.     //was c0 originally
  1083.     def c7, 0.212500006, 0.715399981, 0.0720999986, 1
  1084.     dcl_texcoord v0.xy
  1085.     dcl_2d s0
  1086.     dcl_2d s1
  1087.     dcl_2d s2
  1088.     rcp r0.x, c2.y
  1089.     texld r1, v0, s2
  1090.     mul r0.yz, r1.xxyw, c1.y
  1091.     rcp r0.w, r0.y
  1092.     mul r0.z, r0.w, r0.z
  1093.     texld r1, v0, s1
  1094.     mul r1.xyz, r1, c1.y
  1095.     dp3 r0.w, c7, r1
  1096.     mul r1.w, r0.w, r0.z
  1097.     mad r0.z, r0.z, r0.w, c7.w
  1098.     rcp r0.z, r0.z
  1099.     mad r0.x, r1.w, r0.x, c7.w
  1100.     mul r0.x, r0.x, r1.w
  1101.     mul r0.x, r0.z, r0.x
  1102.     cmp r0.x, -r0.w, c6.x, r0.x
  1103.     rcp r0.z, r0.w
  1104.     mul r0.z, r0.z, r0.x
  1105.     add_sat r0.x, -r0.x, c2.x
  1106.     texld r2, v0, s0
  1107.     mul r2.xyz, r2, c1.y
  1108.     mul r2.xyz, r0.x, r2
  1109.     mad r1.xyz, r1, r0.z, r2
  1110.     dp3 r0.x, r1, c7
  1111.     mov r1.w, c7.w
  1112.     lrp r2, c3.x, r1, r0.x
  1113.     mad r1, r0.x, c4, -r2
  1114.     mad r1, c4.w, r1, r2
  1115.     mad r1, c3.w, r1, -r0.y
  1116.     mad r0, c3.z, r1, r0.y
  1117.     add r1, -r0, c5
  1118.     mad oC0, c5.w, r1, r0
  1119.     };
  1120.         ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1121.         ZEnable=FALSE;
  1122.         ZWriteEnable=FALSE;
  1123.         CullMode=NONE;
  1124.         AlphaTestEnable=FALSE;
  1125.         AlphaBlendEnable=FALSE;
  1126.         SRGBWRITEENABLE=FALSE;
  1127.     }
  1128. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top