Guest User

enbeffect

a guest
Feb 25th, 2014
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 42.04 KB | None | 0 0
  1. // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  2. // | Schakusas ENB effect file |
  3. // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  4. // | Original Codes & Shaders are made by: |
  5. // | Boris, Ice, Dkt70, AAA, AMD, gp65cj04 and specially MasterKontrol |
  6. // | Edited and modifed by Schakusa: |
  7. // | Added different DoF-Versions, new tweaking lines and edited values |
  8. // | Many more ... |
  9. // | Edited by Crosire: |
  10. // | DoF code fully overhauled and rewritten, file designed (tweaking) and optimized |
  11. // | New effects injected ... |
  12. // | |
  13. // | Edited and modified by Legacyy |
  14. // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  15.  
  16. // If you need, tweak, but read! ////////////////////////////////////////////////////////
  17.  
  18. /*------------------------------------------------------------------------------
  19. | Visible Heat Settings |
  20. ------------------------------------------------------------------------------*/
  21.  
  22. #define HEATSHIT
  23.  
  24.  
  25. // +---------------------------------------+
  26. // #### | Brightness | #######################################
  27. // +---------------------------------------+
  28.  
  29. /*------------------------------------------------------------------------------
  30. | Change global Brightness and adaptation to brightness of the game. |
  31. | Lower values, darker game. |
  32. ------------------------------------------------------------------------------*/
  33. float AdaptationValue = 1.00; // Brightness Adaption
  34. float Brightness = 1.00; // Overall Brigthness
  35.  
  36.  
  37. // +---------------------------------------+
  38. // #### | Saturation | #######################################
  39. // +---------------------------------------+
  40.  
  41. /*------------------------------------------------------------------------------
  42. | 1 = Default Saturation |
  43. | 0 = Black and White colors |
  44. ------------------------------------------------------------------------------*/
  45. #define GlobalSaturation
  46. float Saturation = 1.0; // Overall Color Saturation
  47.  
  48.  
  49. // +---------------------------------------+
  50. // #### | Colorcorrection | #### icelaglace #######################
  51. // +---------------------------------------+
  52.  
  53. /*------------------------------------------------------------------------------
  54. | Gamma Correction .... |
  55. | Higher = More gamma = More contrasted image |
  56. | Lower = Less gamma = More natural image |
  57. ------------------------------------------------------------------------------*/
  58. //#define GAMMACORRECTION
  59. float GammaAmount = 1.00; // Overall Gamma
  60.  
  61. /*------------------------------------------------------------------------------
  62. | Bleach Bypass (http://en.wikipedia.org/wiki/Bleach_bypass) |
  63. | Mainly reduces saturation, increases the contrast & changes the exposure |
  64. ------------------------------------------------------------------------------*/
  65. #define BLEACH
  66. float BP_Factor = 0.1; // Overall bleaching
  67.  
  68. /*------------------------------------------------------------------------------
  69. | Filmic curve tone mapping. (http://www.filmicgames.com) |
  70. | Change the value from A to W to tweak like you want. |
  71. ------------------------------------------------------------------------------*/
  72. //#define FILMICCURVE
  73. float A = 0.20; // Shoulder Strength
  74. float B = 1.50; // Linear Strength
  75. float C = 0.20; // Linear Angle
  76. float D = 1.90; // Toe Strength
  77. float E = 0.02; // Toe Numerator
  78. float F = 1.50; // Toe Denominator
  79. float W = 11.2; // White Scale
  80.  
  81. /*------------------------------------------------------------------------------
  82. | Techicolor |
  83. ------------------------------------------------------------------------------*/
  84. //#define TECHNICOLORCORRECTION
  85. float TechniAmount = 0.25; // Maximum: 1.0
  86. float TechniPower = 5.8; // Power of colors
  87. float NegativeAmountR = 0.98; // Lower => More redish image
  88. float NegativeAmountG = 0.98; // Lower => More greenish image
  89. float NegativeAmountB = 0.98; // Lower => More blueish image
  90.  
  91. /*------------------------------------------------------------------------------
  92. | "KBL Pwning Colorcorrection 1.0 Best". Whole picture gets a more contrasted |
  93. | and colors are stronger. |
  94. ------------------------------------------------------------------------------*/
  95. //#define KBLCOLORCORRECTION
  96. float fRatio = 0.02; // Strongness
  97. float MoodR = 1.0;
  98. float MoodG = 1.0;
  99. float MoodB = 1.0;
  100.  
  101. /*------------------------------------------------------------------------------
  102. | If you want to enable colorcorrection to gamecolors, remove the "//" as |
  103. | usual. (Colors are adapted to original image then) |
  104. ------------------------------------------------------------------------------*/
  105. //#define GAMECOLORCORRECTION
  106.  
  107. /*------------------------------------------------------------------------------
  108. | Colorcorrection using a palette ("enbpalette.bmp" in the gamefolder) |
  109. | This works ONLY on ENB version 0.082!! You can manually disable it here: |
  110. ------------------------------------------------------------------------------*/
  111. //#define E_CC_PALETTE
  112.  
  113.  
  114. // +---------------------------------------+
  115. // #### | High Dynamic Range | #### DKT70 ############################
  116. // +---------------------------------------+
  117.  
  118. /*------------------------------------------------------------------------------
  119. | HDR color filter |
  120. ------------------------------------------------------------------------------*/
  121. //#define HDR
  122. float4 FogColor = {0.05, 0.05, 0.06, 0.04}; // Lens-style color filters
  123. float Defog = 0.50; // Strength of color filters
  124.  
  125. /*------------------------------------------------------------------------------
  126. | Extra image settings: |
  127. ------------------------------------------------------------------------------*/
  128. float Exposure = 0.00; // Contrast settings
  129. float BlueShift = 0.00; // Shifts entire color spectrum towards blue
  130.  
  131.  
  132. // +---------------------------------------+
  133. // #### | Bloom | #######################################
  134. // +---------------------------------------+
  135.  
  136. /*------------------------------------------------------------------------------
  137. | Overall bloom, globally. Higher values increase sun size and brightness too. |
  138. ------------------------------------------------------------------------------*/
  139. float BloomAmountMix = 0.20; // Overall Bloom
  140. float BloomAdditive = 0; // Additional Overall Bloom
  141.  
  142. /*------------------------------------------------------------------------------
  143. | Color of the bloom. |
  144. ------------------------------------------------------------------------------*/
  145. float BloomR = 1.00; // Red amount
  146. float BloomG = 0.90; // Green amount
  147. float BloomB = 1.00; // Blue amount
  148.  
  149.  
  150. // +---------------------------------------+
  151. // #### | Depth of Field | #### gp65cj04, icelaglace, Crosire ####
  152. // +---------------------------------------+
  153.  
  154. /*------------------------------------------------------------------------------
  155. | If you want (STATIC)DoF remove the "//" before "DOF". |
  156. | For dynamic DoF remove them from "DYNAMIC" too, so both are enabled!!! |
  157. ------------------------------------------------------------------------------*/
  158. //#define DOF // Only Static DoF
  159. //#define DYNAMIC // Add Dynamic DoF
  160.  
  161. /*------------------------------------------------------------------------------
  162. | DoF Quality. Only enable ONE at the same time (but one HAS to be enabled)! |
  163. | High quality is only recommended for screenshots because it eats performance |
  164. ------------------------------------------------------------------------------*/
  165. //#define DOF_LOW_QUALITY
  166. //#define DOF_NORMAL_QUALITY
  167. #define DOF_HIGH_QUALITY
  168.  
  169. /*------------------------------------------------------------------------------
  170. | If you use "AntiAliasing=true" in the enbseries.ini, change this to 2.00! |
  171. | Multiplier of DoFAmount ... |
  172. ------------------------------------------------------------------------------*/
  173. float DOFSizeMulti = 1.2; // Overall Dof Multiplier
  174.  
  175. /*------------------------------------------------------------------------------
  176. | Change the intensity of DoF here |
  177. ------------------------------------------------------------------------------*/
  178. float DOFAmount_HQ = 0.70; // Intensity when high quality enabled
  179. float DOFAmount_LQ = 0.21; // Intensity when low/normal quality enabled
  180.  
  181. /*------------------------------------------------------------------------------
  182. | Tuning Options for static DoF |
  183. ------------------------------------------------------------------------------*/
  184. float SNearBlur = -45.0; // Distance for Near Blur Depth
  185. float SFocalPlane = 1.5; // Depth of Focal Plane
  186. float SFarBlur = 95.0; // Distance for Far Blur Depth
  187. float SBlurCutoffConstant = 0.65; // Distance for Bluriness Cut-off
  188.  
  189. /*------------------------------------------------------------------------------
  190. | Tuning Options for dynamic DoF |
  191. ------------------------------------------------------------------------------*/
  192. float DNearBlur = -45.0; // Distance for Near Blur Depth
  193. float DFocalPlane = 1.0; // Depth of Focal Plane
  194. float DFarBlur = 80.0; // Distance for Far Blur Depth
  195. float DBlurCutoffConstant = 0.40; // Distance for Bluriness Cut-off
  196.  
  197. /*------------------------------------------------------------------------------
  198. | This is where the dynamic DOF is focusing, if enabled. Center = 0.5. |
  199. ------------------------------------------------------------------------------*/
  200. float2 FocusPoint = float2(0.5, 0.5);
  201.  
  202.  
  203. // +---------------------------------------+
  204. // #### | Motion Blur | #### MasterKontrol ####################
  205. // +---------------------------------------+
  206.  
  207. /*------------------------------------------------------------------------------
  208. | Quality and Strenght of Motion Blur |
  209. ------------------------------------------------------------------------------*/
  210. int MBSteps = 4; // Quality of Motion Blur
  211. int MBAmount = 0.1; // Strength of Motion Blur
  212.  
  213.  
  214. // +---------------------------------------+
  215. // #### | Vignette | ##### icelaglace ######################
  216. // +---------------------------------------+
  217.  
  218. /*------------------------------------------------------------------------------
  219. | Makes the image border edges a little darker. Choose version below: |
  220. ------------------------------------------------------------------------------*/
  221. //#define VIGNETTE_FX_NEW
  222. //#define VIGNETTE_FX_OLD
  223.  
  224. /*------------------------------------------------------------------------------
  225. | Vignette settings for FX_NEW (skyrim vignette) |
  226. ------------------------------------------------------------------------------*/
  227. float SquareTop = 0.366; // TOP of Screen
  228. float SquareBottom = 0.366; // BOTTOM of Screen
  229. float CircularPower = 0.666; // CIRCULAR Vignette Amount
  230. float ColorDistortion = 0.966; // COLOR Distortion Strength
  231. float ContrastSharpen = 1.366; // Contrast & Sharpness Increase
  232. float NightStrength = 1.666; // Strength of Effect at Night
  233.  
  234. /*------------------------------------------------------------------------------
  235. | Vignette settings for FX_OLD (icenhancer vignette) |
  236. ------------------------------------------------------------------------------*/
  237. float VignetteFocus = 12.0; // Focus
  238. float VignetteAmount = 1.3; // Amount
  239.  
  240.  
  241.  
  242. // If you need, tweak, but read! ////////////////////////////////////////////////////////
  243.  
  244. /////////////////////////////////////////////////////////////////////////////////////////
  245. //
  246. // sampler2D AdapLumSampler;
  247. // sampler2D BloomSampler;
  248. // float4 ColorCorrect;
  249. // float4 ColorShift;
  250. // float Exposure;
  251. // sampler2D GBufferTextureSampler2;
  252. // sampler2D GBufferTextureSampler3;
  253. // sampler2D HDRSampler;
  254. // sampler2D JitterSampler;
  255. // float PLAYER_MASK;
  256. // sampler2D StencilCopySampler;
  257. // float4 TexelSize;
  258. // float4 ToneMapParams;
  259. // float4 deSatContrastGamma;
  260. // float4 dofBlur;
  261. // float4 dofDist;
  262. // float4 dofProj;
  263. // float gDirectionalMotionBlurLength;
  264. // float4 globalScreenSize;
  265. // row_major float4x4 motionBlurMatrix;
  266. //
  267. // Registers:
  268. //
  269. // Name Reg Size
  270. // ---------------------------- ----- ----
  271. // globalScreenSize c44 1
  272. // Exposure c66 1
  273. // motionBlurMatrix c72 4
  274. // TexelSize c76 1
  275. // dofProj c77 1
  276. // dofDist c78 1
  277. // dofBlur c79 1
  278. // gDirectionalMotionBlurLength c80 1
  279. // ToneMapParams c81 1
  280. // deSatContrastGamma c82 1
  281. // ColorCorrect c83 1
  282. // ColorShift c84 1
  283. // PLAYER_MASK c85 1
  284. // GBufferTextureSampler2 s0 1
  285. // GBufferTextureSampler3 s1 1
  286. // HDRSampler s2 1
  287. // BloomSampler s3 1
  288. // AdapLumSampler s4 1
  289. // JitterSampler s5 1
  290. // StencilCopySampler s6 1
  291. //
  292. /////////////////////////////////////////////////////////////////////////////////////////
  293.  
  294. struct VS_OUTPUT_POST
  295. {
  296. float4 vpos : POSITION;
  297. float2 txcoord0 : TEXCOORD0;
  298. };
  299. struct VS_INPUT_POST
  300. {
  301. float3 pos : POSITION;
  302. float2 txcoord0 : TEXCOORD0;
  303. };
  304.  
  305. float4 _c44 : register(c44);
  306. float4 _c66 : register(c66);
  307. float4 _c72 : register(c72);
  308. float4 _c73 : register(c73);
  309. float4 _c74 : register(c74);
  310. float4 _c75 : register(c75);
  311. float4 _c76 : register(c76);
  312. float4 _c77 : register(c77);
  313. float4 _c78 : register(c78);
  314. float4 _c79 : register(c79);
  315. float4 _c80 : register(c80);
  316. float4 _c81 : register(c81);
  317. float4 _c82 : register(c82);
  318. float4 _c83 : register(c83);
  319. float4 _c84 : register(c84);
  320. float4 _c85 : register(c85);
  321.  
  322. texture2D texs0 : register(s0);
  323. texture2D texs1 : register(s1);
  324. texture2D texs2 : register(s2);
  325. texture2D texs3 : register(s3);
  326. texture2D texs4 : register(s4);
  327. texture2D texs5 : register(s5);
  328. texture2D texs6 : register(s6);
  329. texture2D texs7 : register(s7);
  330. texture2D texs15 : register(s15);
  331.  
  332. sampler2D s2=sampler_state { Texture=<texs2>; };
  333. sampler2D s4=sampler_state { Texture=<texs4>; };
  334. //sampler2D s5=sampler_state { Texture=<texs5>; };
  335. sampler2D s6=sampler_state { Texture=<texs6>; };
  336. sampler2D s7=sampler_state { Texture=<texs7>; };
  337. sampler2D s15=sampler_state { Texture=<texs15>; };
  338.  
  339. sampler2D s0 = sampler_state
  340. {
  341. Texture = <texs0>;
  342. MinFilter = LINEAR;
  343. MagFilter = LINEAR;
  344. MipFilter = NONE;
  345. AddressU = Clamp;
  346. AddressV = Clamp;
  347. SRGBTexture=FALSE;
  348. MaxMipLevel=0;
  349. MipMapLodBias=0;
  350. };
  351.  
  352. sampler2D s1 = sampler_state
  353. {
  354. Texture = <texs1>;
  355. MinFilter = LINEAR;
  356. MagFilter = LINEAR;
  357. MipFilter = NONE;
  358. AddressU = Clamp;
  359. AddressV = Clamp;
  360. SRGBTexture=FALSE;
  361. MaxMipLevel=0;
  362. MipMapLodBias=0;
  363. };
  364.  
  365. sampler2D s3 = sampler_state
  366. {
  367. Texture = <texs3>;
  368. MinFilter = LINEAR;
  369. MagFilter = LINEAR;
  370. MipFilter = NONE;
  371. AddressU = Clamp;
  372. AddressV = Clamp;
  373. SRGBTexture=FALSE;
  374. MaxMipLevel=0;
  375. MipMapLodBias=0;
  376. };
  377.  
  378. sampler2D s5 = sampler_state
  379. {
  380. Texture = <texs5>;
  381. MinFilter = GaussianQuad;
  382. MagFilter = GaussianQuad;
  383. MipFilter = LINEAR;
  384. AddressU = Wrap;
  385. AddressV = wrap;
  386. SRGBTexture=FALSE;
  387. MaxMipLevel=0;
  388. MipMapLodBias=0;
  389. };
  390.  
  391. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  392.  
  393. float4 PS_C215BE6E(VS_OUTPUT_POST IN) : COLOR
  394. {
  395. float4 _oC0=0.0; //output
  396.  
  397. float4 _c0=float4(0, 0.212500006, 0.715399981, 0.0720999986);
  398. float4 _c1=float4(0.25, 1, 256, 0);
  399. float4 _c2=float4(0, 2, 4, 8);
  400. float4 _c3=float4(58.1640015, 47.1300011, 0, 0);
  401. float4 _c4=float4(-0.5, -1.5, 1.5, 0.5);
  402. float4 _c5=float4(2, -1, 0.125, 0);
  403. float4 _c6=float4(256, 2, 4, 8);
  404. float4 _c7=float4(1.0, 0.1, 0.8, 1.0);
  405. float4 _c8=float4(0.0, 0.1, 0.8, 0.333);
  406. float4 _c9=float4(0.06, 0.1, 0.8, 0.1);
  407. float4 _c10=float4(0.01, 1.4, 0.0, 0.32);
  408. float4 _c11=float4(0.333333, 1.0, 0.0, 0.0);
  409. float4 _c12=float4(0.299, 0.587, 0.114, 0.0);
  410. float4 _c13=float4(0.0, 0.0, 0.0, 0.00001);
  411. float4 _c150=float4(0.55, 0.9, 0.85, 0.9);
  412. float4 _c195=float4(0.0, 0.0, 0.0, 0.07);//0.7
  413. float4 r0;
  414. float4 r1;
  415. float4 r2;
  416. float4 r3;
  417. float4 r4;
  418. float4 r5;
  419. float4 r6;
  420. float4 r7;
  421. float4 r8;
  422. float4 r9;
  423. float4 r10;
  424. float4 r11;
  425.  
  426. float4 _v0=0.0;
  427. _v0.xy=IN.txcoord0.xy;
  428.  
  429. r0=tex2D(s1, _v0.xy); //GBufferTextureSampler3
  430. r0.y=-_c77.x + _c77.y; //-dofProj.x + dofProj.y
  431. r0.y=1.0/r0.y;
  432. r0.z=r0.y * _c77.y; //dofProj.y
  433. r0.z=r0.z * -_c77.x; //dofProj.x
  434. r0.x=_c77.y * -r0.y + r0.x;
  435. r0.x=1.0/r0.x;
  436. r0.y=r0.z * r0.x;
  437.  
  438. r1=tex2D(s2, _v0.xy); //HDRSampler
  439. r2=tex2D(s3, _v0.xy); //BloomSampler
  440.  
  441. float2 center;
  442. float depth;
  443. float focus;
  444. float distance;
  445.  
  446. r0=tex2D(s1, _v0.xy); //GBufferTextureSampler3
  447. r0.y=-_c77.x + _c77.y; //-dofProj.x + dofProj.y
  448. r0.y=1.0/r0.y;
  449. r0.z=r0.y * _c77.y; //dofProj.y
  450. r0.z=r0.z * -_c77.x; //dofProj.x
  451. r0.x=_c77.y * -r0.y + r0.x;
  452. r0.x=1.0/r0.x;
  453. r0.y=r0.z * r0.x;
  454.  
  455. r0.w=abs(_c79.w);
  456. r3=_c4; //-0.5, -1.5, 1.5, 0.5
  457.  
  458. depth=r0.z * r0.x - _c78.w; //dofDist.w
  459. depth+=_c78.y * -r3.w; //dofDist.y
  460. depth+=148;//offset
  461. center.x=_v0.x-0.5;
  462. center.y=0.5-_v0.y;
  463.  
  464. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  465.  
  466. //Heatshit - Icelaglace
  467. #ifdef HEATSHIT
  468. float2 iouv = _v0.xy;
  469. float wobblypowah = depth * 0.002;
  470. iouv.x += sin(iouv.y*10+runtime* 100000)/8000.0 * wobblypowah;
  471. iouv.x += sin(iouv.y*100.0+runtime* 100000)/4000.0 * wobblypowah;
  472. float3 heatshit = tex2D(s2,iouv.xy).xyz;
  473. color.xyz += heatshit.xyz
  474. #endif
  475.  
  476. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  477.  
  478. // DOF
  479. #ifdef DOF
  480.  
  481. float4 vDofParams;
  482.  
  483. vDofParams = float4(SNearBlur, SFocalPlane, SFarBlur, SBlurCutoffConstant);
  484.  
  485. #ifdef DYNAMIC
  486.  
  487. vDofParams = float4(DNearBlur, DFocalPlane, DFarBlur, DBlurCutoffConstant);
  488.  
  489. r4=tex2D(s1, FocusPoint); //GBufferTextureSampler3
  490. r4.y=-_c77.x + _c77.y; //-dofProj.x + dofProj.y
  491. r4.y=1/r4.y;
  492. r4.z=r4.y * _c77.y; //dofProj.y
  493. r4.z=r4.z * -_c77.x; //dofProj.x
  494. r4.x=_c77.y * -r4.y + r4.x;
  495. r4.x=1/r4.x;
  496. r4.y=r4.z * r4.x;
  497.  
  498. float cdepth;
  499. cdepth=r4.z * r4.x - _c78.w; //dofDist.w
  500. cdepth+=_c78.y * -r3.w; //dofDist.y
  501. cdepth+=148;//offset
  502.  
  503. r4.w = tex2D(s0, FocusPoint).w;
  504. if(r4.w > 0)
  505. {
  506. vDofParams.z = cdepth*2.0;
  507. vDofParams.y = cdepth;
  508. }
  509. #endif
  510.  
  511. depth = max(depth, 0); //fix zoom bug
  512. float dist;
  513.  
  514. if(depth < vDofParams.y)
  515. {
  516. dist = (depth - vDofParams.y)/(vDofParams.y - vDofParams.x);
  517. }
  518. else
  519. {
  520. dist = (depth - vDofParams.y)/(vDofParams.z - vDofParams.y);
  521. dist = clamp(dist, 0, vDofParams.w);
  522. }
  523.  
  524. dist = dist * 0.5 + 0.5;
  525.  
  526. #ifdef DOF_LOW_QUALITY
  527. int DoF_Taps = 5;
  528. float radiusScale = DOFAmount_LQ;
  529. static float3 poisson[5]=
  530. {
  531. float3 (0.809, 0.41, 1),
  532. float3 (-0.809, 0.41, 1),
  533. float3 (0, 1 , 1),
  534. float3 (-0.58, -0.809, 1),
  535. float3 (0.58, -0.809, 1)
  536. };
  537. #endif
  538. #ifdef DOF_NORMAL_QUALITY
  539. int DoF_Taps = 24;
  540. float radiusScale = DOFAmount_LQ;
  541. static float3 poisson[24]=
  542. {
  543. float3(1.0, 0.0, 1.0000 ), //0 degrees
  544. float3(0.0, -1.0, 1.0000 ),
  545. float3(-1.0, 0.0, 1.0000 ),
  546. float3(0.0, 1.0, 1.0000 ),
  547. float3(0.7071, 0.7071, 1.0000 ), //45 degrees
  548. float3(0.7071, 0.7071, 1.0000 ),
  549. float3(-0.7071, -0.7071, 1.0000 ),
  550. float3(-0.7071, 0.7071, 1.0000 ),
  551. float3(0.9659, 0.2588, 1.0000 ), //15 degrees
  552. float3(0.2588, -0.9659, 1.0000 ),
  553. float3(-0.9659, -0.2588, 1.0000 ),
  554. float3(-0.2588, 0.9659, 1.0000 ),
  555. float3(0.8660, 0.5000, 1.0000 ), //60 degrees
  556. float3(0.5000, -0.8660, 1.0000 ),
  557. float3(-0.8660, -0.5000, 1.0000 ),
  558. float3(-0.5000, 0.8660, 1.0000 ),
  559. float3(0.5000, 0.8660, 1.0000 ), //30 degrees
  560. float3(0.8660, -0.5000, 1.0000 ),
  561. float3(-0.5000, -0.8660, 1.0000 ),
  562. float3(-0.8660, 0.5000, 1.0000 ),
  563. float3(0.2588, 0.9659, 1.0000 ), //75 degrees
  564. float3(0.9659, -0.2588, 1.0000 ),
  565. float3(-0.2588, -0.9659, 1.0000 ),
  566. float3(-0.9659, 0.2588, 1.0000 ),
  567. };
  568. #endif
  569. #ifdef DOF_HIGH_QUALITY
  570. int DoF_Taps = 60;
  571. float radiusScale = DOFAmount_HQ;
  572. static float3 poisson[60] =
  573. {
  574. float3( 0.2165, 0.1250, 1.0000 ),
  575. float3( 0.0000, 0.2500, 1.0000 ),
  576. float3( -0.2165, 0.1250, 1.0000 ),
  577. float3( -0.2165, -0.1250, 1.0000 ),
  578. float3( -0.0000, -0.2500, 1.0000 ),
  579. float3( 0.2165, -0.1250, 1.0000 ),
  580. float3( 0.4330, 0.2500, 1.0000 ),
  581. float3( 0.0000, 0.5000, 1.0000 ),
  582. float3( -0.4330, 0.2500, 1.0000 ),
  583. float3( -0.4330, -0.2500, 1.0000 ),
  584. float3( -0.0000, -0.5000, 1.0000 ),
  585. float3( 0.4330, -0.2500, 1.0000 ),
  586. float3( 0.6495, 0.3750, 1.0000 ),
  587. float3( 0.0000, 0.7500, 1.0000 ),
  588. float3( -0.6495, 0.3750, 1.0000 ),
  589. float3( -0.6495, -0.3750, 1.0000 ),
  590. float3( -0.0000, -0.7500, 1.0000 ),
  591. float3( 0.6495, -0.3750, 1.0000 ),
  592. float3( 0.8660, 0.5000, 1.0000 ),
  593. float3( 0.0000, 1.0000, 1.0000 ),
  594. float3( -0.8660, 0.5000, 1.0000 ),
  595. float3( -0.8660, -0.5000, 1.0000 ),
  596. float3( -0.0000, -1.0000, 1.0000 ),
  597. float3( 0.8660, -0.5000, 1.0000 ),
  598. float3( 0.2163, 0.3754, 0.8670 ),
  599. float3( -0.2170, 0.3750, 0.8670 ),
  600. float3( -0.4333, -0.0004, 0.8670 ),
  601. float3( -0.2163, -0.3754, 0.8670 ),
  602. float3( 0.2170, -0.3750, 0.8670 ),
  603. float3( 0.4333, 0.0004, 0.8670 ),
  604. float3( 0.4328, 0.5004, 0.8847 ),
  605. float3( -0.2170, 0.6250, 0.8847 ),
  606. float3( -0.6498, 0.1246, 0.8847 ),
  607. float3( -0.4328, -0.5004, 0.8847 ),
  608. float3( 0.2170, -0.6250, 0.8847 ),
  609. float3( 0.6498, -0.1246, 0.8847 ),
  610. float3( 0.6493, 0.6254, 0.9065 ),
  611. float3( -0.2170, 0.8750, 0.9065 ),
  612. float3( -0.8663, 0.2496, 0.9065 ),
  613. float3( -0.6493, -0.6254, 0.9065 ),
  614. float3( 0.2170, -0.8750, 0.9065 ),
  615. float3( 0.8663, -0.2496, 0.9065 ),
  616. float3( 0.2160, 0.6259, 0.8851 ),
  617. float3( -0.4340, 0.5000, 0.8851 ),
  618. float3( -0.6500, -0.1259, 0.8851 ),
  619. float3( -0.2160, -0.6259, 0.8851 ),
  620. float3( 0.4340, -0.5000, 0.8851 ),
  621. float3( 0.6500, 0.1259, 0.8851 ),
  622. float3( 0.4325, 0.7509, 0.8670 ),
  623. float3( -0.4340, 0.7500, 0.8670 ),
  624. float3( -0.8665, -0.0009, 0.8670 ),
  625. float3( -0.4325, -0.7509, 0.8670 ),
  626. float3( 0.4340, -0.7500, 0.8670 ),
  627. float3( 0.8665, 0.0009, 0.8670 ),
  628. float3( 0.2158, 0.8763, 0.9070 ),
  629. float3( -0.6510, 0.6250, 0.9070 ),
  630. float3( -0.8668, -0.2513, 0.9070 ),
  631. float3( -0.2158, -0.8763, 0.9070 ),
  632. float3( 0.6510, -0.6250, 0.9070 ),
  633. float3( 0.8668, 0.2513, 0.9070 )
  634. };
  635. #endif
  636.  
  637. float2 pixelSizeHigh;
  638. float2 pixelSizeLow;
  639.  
  640. pixelSizeHigh.x = 2.0 / _c44.x;
  641. pixelSizeHigh.y = 2.0 / _c44.y;
  642. pixelSizeHigh.xy *= DOFSizeMulti;
  643. pixelSizeLow.xy = pixelSizeHigh.xy;
  644.  
  645. float2 vMaxCoC = float2(5.0, 10.0);
  646. float discRadius;
  647. float discRadiusLow;
  648. float centerDepth;
  649. float4 tdepth;
  650. float4 tapHigh;
  651. float4 tapLow;
  652.  
  653. centerDepth = dist;
  654. discRadius = abs(centerDepth * vMaxCoC.y - vMaxCoC.x);
  655. discRadiusLow = discRadius * radiusScale;
  656. r1 = 0.0;
  657.  
  658. for(int t = 0; t < DoF_Taps; t++)
  659. {
  660. float2 coordLow = _v0.xy + (pixelSizeLow.xy * poisson[t].xy * discRadiusLow);
  661. float2 coordHigh = _v0.xy + (pixelSizeHigh.xy * poisson[t].xy * discRadius);
  662.  
  663. tapLow = tex2D(s2, coordLow.xy) * poisson[t].z;
  664. tapHigh = tex2D(s2, coordHigh.xy) * poisson[t].z;
  665.  
  666. tdepth = tex2D(s1, coordHigh.xy); //GBufferTextureSampler3
  667. tdepth.y = -_c77.x + _c77.y; //-dofProj.x + dofProj.y
  668. tdepth.y = 1.0 / tdepth.y;
  669. tdepth.z = tdepth.y * _c77.y; //dofProj.y
  670. tdepth.z = tdepth.z * -_c77.x; //dofProj.x
  671. tdepth.x = _c77.y * -tdepth.y + tdepth.x;
  672. tdepth.x = 1.0 / tdepth.x;
  673. tdepth.w = tdepth.z * tdepth.x - _c78.w; //dofDist.w
  674. tdepth.w += _c78.y * -r3.w; //dofDist.y
  675. //gp65cj04 fixed by Crosire
  676. tdepth.w += 148;//offset
  677.  
  678. tdepth.w = max(tdepth.w, 0); //fix zoom bug
  679.  
  680. if(tdepth.w < vDofParams.y)
  681. {
  682. tapHigh.w = (tdepth.w - vDofParams.y)/(vDofParams.y - vDofParams.x);
  683. }
  684. else
  685. {
  686. tapHigh.w = (tdepth.w - vDofParams.y)/(vDofParams.z - vDofParams.y);
  687. tapHigh.w = clamp(tapHigh.w, 0, vDofParams.w);
  688. }
  689.  
  690. tapHigh.w = tapHigh.w * 0.5 + 0.5;
  691. tapLow.w = tapHigh.w;
  692.  
  693. float tapBlur = abs(tapHigh.w * 2.0 - 1.0);
  694. float4 tap = lerp(tapHigh, tapLow, tapBlur);
  695.  
  696. if(tap.w >= centerDepth)
  697. {
  698. tap.w = 1;
  699. }
  700. else
  701. {
  702. tap.w = abs(tap.w * 2.0 - 1.0);
  703. }
  704.  
  705. r1.xyz += tap.xyz * tap.w;
  706. r1.w += tap.w;
  707. }
  708.  
  709. r1.xyz /= r1.w;
  710.  
  711. #endif
  712.  
  713. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  714.  
  715. r1.w=dot(r1.xyz, r1.xyz); //dp3
  716. r1.w=1.0/r1.w;
  717. r3 = lerp(_c0.x, r1, saturate(r1.w * 10000));
  718. r4 = r3;
  719. r5 = r3;
  720. r6 = r3;
  721. r7 = r3;
  722.  
  723. r0.x=r0.z * r0.x - _c78.w; //dofDist.w
  724. r0.x=_c78.y * -r3.w + r0.x; //dofDist.y
  725. r1.w=max(r0.x, _c0.x); //0.0
  726. r0.x=1.0/_c78.z; //dofDist.z
  727. r0.x=r1.w * r0.x;
  728. r1.w=lerp(_c79.y, _c79.z, r0.x);//dofBlur
  729. r0.x=min(_c79.z, r1.w); //dofBlur.z
  730. r0.z=dot(r7.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  731. r8.x=dot(r3.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  732. r8.y=dot(r4.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  733. r8.z=dot(r5.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  734. r8.w=dot(r6.xyz, _c0.yzw); //0.212500006, 0.715399981, 0.0720999986
  735. r1.w=dot(r8, _c1.xxxx); //0.25
  736.  
  737. r8=r8 - r1.w;
  738. r2.w=dot(r8, r8);
  739. r0.z=r0.z - r1.w;
  740. r0.z=r0.z * r0.z - r2.w;
  741. r0.x=r0.x*r0.x;
  742. if (r0.z<0.0)
  743. {
  744. r0.x=r0.x;
  745. } else r0.x=_c1.y; //1.0
  746.  
  747. r8=tex2D(s0, _v0.xy); //GBufferTextureSampler2
  748. r8.yz=_c1.yz; // 1.0, 256.0
  749. r9=r8.w * -r8.z + _c2; //0, 2, 4, 8
  750. if (r9.w<0.0)
  751. {
  752. r9=_c1.w; //0.0
  753. } else r9=_c1.y; //1.0
  754. //r9 is filtered sky mask
  755.  
  756. //r10=r8.w + tempc6;//c6.yzwx; //256, 2, 4, 8
  757. r10=r8.w * -_c6.x + _c6.yzwx; //256, 2, 4, 8
  758.  
  759. if (r10.x<0.0)
  760. {
  761. r10.x=-_c1.w; //0.0
  762. } else r10.x=-_c1.y; //1.0
  763.  
  764. if (r10.y<0.0)
  765. {
  766. r10.y=-_c1.w; //0.0
  767. } else r10.y=-_c1.y; //1.0
  768.  
  769. if (r10.z<0.0)
  770. {
  771. r10.z=-_c1.w; //0.0
  772. } else r10.z=-_c1.y; //1.0
  773.  
  774. if (r10.w<0.0)
  775. {
  776. r10.w=-_c1.w; //0.0
  777. } else r10.w=-_c1.y; //1.0
  778.  
  779. r9=r9 + r10;
  780. r9=r9 * _c4.x; //-0.5
  781.  
  782. r0.z=dot(r9, _c1.yyyy); //1.0
  783. r0.z=r0.z + _c4.w; //0.5
  784. r0.z=1.0/r0.z;
  785. r8.xzw=r3.xyz * r9.x;
  786.  
  787. r7.xyz=r7 * _c4.w + r8.xzw; //0.5
  788. r7.xyz=r4 * r9.y + r7;
  789. r7.xyz=r5 * r9.z + r7;
  790. r7.xyz=r6 * r9.w + r7;
  791. r7.xyz=r0.z * r7;
  792. r0.z=-r0.x + _c1.y; //1.0
  793. r1.w=r0.x * _c1.x; //0.25
  794.  
  795. r3.xyz=r3 * r1.w;
  796. r3.xyz=r7 * r0.z + r3;
  797. r3.xyz=r4 * r1.w + r3;
  798. r3.xyz=r5 * r1.w + r3;
  799. r3.xyz=r6 * r1.w + r3;
  800.  
  801. //r4.xyz=_v0.yxy * _c5.x + _c5.y; //2, -1
  802. r4.x=_v0.y * _c5.x + _c5.y;
  803. r4.y=_v0.x * _c5.x + _c5.y;
  804. r4.z=_v0.y * _c5.x + _c5.y;
  805.  
  806. r0.z=r4.y * _c77.z; //dofProj.z
  807. r0.z=r0.y * r0.z;
  808. r1.w=-r4.x * _c77.w; //dofProj.w
  809. r1.w=r0.y * r1.w;
  810. r5.xyz=r1.w * _c73; //motionBlurMatrix.2
  811. r5.xyz=r0.z * _c72 + r5; //motionBlurMatrix.1
  812. r5.xyz=-r0.y * _c74 + r5; //motionBlurMatrix.3
  813. r5.xyz=r5 + _c75; //motionBlurMatrix.4
  814.  
  815. r0.y=-r5.z * _c77.z; //dofProj.z
  816. r0.y=1/r0.y;
  817. r6.x=r5.x * r0.y;
  818. r0.y=r5.z * _c77.w; //dofProj.w
  819. r0.y=1/r0.y;
  820. r6.y=r5.y * r0.y;
  821. //r0.yz=-r4 + r6.xxyw;
  822. r0.yz=-r4.yz + r6.xy;
  823.  
  824. //MOTION BLUR - MasterKontrol 2012
  825. //r0.xy=r0.xyw * _c80.zxyw; //MK - This One = just landscape blur
  826. r0.xy=r0.xy * _c80.wxyz; //MK - LAST
  827. r0.z=r0.z * _c80.x; //MK - LAST
  828. r0.w=r0.w * _c80.y; //MK - LAST
  829. //r0.y=r0.y * _c80.x;
  830. //r0.z=r0.z * _c80.x;
  831.  
  832. r4.xy=r0.yz * _c5.z;
  833. r5=tex2D(s6, _v0.xy);
  834. //r1.w=r5.xy * _c85.xy + -_c85.wzx; //Player Mask, MK - This One = just landscape blur
  835. r1.w=r5.x + -_c85.xy; //Player Mask, MK - This one = all objects blur
  836. //r1.w=r5.x - _c85.x;
  837. r4.zw=r3.xy * _c2.w;
  838. r4.zw=_v0.xy * _c3.xy + r4.zw;
  839. r5=tex2D(s5, r4.zw);
  840. r4.zw=r4.xy * (r5.x - 4) + _v0.xy;
  841. r5.xyz=r3.xyz;
  842. r2.w=_c1.y;
  843. r3.w=_c1.y;
  844.  
  845. //MOTION BLUR STRENGTH - Masterkontrol 2012
  846. for (int iii=0; iii<MBSteps; iii++)
  847. {
  848. r6.x=r4.x * r3.w + r4.z;
  849. r6.y=r4.y * r3.w + r4.w;
  850. r7=tex2D(s6, r6.xy);
  851. r5.w=r7.x - _c85.x;
  852. if (r5.w<MBAmount)
  853. {
  854. r5.w=_c1.y; //1.0
  855. } else r5.w=_c1.w; //0.0
  856. r6=tex2D(s2, r6.xy);
  857. r5.xyz=r6.xyz * r5.w + r5.xyz;
  858. r2.w=r2.w + r5.w;
  859. r3.w=r3.w + _c1.y; //1.0
  860. }
  861.  
  862. r2.w=1.0/r2.w;
  863.  
  864. r0.y=r0.y * _c44.x; //GlobalScreenSize
  865. r0.z=r0.z * _c44.y; //GlobalScreenSize
  866. r0.y=dot(r0.yz, r0.yz)+_c0.x; //dp2
  867. //r0.y=sqrt(r0.y);
  868. //r0.y=1.0/r0.y;
  869. r0.y=pow(r0.y, _c4.w); //0.5
  870. r0.y=r0.y * _c4.w; //0.5
  871. r0.x=r0.x + _c1.y; //1.0
  872. r0.x=1.0/r0.x;
  873. r0.x=saturate(r0.y * r0.x);
  874. r4.xyz=r5 * r2.w - r3;
  875. r0.xyz=r0.x * r4 + r3;
  876.  
  877. if (-r1.w<0.0) r0.xyz=r3.xyz;
  878. if (-r0.w<0.0) r0.xyz=r1.xyz;
  879.  
  880. r11=r0;
  881.  
  882. r1=tex2D(s4, _c0.x); //AdapLumSampler , 0.0
  883. r0.w=1.0/r1.x;
  884. r0.w=r0.w * _c81.y; //ToneMapParams.y
  885. r1.x=1.0/r0.w;
  886. r1.x=r1.x * _c81.x; //ToneMapParams.x
  887. r1.xyz=r2 * _c66.x - r1.x; //Exposure.x
  888. r2.xyz=max(r1, _c0.x); //0.0
  889. r1.xyz=r2 * _c81.z; //ToneMapParams.z
  890. r1.xyz=r1 * _c1.x; //0.25
  891. r0.xyz=r0 * _c66.x + r1; //Exposure.x
  892. r1.xyz=r0.w * r0;
  893. r1.x=dot(r1.xyz, _c0.yzw); //0.2125, 0.7154, 0.0721
  894. r0.xyz=r0 * r0.w - r1.x;
  895. r0.xyz=_c82.x * r0 + r1.x; //deSatContrastGamma.x
  896. r0.w=r1.x * _c84.w; //ColorShift.w
  897. r1.yzw=r0.w * _c84.xxyz; //ColorShift
  898.  
  899. //darken as DarkeningAmount, but keeps colors
  900. r2.x=saturate(r0.w);
  901. r0.xyz=r0.xyz - _c84.xyz * r0.w; //ColorShift
  902. r0.xyz=r2.x * r0.xyz + r1.yzww;
  903.  
  904. //coloring (green, brown, ...)
  905. r0.xyz=2.0 * r0.xyz * _c83.xyz; //ColorCorrect
  906.  
  907. //keeps colors, changes luma
  908. r1.x=saturate(r1.x);
  909. r0.w=_c82.z - _c1.y; //deSatContrastGamma.z
  910. r2.x=pow(r1.x, r0.w);
  911.  
  912. _oC0.xyz=r0.xyz * r2.x; //orig
  913. _oC0.w=_c1.y; //1.0
  914.  
  915. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  916.  
  917. r5=tex2D(s4, _c0.x);//adaptation luminance
  918. r0=tex2D(s2, _v0.xy);//hdr color
  919. r0=r11;
  920.  
  921. //ADAPTION
  922. r5.w=r5.x;
  923. r5.w=AdaptationValue/r5.w;
  924. r0.xyz=r0 * r5.w;
  925. r3.xy=_c10.xwxw;
  926. r3.xy=r3.xy * r5.w;
  927.  
  928. //BLOOM
  929. r7=tex2D(s3, _v0.xy);
  930. r7.r *= BloomR;
  931. r7.g *= BloomG;
  932. r7.b *= BloomB;
  933. r0=r7 * BloomAdditive + r0; //0.05 //TEMP DISABLED
  934.  
  935. //BRIGHTNESS
  936. r10=dot(r0.xyz, _c12.xyz);
  937. r9.x=r10.x * Brightness;
  938. r10.x=1.0/r10.x;
  939. r10=r10 * r9.x;
  940. r0=r0 * r10.x;
  941. r0=r0 * _c7.y;
  942. r1=r0 * _c7.z;
  943. r1=r1 + _c7.w;
  944. r1.xyz=1.0/r1.xyz;
  945. r0=r0 * r1;
  946.  
  947. //SATURATION
  948. #ifdef GlobalSaturation
  949. float luma = dot(r0.xyz,_c12.xyz);
  950. float gris = dot(r0.xyz, 0.333);
  951. float3 PoweredColor = pow(r0.xyz, Saturation);
  952. float newgris = dot(PoweredColor.xyz, 0.333);
  953. r0.xyz = PoweredColor.xyz*gris/(newgris+0.0001);
  954. #endif
  955.  
  956. //HDR - DKT70
  957. #ifdef HDR
  958. r0.rgb = max(0, r0.rgb - Defog * FogColor.rgb);
  959. r0.rgb *= pow(2.0f, Exposure);
  960. float3 bshift = r0.rgb * float3(1.05f, 0.97f, 1.27f);
  961. r0.rgb = lerp(r0.rgb, bshift, BlueShift);
  962. #endif
  963.  
  964. //GAMMA
  965. #ifdef GAMMACORRECTION
  966. r0=pow(r0,1/GammaAmount);
  967. #endif
  968.  
  969. //TECHNICOLOR
  970. #ifdef TECHNICOLORCORRECTION
  971. float4 greenfilter = float4(0.30, 1.0, 0.0, 1.0);
  972. float4 redorangefilter = float4(1.05, 0.620, 0.0, 1.0);
  973. float4 cyanfilter = float4(0.0, 1.30, 1.0, 1.0);
  974. float4 magentafilter = float4(1.0, 0.0, 1.05, 1.05);
  975. float4 yellowfilter = float4(1.6, 1.6, 0.05, 1.0);
  976. float4 filtgreen = r0 * greenfilter;
  977. float4 filtblue = r0 * magentafilter;
  978. float4 filtred = r0 * redorangefilter;
  979. float4 rednegative = float((filtred.r + filtred.g + filtred.b)/(NegativeAmountR * TechniPower));
  980. float4 greennegative = float((filtgreen.r + filtgreen.g + filtgreen.b)/(NegativeAmountG* TechniPower));
  981. float4 bluenegative = float((filtblue.r+ filtblue.g + filtblue.b)/(NegativeAmountB* TechniPower));
  982. float4 redoutput = rednegative + cyanfilter;
  983. float4 greenoutput = greennegative + magentafilter;
  984. float4 blueoutput = bluenegative + yellowfilter;
  985. float4 result = redoutput * greenoutput * blueoutput;
  986. r0.rgb = lerp(r0.rgb, result, TechniAmount);
  987. #endif
  988.  
  989. //BLEACH BYPASS
  990. #ifdef BLEACH
  991. luma = dot(r0.xyz, _c12.xyz);
  992. float3 blend = luma.xxx;
  993. float L = min(1, max(0, 10*(luma - 0.45)));
  994. float3 result1 = 2.0 * r0.xyz * blend;
  995. float3 result2 = 1.0 - 2.0*(1.0 - blend)*(1.0 - r0.xyz);
  996. float3 newColor = lerp(result1.xyz, result2.xyz, L);
  997. float3 mixrgb = BP_Factor * newColor.xyz;
  998. mixrgb += ((1.0f - BP_Factor) * r0.xyz);
  999. r0.xyz = mixrgb;
  1000. #endif
  1001.  
  1002. //BLOOM ADDTIVE
  1003. r0=BloomAmountMix*r7 * r3.x + r0;
  1004.  
  1005. //FILMIC CURVE TONEMAPPING
  1006. #ifdef FILMICCURVE
  1007. float4 curr = ((r0*(A*r0+C*B)+D*E)/(r0*(A*r0+B)+D*F))-E/F;
  1008. float4 whiteScale = ((W*(A*W+C*B)+D*E)/(W*(A*W+B)+D*F))-E/F;
  1009. r0 = curr*whiteScale;
  1010. #endif
  1011.  
  1012. //COLORCORRECTION to GAMECOLORS
  1013. #ifdef GAMECOLORCORRECTION
  1014. r0.w=1.0;
  1015. luma=0.27*r0.r + 0.67*r0.g + 0.06*r0.b;
  1016. r0.xyz=r0.xyz * r0.w - luma;
  1017. r0.xyz=_c82.x * r0.xyz + luma;
  1018. r0.w=luma * _c84.w;
  1019. r1.xyz=r0.w * _c84.xyz;
  1020. r0.xyz=r0.xyz - _c84.xyz * r0.w;
  1021. r0.xyz=saturate(r0.w) * r0.xyz + r1.xyz;
  1022. r0.xyz=2.0 * r0.xyz * _c83.xyz;
  1023. luma=saturate(luma);
  1024. r0.w=_c82.z - _c1.y;
  1025. r0.xyz=r0.xyz * pow(luma, r0.w);
  1026. #endif
  1027.  
  1028. //KBL COLORCORRECTION
  1029. #ifdef KBLCOLORCORRECTION
  1030. float weight;
  1031. r2.x = dot(r0.xyz, 0.333);
  1032. r2.x = 1 - pow(2.71, -r2.x*5.2);
  1033. r2.x = r2.x * 0.17;
  1034. r0.xyz = saturate(r0.xyz - r2.x);
  1035. r0.xyz = sin(r0.xyz*1.57);
  1036. weight = 0.6 - r2.x * 0.3;
  1037. r0.xyz = lerp(r0.xyz, r0.xyz, weight);
  1038.  
  1039. r10.x = dot(r0.xyz, _c12.xyz);
  1040. r0.xyz = lerp(r0.xyz, r10.x, 0.1);
  1041. float4 colInput = r0;
  1042. float4 colMood = 1.0f;
  1043. colMood.r = MoodR;
  1044. colMood.g = MoodG;
  1045. colMood.b = MoodB;
  1046. float fLum = ( colInput.r + colInput.g + colInput.b ) / 3;
  1047. colMood = lerp(0, colMood, saturate(fLum * 2.0));
  1048. colMood = lerp(colMood, 1, saturate(fLum - 0.5) * 2.0);
  1049. float4 colOutput = lerp(colInput, colMood, saturate(fLum * fRatio));
  1050. r0.rgb=max(0, colOutput);
  1051. r0.a=1.0;
  1052. #endif
  1053.  
  1054. //PALETTE (ENB 0.082 Feature)
  1055. #ifdef E_CC_PALETTE
  1056. r0.rgb=saturate(r0.rgb);
  1057. float3 brightness=0.001;
  1058. float3 palette;
  1059. float4 uvsrc=0.0;
  1060. uvsrc.y=brightness.r;
  1061. uvsrc.x=r0.r;
  1062. palette.r=tex2Dlod(s13, uvsrc).r;
  1063. uvsrc.x=r0.g;
  1064. uvsrc.y=brightness.g;
  1065. palette.g=tex2Dlod(s13, uvsrc).g;
  1066. uvsrc.x=r0.b;
  1067. uvsrc.y=brightness.b;
  1068. palette.b=tex2Dlod(s13, uvsrc).b;
  1069. r0.rgb=palette.rgb;
  1070. #endif
  1071.  
  1072. //OLD VIGNETTE - Icelaglace
  1073. #ifdef VIGNETTE_FX_OLD
  1074. focus = length(center.xy)*1.41421;
  1075. focus = pow(focus, VignetteFocus);
  1076. r0.xyz -= focus * VignetteAmount;
  1077. #endif
  1078.  
  1079. //NEW VIGNETTE - Icelaglace
  1080. #ifdef VIGNETTE_FX_NEW
  1081. float rovigpwr = CircularPower; //for a circular vignette
  1082. float2 sqvigpwr = float2( SquareTop, SquareBottom ); // for the top and bottom of the screen
  1083. float vsatstrength = ColorDistortion; // color distortion
  1084. float vignettepow = ContrastSharpen; // increases the contrast and sharpness
  1085. float vstrengthatnight = NightStrength;
  1086.  
  1087. float2 inTex = _v0;
  1088. float vhnd = 0.5;
  1089. float4 voriginal = r0;
  1090. float4 vcolor = voriginal;
  1091. vcolor.xyz=1;
  1092. inTex -= 0.5; // center
  1093. inTex.y += 0.01; // offset from the center
  1094. float vignette = 1.0 - dot( inTex, inTex );
  1095. vcolor *= pow( vignette, vignettepow );
  1096.  
  1097. float4 rvigtex = vcolor;
  1098. rvigtex.xyz = pow( vcolor, 1 );
  1099. rvigtex.xyz = lerp(float3(0.5, 0.5, 0.5), rvigtex.xyz, 2.0); // contrast
  1100. rvigtex.xyz = lerp(float3(1,1,1),rvigtex.xyz,rovigpwr); // strength of the circular vinetty
  1101.  
  1102. //darken the top and bottom
  1103. float4 vigtex = vcolor;
  1104. vcolor.xyz = float3(1,1,1);
  1105. float3 topv = min((inTex.y+0.5)*2,1.5) * 2; // top
  1106. float3 botv = min(((0-inTex.y)+0.5)*2,1.5) * 2; // botton
  1107. topv= lerp(float3(1,1,1), topv, sqvigpwr.x);
  1108. botv= lerp(float3(1,1,1), botv, sqvigpwr.y);
  1109. vigtex.xyz = (topv)*(botv);
  1110. //vigtex.xyz = lerp(float3(1,1,1),vigtex.xyz,sqvigpwr); // strength of the top and bottom
  1111. vigtex.xyz*=rvigtex.xyz;
  1112. vigtex.xyz = lerp(vigtex.xyz,float3(1,1,1),(1-vstrengthatnight)*(1-vhnd)); //for a dark screen
  1113. vigtex.xyz = min(vigtex.xyz,1);
  1114. vigtex.xyz = max(vigtex.xyz,0);
  1115. float3 vtintensity = dot(r0.xyz, float3(0.2125, 0.7154, 0.0721));
  1116. r0.xyz = lerp(vtintensity, r0.xyz, ((((1-(vigtex.xyz*2))+2)-1)*vsatstrength)+1);
  1117. //color.xyz+=0.02;
  1118. r0.xyz *= (vigtex.xyz);
  1119. #endif
  1120.  
  1121.  
  1122. _oC0.xyz=r0.xyz;
  1123. return _oC0;
  1124. }
  1125.  
  1126. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1127.  
  1128. technique Shader_C215BE6E
  1129. {
  1130. pass p0
  1131. {
  1132. PixelShader = compile ps_3_0 PS_C215BE6E();
  1133. }
  1134. }
  1135.  
  1136. technique Shader_ORIGINALPOSTPROCESS
  1137. {
  1138. pass p0
  1139. {
  1140.  
  1141. PixelShader=
  1142. asm
  1143. {
  1144.  
  1145. /////////////////////////////////////////////////////////////////////////////////////////
  1146. //
  1147. // Generated by Microsoft (R) HLSL Shader Compiler 9.23.949.2378
  1148. //
  1149. // Parameters:
  1150. // sampler2D AdapLumSampler;
  1151. // sampler2D BloomSampler;
  1152. // float4 ColorCorrect;
  1153. // float4 ColorShift;
  1154. // float Exposure;
  1155. // sampler2D GBufferTextureSampler2;
  1156. // sampler2D GBufferTextureSampler3;
  1157. // sampler2D HDRSampler;
  1158. // sampler2D JitterSampler;
  1159. // float PLAYER_MASK;
  1160. // sampler2D StencilCopySampler;
  1161. // float4 TexelSize;
  1162. // float4 ToneMapParams;
  1163. // float4 deSatContrastGamma;
  1164. // float4 dofBlur;
  1165. // float4 dofDist;
  1166. // float4 dofProj;
  1167. // float gDirectionalMotionBlurLength;
  1168. // float4 globalScreenSize;
  1169. // row_major float4x4 motionBlurMatrix;
  1170. //
  1171. // Registers:
  1172. //
  1173. // Name Reg Size
  1174. // ---------------------------- ----- ----
  1175. // globalScreenSize c44 1
  1176. // Exposure c66 1
  1177. // motionBlurMatrix c72 4
  1178. // TexelSize c76 1
  1179. // dofProj c77 1
  1180. // dofDist c78 1
  1181. // dofBlur c79 1
  1182. // gDirectionalMotionBlurLength c80 1
  1183. // ToneMapParams c81 1
  1184. // deSatContrastGamma c82 1
  1185. // ColorCorrect c83 1
  1186. // ColorShift c84 1
  1187. // PLAYER_MASK c85 1
  1188. // GBufferTextureSampler2 s0 1
  1189. // GBufferTextureSampler3 s1 1
  1190. // HDRSampler s2 1
  1191. // BloomSampler s3 1
  1192. // AdapLumSampler s4 1
  1193. // JitterSampler s5 1
  1194. // StencilCopySampler s6 1
  1195. //
  1196. /////////////////////////////////////////////////////////////////////////////////////////
  1197.  
  1198. ps_3_0
  1199. def c0, 0, 0.212500006, 0.715399981, 0.0720999986
  1200. def c1, 0.25, 1, 256, 0
  1201. def c2, 0, 2, 4, 8
  1202. def c3, 58.1640015, 47.1300011, 0, 0
  1203. def c4, -0.5, -1.5, 1.5, 0.5
  1204. def c5, 2, -1, 0.125, 0
  1205. def c6, 256, 2, 4, 8
  1206. def c180, 0.0, 0.0, 0.0, 100.5
  1207. def c181, 1.0, 0.0, 0.0, 20.01
  1208. def c183, 800.0, 600.0, 0.0, 100.5
  1209. defi i0, 7, 0, 0, 0
  1210. dcl_texcoord v0.xy
  1211. dcl_2d s0
  1212. dcl_2d s1
  1213. dcl_2d s2
  1214. dcl_2d s3
  1215. dcl_2d s4
  1216. dcl_2d s5
  1217. dcl_2d s6
  1218. texld r0, v0, s1
  1219. add r0.y, -c77.x, c77.y
  1220. rcp r0.y, r0.y
  1221. mul r0.z, r0.y, c77.y
  1222. mul r0.z, r0.z, -c77.x
  1223. mad r0.x, c77.y, -r0.y, r0.x
  1224. rcp r0.x, r0.x
  1225. mul r0.y, r0.z, r0.x
  1226. texld r1, v0, s2
  1227. texld r2, v0, s3
  1228. abs r0.w, c79.w
  1229. mov r3, c4
  1230. mad r4.xy, c76, r3, v0
  1231. texld r4, r4, s2
  1232. mad r5.xy, c76, r3.zxzw, v0
  1233. texld r5, r5, s2
  1234. mad r3.xz, c76.xyyw, r3.wyzw, v0.xyyw
  1235. texld r6, r3.xzzw, s2
  1236. mad r3.xy, c76, r3.ywzw, v0
  1237. texld r7, r3, s2
  1238. dp3 r1.w, r4, r4
  1239. rcp r1.w, r1.w
  1240. cmp r3.xyz, -r1.w, c0.x, r4
  1241. dp3 r1.w, r5, r5
  1242. rcp r1.w, r1.w
  1243. cmp r4.xyz, -r1.w, c0.x, r5
  1244. dp3 r1.w, r6, r6
  1245. rcp r1.w, r1.w
  1246. cmp r5.xyz, -r1.w, c0.x, r6
  1247. dp3 r1.w, r7, r7
  1248. rcp r1.w, r1.w
  1249. cmp r6.xyz, -r1.w, c0.x, r7
  1250. dp3 r1.w, r1, r1
  1251. rcp r1.w, r1.w
  1252. cmp r7.xyz, -r1.w, c0.x, r1
  1253. mad r0.x, r0.z, r0.x, -c78.w
  1254. mad r0.x, c78.y, -r3.w, r0.x
  1255. max r1.w, r0.x, c0.x
  1256. rcp r0.x, c78.z
  1257. mul r0.x, r1.w, r0.x
  1258. lrp r1.w, r0.x, c79.z, c79.y
  1259. min r0.x, c79.z, r1.w
  1260. dp3 r0.z, r7, c0.yzww
  1261. dp3 r8.x, r3, c0.yzww
  1262. dp3 r8.y, r4, c0.yzww
  1263. dp3 r8.z, r5, c0.yzww
  1264. dp3 r8.w, r6, c0.yzww
  1265. dp4 r1.w, r8, c1.x
  1266. add r8, r8, -r1.w
  1267. dp4 r2.w, r8, r8
  1268. add r0.z, r0.z, -r1.w
  1269. mad r0.z, r0.z, r0.z, -r2.w
  1270. mul r0.x, r0.x, r0.x
  1271. cmp r0.x, r0.z, c1.y, r0.x
  1272. texld r8, v0, s0
  1273. mov r8.yz, c1
  1274. mad r9, r8.w, -r8.z, c2
  1275. cmp r9, r9, c1.y, c1.w
  1276. mad r10, r8.w, -c6.x, c6.yzwx
  1277. cmp r10, r10, -c1.y, -c1.w
  1278. add r9, r9, r10
  1279. mul r9, r9, c4.x
  1280. dp4 r0.z, r9, c1.y
  1281. add r0.z, r0.z, c4.w
  1282. rcp r0.z, r0.z
  1283. mul r8.xzw, r3.xyyz, r9.x
  1284. mad r7.xyz, r7, c4.w, r8.xzww
  1285. mad r7.xyz, r4, r9.y, r7
  1286. mad r7.xyz, r5, r9.z, r7
  1287. mad r7.xyz, r6, r9.w, r7
  1288. mul r7.xyz, r0.z, r7
  1289. add r0.z, -r0.x, c1.y
  1290. mul r1.w, r0.x, c1.x
  1291. mul r3.xyz, r3, r1.w
  1292. mad r3.xyz, r7, r0.z, r3
  1293. mad r3.xyz, r4, r1.w, r3
  1294. mad r3.xyz, r5, r1.w, r3
  1295. mad r3.xyz, r6, r1.w, r3
  1296. mad r4.xyz, v0.yxyw, c5.x, c5.y
  1297. mul r0.z, r4.y, c77.z
  1298. mul r0.z, r0.y, r0.z
  1299. mul r1.w, -r4.x, c77.w
  1300. mul r1.w, r0.y, r1.w
  1301. mul r5.xyz, r1.w, c73
  1302. mad r5.xyz, r0.z, c72, r5
  1303. mad r5.xyz, -r0.y, c74, r5
  1304. add r5.xyz, r5, c75
  1305. mul r0.y, -r5.z, c77.z
  1306. rcp r0.y, r0.y
  1307. mul r6.x, r5.x, r0.y
  1308. mul r0.y, r5.z, c77.w
  1309. rcp r0.y, r0.y
  1310. mul r6.y, r5.y, r0.y
  1311. add r0.yz, -r4, r6.xxyw
  1312. mul r0.yz, r0, c80.x
  1313. mul r4.xy, r0.yzzw, c5.z
  1314. texld r5, v0, s6
  1315. add r1.w, r5.x, -c85.x
  1316. mul r4.zw, r3.xyxy, c2.w
  1317. mad r4.zw, v0.xyxy, c3.xyxy, r4
  1318. texld r5, r4.zwzw, s5
  1319. add r2.w, r5.x, c4.x
  1320. mad r4.zw, r4.xyxy, r2.w, v0.xyxy
  1321. mov r5.xyz, r3
  1322. mov r2.w, c1.y
  1323. mov r3.w, c1.y
  1324.  
  1325. rep i0
  1326. mad r6.xy, r4, r3.w, r4.zwzw
  1327. texld r7, r6, s6
  1328. add r5.w, r7.x, -c85.x
  1329. cmp r5.w, r5.w, c1.w, c1.y
  1330. texld r6, r6, s2
  1331. mad r5.xyz, r6, r5.w, r5
  1332. add r2.w, r2.w, r5.w
  1333. add r3.w, r3.w, c1.y
  1334. endrep
  1335.  
  1336. rcp r2.w, r2.w
  1337. mul r0.yz, r0, c183.xxyw//c44.xxyw
  1338. dp2add r0.y, r0.yzzw, r0.yzzw, c0.x
  1339. rsq r0.y, r0.y
  1340. rcp r0.y, r0.y
  1341. mul r0.y, r0.y, c4.w
  1342. add r0.x, r0.x, c1.y
  1343. rcp r0.x, r0.x
  1344. mul_sat r0.x, r0.y, r0.x
  1345. mad r4.xyz, r5, r2.w, -r3
  1346. mad r0.xyz, r0.x, r4, r3
  1347. cmp r0.xyz, r1.w, r3, r0
  1348. cmp r0.xyz, -r0.w, r0, r1
  1349. texld r1, c0.x, s4
  1350. rcp r0.w, r1.x
  1351. mul r0.w, r0.w, c81.y
  1352. rcp r1.x, r0.w
  1353. mul r1.x, r1.x, c81.x
  1354. mad r1.xyz, r2, c66.x, -r1.x
  1355. max r2.xyz, r1, c0.x
  1356. mul r1.xyz, r2, c81.z
  1357. mul r1.xyz, r1, c1.x
  1358. mad r0.xyz, r0, c66.x, r1
  1359. mul r1.xyz, r0.w, r0
  1360. dp3 r1.x, r1, c0.yzww
  1361. mad r0.xyz, r0, r0.w, -r1.x
  1362. mad r0.xyz, c82.x, r0, r1.x
  1363. mul r0.w, r1.x, c84.w
  1364. mul r1.yzw, r0.w, c84.xxyz
  1365. mov_sat r2.x, r0.w
  1366. mad r0.xyz, c84, -r0.w, r0
  1367. mad r0.xyz, r2.x, r0, r1.yzww
  1368. mul r0.xyz, r0, c83
  1369. add r0.xyz, r0, r0
  1370. mov_sat r1.x, r1.x
  1371. add r0.w, -r8.y, c82.z
  1372. pow r2.x, r1.x, r0.w
  1373. //mul r2.x, r2.x, c181.x
  1374. mul oC0.xyz, r0, r2.x
  1375. mov oC0.w, c1.y
  1376. //texld r1, v0, s2
  1377. //mul oC0.xyz, r1, c199.z
  1378. };
  1379. }
  1380. }
Advertisement
Add Comment
Please, Sign In to add comment