Advertisement
Guest User

Schakai ENB with night eye

a guest
Mar 14th, 2014
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.30 KB | None | 0 0
  1. //++++++++++++++++++++++++++++++++++++++++++++
  2. // ENBSeries effect file
  3. // visit http://enbdev.com for updates
  4. // Copyright (c) 2007-2013 Boris Vorontsov
  5. //++++++++++++++++++++++++++++++++++++++++++++
  6.  
  7.  
  8.  
  9. //post processing mode. Change value (could be 1, 2, 3, 4). Every mode have own internal parameters, look below
  10. #ifndef POSTPROCESS
  11. #define POSTPROCESS 2
  12. #endif
  13.  
  14. //use original game processing first, then mine
  15. //#define APPLYGAMECOLORCORRECTION
  16. // #########################
  17. // BEGIN NIGHTEYE UTILITIES
  18. // #########################
  19.  
  20. // ##########################################
  21. // INCLUDE ENHANCED ENB DIAGNOSTICS HEADER
  22. // ##########################################
  23. #include "EnhancedENBDiagnostics.fxh"
  24.  
  25. float3 RGBtoHSV(float3 c)
  26. {
  27. float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
  28. float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
  29. float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
  30.  
  31. float d = q.x - min(q.w, q.y);
  32. float e = 1.0e-10;
  33. return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
  34. }
  35.  
  36. float3 HSVtoRGB(float3 c)
  37. {
  38. float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
  39. float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
  40. return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
  41. }
  42.  
  43. float randomNoise(in float3 uvw)
  44. {
  45. float3 noise = (frac(sin(dot(uvw ,float3(12.9898,78.233, 42.2442)*2.0)) * 43758.5453));
  46. return abs(noise.x + noise.y + noise.z) * 0.3333;
  47. }
  48.  
  49. float linStep(float minVal, float maxVal, float t)
  50. {
  51. return saturate((t - minVal) / (maxVal - minVal));
  52. }
  53. // #########################
  54. // END NIGHTEYE UTILITIES
  55. // #########################
  56.  
  57. //+++++++++++++++++++++++++++++
  58. //internal parameters, can be modified
  59. //+++++++++++++++++++++++++++++
  60. //modify these values to tweak various color processing
  61. //POSTPROCESS 1
  62. float EAdaptationMinV1=0.01;
  63. float EAdaptationMaxV1=0.07;
  64. float EContrastV1=0.95;
  65. float EColorSaturationV1=1.0;
  66. float EToneMappingCurveV1=6.0;
  67.  
  68. //POSTPROCESS 2
  69. //Opethfeldt's NightDay separation
  70.  
  71. //DAY
  72. float EBrightnessV2Day=1.0;
  73. float EAdaptationMinV2Day=0.04;
  74. float EAdaptationMaxV2Day=0.15;
  75. float EToneMappingCurveV2Day=8.0;
  76. float EIntensityContrastV2Day=1.4;
  77. float EToneMappingOversaturationV2Day=180.0;
  78. float EColorSaturationV2Day=2.2;
  79. //NIGHT
  80. float EBrightnessV2Night=1.0;
  81. float EAdaptationMinV2Night=0.3;
  82. float EAdaptationMaxV2Night=0.3;
  83. float EToneMappingCurveV2Night=8.0;
  84. float EIntensityContrastV2Night=1.4;
  85. float EToneMappingOversaturationV2Night=180.0;
  86. float EColorSaturationV2Night=1.4;
  87. //POSTPROCESS 3
  88. float EAdaptationMinV3=0.05;
  89. float EAdaptationMaxV3=0.125;
  90. float EToneMappingCurveV3=4.0;
  91. float EToneMappingOversaturationV3=60.0;
  92.  
  93. //POSTPROCESS 4
  94. float EAdaptationMinV4=0.2;
  95. float EAdaptationMaxV4=0.125;
  96. float EBrightnessCurveV4=0.7;
  97. float EBrightnessMultiplierV4=0.45;
  98. float EBrightnessToneMappingCurveV4=0.5;
  99.  
  100.  
  101.  
  102. //parameters for ldr color correction, if enabled
  103. float ECCGamma
  104. <
  105. string UIName="CC: Gamma";
  106. string UIWidget="Spinner";
  107. float UIMin=0.2;//not zero!!!
  108. float UIMax=5.0;
  109. > = {1.0};
  110.  
  111. float ECCInBlack
  112. <
  113. string UIName="CC: In black";
  114. string UIWidget="Spinner";
  115. float UIMin=0.0;
  116. float UIMax=1.0;
  117. > = {0.0};
  118.  
  119. float ECCInWhite
  120. <
  121. string UIName="CC: In white";
  122. string UIWidget="Spinner";
  123. float UIMin=0.0;
  124. float UIMax=1.0;
  125. > = {1.0};
  126.  
  127. float ECCOutBlack
  128. <
  129. string UIName="CC: Out black";
  130. string UIWidget="Spinner";
  131. float UIMin=0.0;
  132. float UIMax=1.0;
  133. > = {0.0};
  134.  
  135. float ECCOutWhite
  136. <
  137. string UIName="CC: Out white";
  138. string UIWidget="Spinner";
  139. float UIMin=0.0;
  140. float UIMax=1.0;
  141. > = {1.0};
  142.  
  143. float ECCBrightness
  144. <
  145. string UIName="CC: Brightness";
  146. string UIWidget="Spinner";
  147. float UIMin=0.0;
  148. float UIMax=10.0;
  149. > = {1.0};
  150.  
  151. float ECCContrastGrayLevel
  152. <
  153. string UIName="CC: Contrast gray level";
  154. string UIWidget="Spinner";
  155. float UIMin=0.01;
  156. float UIMax=0.99;
  157. > = {0.5};
  158.  
  159. float ECCContrast
  160. <
  161. string UIName="CC: Contrast";
  162. string UIWidget="Spinner";
  163. float UIMin=0.0;
  164. float UIMax=10.0;
  165. > = {1.0};
  166.  
  167. float ECCSaturation
  168. <
  169. string UIName="CC: Saturation";
  170. string UIWidget="Spinner";
  171. float UIMin=0.0;
  172. float UIMax=10.0;
  173. > = {1.0};
  174.  
  175. float ECCDesaturateShadows
  176. <
  177. string UIName="CC: Desaturate shadows";
  178. string UIWidget="Spinner";
  179. float UIMin=0.0;
  180. float UIMax=1.0;
  181. > = {0.0};
  182.  
  183. float3 ECCColorBalanceShadows <
  184. string UIName="CC: Color balance shadows";
  185. string UIWidget="Color";
  186. > = {0.5, 0.5, 0.5};
  187.  
  188. float3 ECCColorBalanceHighlights <
  189. string UIName="CC: Color balance highlights";
  190. string UIWidget="Color";
  191. > = {0.5, 0.5, 0.5};
  192.  
  193. float3 ECCChannelMixerR <
  194. string UIName="CC: Channel mixer R";
  195. string UIWidget="Color";
  196. > = {1.0, 0.0, 0.0};
  197.  
  198. float3 ECCChannelMixerG <
  199. string UIName="CC: Channel mixer G";
  200. string UIWidget="Color";
  201. > = {0.0, 1.0, 0.0};
  202.  
  203. float3 ECCChannelMixerB <
  204. string UIName="CC: Channel mixer B";
  205. string UIWidget="Color";
  206. > = {0.0, 0.0, 1.0};
  207.  
  208. // ##########################
  209. // BEGIN NIGHTEYE PARAMETERS
  210. // ##########################
  211. // #### GENERAL PARAMETERS ####
  212. bool nightEyeEnable <
  213. string UIName = "Night Eye Enable";
  214. > = {true};
  215.  
  216. // #### CALIBRATION PARAMETERS ####
  217. // #### Calibrate PARAMETERS ####
  218. bool nightEyeCalibrate <
  219. string UIName = "Night Eye Calibrate";
  220. > = {false};
  221.  
  222. float nightEyeDayMult
  223. <
  224. string UIName="Night Eye Day";
  225. string UIWidget="Spinner";
  226. float UIMin=0.0;
  227. float UIMax=100.0;
  228. float UIStep=0.01;
  229. > = {0.25};
  230.  
  231. float nightEyeDayOffset
  232. <
  233. string UIName="Night Eye Day Offset";
  234. string UIWidget="Spinner";
  235. float UIMin=-100.0;
  236. float UIMax=100.0;
  237. float UIStep=0.01;
  238. > = {-1.0};
  239.  
  240. float nightEyeNightMult
  241. <
  242. string UIName="Night Eye Night";
  243. string UIWidget="Spinner";
  244. float UIMin=0.0;
  245. float UIMax=100.0;
  246. float UIStep=0.01;
  247. > = {1.34};
  248.  
  249. float nightEyeNightOffset
  250. <
  251. string UIName="Night Eye Night Offset";
  252. string UIWidget="Spinner";
  253. float UIMin=-100.0;
  254. float UIMax=100.0;
  255. float UIStep=0.01;
  256. > = {-1.0};
  257.  
  258. float nightEyeInteriorMult
  259. <
  260. string UIName="Night Eye Interior";
  261. string UIWidget="Spinner";
  262. float UIMin=0.0;
  263. float UIMax=100.0;
  264. float UIStep=0.01;
  265. > = {1.34};
  266.  
  267. float nightEyeInteriorOffset
  268. <
  269. string UIName="Night Eye Interior Offset";
  270. string UIWidget="Spinner";
  271. float UIMin=-100.0;
  272. float UIMax=100.0;
  273. float UIStep=0.01;
  274. > = {-1.0};
  275.  
  276. // #### VIGNETTE PARAMETERS ####
  277. bool nightEyeVignetteEnable <
  278. string UIName = "Night Eye Vignette Enable";
  279. > = {false};
  280.  
  281. float nightEyeVignetteMinDistance
  282. <
  283. string UIName="Night Eye Vignette Min Distance";
  284. string UIWidget="Spinner";
  285. float UIMin=0.0;
  286. float UIMax=10.0;
  287. > = {0.5};
  288.  
  289. float nightEyeVignetteMaxDistance
  290. <
  291. string UIName="Night Eye Vignette Max Distance";
  292. string UIWidget="Spinner";
  293. float UIMin=0.0;
  294. float UIMax=10.0;
  295. > = {0.9};
  296.  
  297. float nightEyeVignetteDistancePower
  298. <
  299. string UIName="Night Eye Vignette Distance Power";
  300. string UIWidget="Spinner";
  301. float UIMin=0.0;
  302. float UIMax=10.0;
  303. > = {1.5};
  304.  
  305. float nightEyeVignetteAspectRatio
  306. <
  307. string UIName="Night Eye Vignette Aspect Ratio Power";
  308. string UIWidget="Spinner";
  309. float UIMin=0.0;
  310. float UIMax=10.0;
  311. > = {1.0};
  312.  
  313. // #### COLOR CORRECT PARAMETERS ####
  314. bool nightEyeCCEnable <
  315. string UIName = "Night Eye CC Enable";
  316. > = {true};
  317.  
  318. float nightEyeGamma
  319. <
  320. string UIName="Night Eye Gamma";
  321. string UIWidget="Spinner";
  322. float UIMin=0.0;
  323. float UIMax=10.0;
  324. > = {0.5};
  325.  
  326. float nightEyeHueShift
  327. <
  328. string UIName="Night Eye Hue Shift";
  329. string UIWidget="Spinner";
  330. float UIMin=0.0;
  331. float UIMax=100.0;
  332. > = {0.25};
  333.  
  334. float nightEyeHueSpeed
  335. <
  336. string UIName="Night Eye Hue Speed";
  337. string UIWidget="Spinner";
  338. float UIMin=-100.0;
  339. float UIMax=100.0;
  340. > = {0.0};
  341.  
  342. float nightEyeSaturationMult
  343. <
  344. string UIName="Night Eye Saturation";
  345. string UIWidget="Spinner";
  346. float UIMin=0.0;
  347. float UIMax=10.0;
  348. > = {0.0};
  349.  
  350. float nightEyeValueMult
  351. <
  352. string UIName="Night Eye Value";
  353. string UIWidget="Spinner";
  354. float UIMin=0.0;
  355. float UIMax=100.0;
  356. > = {0.5};
  357.  
  358. float3 nightEyeTint <
  359. string UIName="Night Eye Tint";
  360. string UIWidget="Color";
  361. > = {1.0, 1.0, 1.0};
  362.  
  363. float nightEyeVignetteValueMult
  364. <
  365. string UIName="Night Eye Vignette Value Mult";
  366. string UIWidget="Spinner";
  367. float UIMin=0.0;
  368. float UIMax=100.0;
  369. > = {0.0};
  370.  
  371. float nightEyeVignetteMaskMult
  372. <
  373. string UIName="Night Eye Vignette Mask Mult";
  374. string UIWidget="Spinner";
  375. float UIMin=-100.0;
  376. float UIMax=100.0;
  377. > = {1.0};
  378.  
  379. // #### BLOOM PARAMETERS ####
  380. bool nightEyeBloomEnable <
  381. string UIName = "Night Eye Bloom Enable";
  382. > = {true};
  383.  
  384. float nightEyeBloomGamma
  385. <
  386. string UIName="Night Eye Bloom Gamma";
  387. string UIWidget="Spinner";
  388. float UIMin=0.0;
  389. float UIMax=10.0;
  390. > = {1.0};
  391.  
  392. float nightEyeBloomHueShift
  393. <
  394. string UIName="Night Eye Bloom Hue Shift";
  395. string UIWidget="Spinner";
  396. float UIMin=0.0;
  397. float UIMax=100.0;
  398. > = {0.5};
  399.  
  400. float nightEyeBloomHueSpeed
  401. <
  402. string UIName="Night Eye Bloom Hue Speed";
  403. string UIWidget="Spinner";
  404. float UIMin=-100.0;
  405. float UIMax=100.0;
  406. > = {0.0};
  407.  
  408. float nightEyeBloomSaturationMult
  409. <
  410. string UIName="Night Eye Bloom Saturation";
  411. string UIWidget="Spinner";
  412. float UIMin=0.0;
  413. float UIMax=10.0;
  414. > = {1.0};
  415.  
  416. float nightEyeBloomValueMult
  417. <
  418. string UIName="Night Eye Bloom Value";
  419. string UIWidget="Spinner";
  420. float UIMin=0.0;
  421. float UIMax=100.0;
  422. > = {20.0};
  423.  
  424. float3 nightEyeBloomTint <
  425. string UIName="Night Eye Bloom Tint";
  426. string UIWidget="Color";
  427. > = {1.0, 1.0, 1.0};
  428.  
  429. float nightEyeBloomVignetteMult
  430. <
  431. string UIName="Night Eye Bloom Vignette Mult";
  432. string UIWidget="Spinner";
  433. float UIMin=0.0;
  434. float UIMax=100.0;
  435. > = {1.0};
  436.  
  437. float nightEyeBloomVignetteMaskMult
  438. <
  439. string UIName="Night Eye Bloom Vignette Mask Mult";
  440. string UIWidget="Spinner";
  441. float UIMin=-100.0;
  442. float UIMax=100.0;
  443. > = {1.0};
  444.  
  445. // #### NOISE PARAMETERS ####
  446. bool nightEyeNoiseEnable <
  447. string UIName = "Night Eye Noise Enable";
  448. > = {true};
  449.  
  450. float nightEyeNoiseMult
  451. <
  452. string UIName="Night Eye Noise Mult";
  453. string UIWidget="Spinner";
  454. float UIMin=0.0;
  455. float UIMax=100.0;
  456. > = {0.15};
  457.  
  458. float3 nightEyeNoiseTint <
  459. string UIName="Night Eye Noise Tint";
  460. string UIWidget="Color";
  461. > = {1.0, 1.0, 1.0};
  462.  
  463. float nightEyeNoiseVignetteMult
  464. <
  465. string UIName="Night Eye Noise Vignette Mult";
  466. string UIWidget="Spinner";
  467. float UIMin=0.0;
  468. float UIMax=100.0;
  469. > = {1.0};
  470.  
  471. float nightEyeNoiseVignetteMaskMult
  472. <
  473. string UIName="Night Eye Noise Vignette Mask Mult";
  474. string UIWidget="Spinner";
  475. float UIMin=-100.0;
  476. float UIMax=100.0;
  477. > = {1.0};
  478.  
  479. // #### WARP PARAMETERS ####
  480. bool nightEyeWarpEnable <
  481. string UIName = "Night Eye Warp Enable";
  482. > = {false};
  483.  
  484. float nightEyeWarpMult
  485. <
  486. string UIName="Night Eye Warp Mult";
  487. string UIWidget="Spinner";
  488. float UIMin=-100.0;
  489. float UIMax=100.0;
  490. > = {25.0};
  491.  
  492. float nightEyeWarpShift
  493. <
  494. string UIName="Night Eye Warp Shift";
  495. string UIWidget="Spinner";
  496. float UIMin=-100.0;
  497. float UIMax=100.0;
  498. > = {-0.05};
  499.  
  500. float nightEyeWarpMinDistance
  501. <
  502. string UIName="Night Eye Warp Min Distance";
  503. string UIWidget="Spinner";
  504. float UIMin=0.0;
  505. float UIMax=10.0;
  506. > = {0.4};
  507.  
  508. float nightEyeWarpMaxDistance
  509. <
  510. string UIName="Night Eye Warp Max Distance";
  511. string UIWidget="Spinner";
  512. float UIMin=0.0;
  513. float UIMax=10.0;
  514. > = {1.0};
  515.  
  516. float nightEyeWarpDistancePower
  517. <
  518. string UIName="Night Eye Warp Distance Power";
  519. string UIWidget="Spinner";
  520. float UIMin=0.0;
  521. float UIMax=10.0;
  522. > = {1.75};
  523.  
  524. float nightEyeWarpAspectRatio
  525. <
  526. string UIName="Night Eye Warp Aspect Ratio Power";
  527. string UIWidget="Spinner";
  528. float UIMin=0.0;
  529. float UIMax=10.0;
  530. > = {1.0};
  531. // #### Eyes PARAMETERS ####
  532. bool nightEyeEnableEyes <
  533. string UIName = "Night Eye Enable Eyes";
  534. > = {false};
  535.  
  536. float nightEyeEyesSeparation
  537. <
  538. string UIName="Night Eye Eyes Separation";
  539. string UIWidget="Spinner";
  540. float UIMin=0.0;
  541. float UIMax=10.0;
  542. > = {0.35};
  543.  
  544. // ##########################
  545. // END NIGHTEYE PARAMETERS
  546. // ##########################
  547.  
  548. //+++++++++++++++++++++++++++++
  549. //external parameters, do not modify
  550. //+++++++++++++++++++++++++++++
  551. //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
  552. float4 tempF1; //0,1,2,3
  553. float4 tempF2; //5,6,7,8
  554. float4 tempF3; //9,0
  555. //x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
  556. float4 Timer;
  557. //x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
  558. float4 ScreenSize;
  559. //changes in range 0..1, 0 means that night time, 1 - day time
  560. float ENightDayFactor;
  561. //changes 0 or 1. 0 means that exterior, 1 - interior
  562. float EInteriorFactor;
  563. //changes in range 0..1, 0 means full quality, 1 lowest dynamic quality (0.33, 0.66 are limits for quality levels)
  564. float EAdaptiveQualityFactor;
  565. //enb version of bloom applied, ignored if original post processing used
  566. float EBloomAmount;
  567. //fov in degrees
  568. float FieldOfView;
  569.  
  570.  
  571. texture2D texs0;//color
  572. texture2D texs1;//bloom skyrim
  573. texture2D texs2;//adaptation skyrim
  574. texture2D texs3;//bloom enb
  575. texture2D texs4;//adaptation enb
  576. texture2D texs7;//palette enb
  577.  
  578. sampler2D _s0 = sampler_state
  579. {
  580. Texture = <texs0>;
  581. MinFilter = POINT;//
  582. MagFilter = POINT;//
  583. MipFilter = NONE;//LINEAR;
  584. AddressU = Clamp;
  585. AddressV = Clamp;
  586. SRGBTexture=FALSE;
  587. MaxMipLevel=0;
  588. MipMapLodBias=0;
  589. };
  590.  
  591. sampler2D _s1 = sampler_state
  592. {
  593. Texture = <texs1>;
  594. MinFilter = LINEAR;//
  595. MagFilter = LINEAR;//
  596. MipFilter = NONE;//LINEAR;
  597. AddressU = Clamp;
  598. AddressV = Clamp;
  599. SRGBTexture=FALSE;
  600. MaxMipLevel=0;
  601. MipMapLodBias=0;
  602. };
  603.  
  604. sampler2D _s2 = sampler_state
  605. {
  606. Texture = <texs2>;
  607. MinFilter = LINEAR;//
  608. MagFilter = LINEAR;//
  609. MipFilter = NONE;//LINEAR;
  610. AddressU = Clamp;
  611. AddressV = Clamp;
  612. SRGBTexture=FALSE;
  613. MaxMipLevel=0;
  614. MipMapLodBias=0;
  615. };
  616.  
  617. sampler2D _s3 = sampler_state
  618. {
  619. Texture = <texs3>;
  620. MinFilter = LINEAR;//
  621. MagFilter = LINEAR;//
  622. MipFilter = NONE;//LINEAR;
  623. AddressU = Clamp;
  624. AddressV = Clamp;
  625. SRGBTexture=FALSE;
  626. MaxMipLevel=0;
  627. MipMapLodBias=0;
  628. };
  629.  
  630. sampler2D _s4 = sampler_state
  631. {
  632. Texture = <texs4>;
  633. MinFilter = LINEAR;//
  634. MagFilter = LINEAR;//
  635. MipFilter = NONE;//LINEAR;
  636. AddressU = Clamp;
  637. AddressV = Clamp;
  638. SRGBTexture=FALSE;
  639. MaxMipLevel=0;
  640. MipMapLodBias=0;
  641. };
  642.  
  643. sampler2D _s7 = sampler_state
  644. {
  645. Texture = <texs7>;
  646. MinFilter = LINEAR;
  647. MagFilter = LINEAR;
  648. MipFilter = NONE;
  649. AddressU = Clamp;
  650. AddressV = Clamp;
  651. SRGBTexture=FALSE;
  652. MaxMipLevel=0;
  653. MipMapLodBias=0;
  654. };
  655.  
  656. struct VS_OUTPUT_POST
  657. {
  658. float4 vpos : POSITION;
  659. float2 txcoord0 : TEXCOORD0;
  660. };
  661. struct VS_INPUT_POST
  662. {
  663. float3 pos : POSITION;
  664. float2 txcoord0 : TEXCOORD0;
  665. };
  666.  
  667.  
  668.  
  669. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  670. //
  671. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  672. VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
  673. {
  674. VS_OUTPUT_POST OUT;
  675.  
  676. OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  677.  
  678. OUT.txcoord0.xy=IN.txcoord0.xy;
  679.  
  680. return OUT;
  681. }
  682.  
  683. //skyrim shader specific externals, do not modify
  684. float4 _c1 : register(c1);
  685. float4 _c2 : register(c2);
  686. float4 _c3 : register(c3);
  687. float4 _c4 : register(c4);
  688. float4 _c5 : register(c5);
  689.  
  690. float4 PS_D6EC7DD1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
  691. {
  692. float4 _oC0=0.0; //output
  693.  
  694. float4 _c6=float4(0, 0, 0, 0);
  695. float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
  696.  
  697. float4 r0;
  698. float4 r1;
  699. float4 r2;
  700. float4 r3;
  701. float4 r4;
  702. float4 r5;
  703. float4 r6;
  704. float4 r7;
  705. float4 r8;
  706. float4 r9;
  707. float4 r10;
  708. float4 r11;
  709.  
  710.  
  711. float4 _v0=0.0;
  712.  
  713. _v0.xy=IN.txcoord0.xy;
  714.  
  715. // ################################## //
  716. // BEGIN NIGHT EYE SETUP AND WARPING //
  717. // ################################## //
  718. float2 unwarpedTxCoord = _v0.xy;
  719.  
  720. // The _c3.w value is from the game needs to be manipulated as
  721. // below to get a value from 0 (night eye off) to 1 (night eye on).
  722. // The Day, Night, and Interior GUI controls can be used to tune this.
  723. float3 nightEyeDayFactor = clamp(_c3.w + nightEyeDayOffset, 0.0, 1.0) * nightEyeDayMult;
  724. float3 nightEyeNightFactor = clamp(_c3.w + nightEyeNightOffset, 0.0, 1.0) * nightEyeNightMult;
  725. float3 nightEyeInteriorFactor = clamp(_c3.w + nightEyeInteriorOffset, 0.0, 1.0) * nightEyeInteriorMult;
  726.  
  727. // Interpolate night/day/interior
  728. float nightEyeT;;
  729. nightEyeT = nightEyeDayFactor * ENightDayFactor +
  730. nightEyeNightFactor * (1.0 - ENightDayFactor);
  731. nightEyeT = nightEyeInteriorFactor * EInteriorFactor +
  732. nightEyeT * (1.0 - EInteriorFactor);
  733. float aspectRatio = ScreenSize.z;
  734.  
  735. float2 warpVector;
  736. [branch] if(nightEyeEnable && nightEyeWarpEnable) // Warp
  737. {
  738. float2 warpedTxCoord = IN.txcoord0.xy;
  739. float2 center = float2(0.5, 0.5);
  740. float2 txCorrected = float2((warpedTxCoord.x - center.x) *
  741. aspectRatio / nightEyeWarpAspectRatio + center.x, warpedTxCoord.y);
  742. float dist;
  743. [branch]if(nightEyeEnableEyes) // Eyes (2 centers)
  744. {
  745. float2 leftEyeCenter = float2(center.x - nightEyeEyesSeparation / 2.0, center.y);
  746. float2 rightEyeCenter = float2(center.x + nightEyeEyesSeparation / 2.0, center.y);
  747. float leftEyeDist = distance(txCorrected, leftEyeCenter);
  748. float rightEyeDist = distance(txCorrected, rightEyeCenter);
  749. float leftEyeDistT = linStep(nightEyeWarpMinDistance, nightEyeWarpMaxDistance, leftEyeDist);
  750. float rightEyeDistT = linStep(nightEyeWarpMinDistance, nightEyeWarpMaxDistance, rightEyeDist);
  751. if(leftEyeDist < rightEyeDist){
  752. dist = leftEyeDist;
  753. warpVector = (txCorrected - leftEyeCenter) / leftEyeDist;
  754. }
  755. else
  756. {
  757. dist = rightEyeDist;
  758. warpVector = (txCorrected - rightEyeCenter) / rightEyeDist;
  759. }
  760. }
  761. else
  762. {
  763. dist = distance(txCorrected, center);
  764. warpVector = (txCorrected - center) / dist;
  765. }
  766.  
  767. float distT = linStep(nightEyeWarpMinDistance, nightEyeWarpMaxDistance, dist);
  768. distT = pow(distT, nightEyeWarpDistancePower);
  769. warpedTxCoord += nightEyeT * nightEyeWarpMult * -0.05 *
  770. (distT + nightEyeWarpShift * 0.1) * warpVector;
  771.  
  772. // Mirror and wrap if warped beyond screen border
  773. warpedTxCoord = fmod(abs(warpedTxCoord), 2.0);
  774. if(warpedTxCoord.x > 1.0) warpedTxCoord.x = warpedTxCoord.x - 2.0 * (warpedTxCoord.x - 1.0);
  775. if(warpedTxCoord.y > 1.0) warpedTxCoord.y = warpedTxCoord.y - 2.0 * (warpedTxCoord.y - 1.0);
  776.  
  777. _v0.xy = warpedTxCoord.xy;
  778. }
  779. // ################################ //
  780. // END NIGHT EYE SETUP AND WARPING //
  781. // ################################ //
  782.  
  783. r1=tex2D(_s0, _v0.xy); //color
  784.  
  785. //apply bloom
  786. float4 xcolorbloom=tex2D(_s3, _v0.xy);
  787.  
  788. xcolorbloom.xyz=xcolorbloom-r1;
  789. xcolorbloom.xyz=max(xcolorbloom, 0.0);
  790. r1.xyz+=xcolorbloom*EBloomAmount;
  791.  
  792. r11=r1; //my bypass
  793. _oC0.xyz=r1.xyz; //for future use without game color corrections
  794.  
  795. #ifdef APPLYGAMECOLORCORRECTION
  796. //apply original
  797. r0.x=1.0/_c2.y;
  798. r1=tex2D(_s2, _v0);
  799. r0.yz=r1.xy * _c1.y;
  800. r0.w=1.0/r0.y;
  801. r0.z=r0.w * r0.z;
  802. r1=tex2D(_s0, _v0);
  803. r1.xyz=r1 * _c1.y;
  804. r0.w=dot(_c7.xyz, r1.xyz);
  805. r1.w=r0.w * r0.z;
  806. r0.z=r0.z * r0.w + _c7.w;
  807. r0.z=1.0/r0.z;
  808. r0.x=r1.w * r0.x + _c7.w;
  809. r0.x=r0.x * r1.w;
  810. r0.x=r0.z * r0.x;
  811. if (r0.w<0) r0.x=_c6.x;
  812. r0.z=1.0/r0.w;
  813. r0.z=r0.z * r0.x;
  814. r0.x=saturate(-r0.x + _c2.x);
  815. // r2=tex2D(_s3, _v0);//enb bloom
  816. r2=tex2D(_s1, _v0);//skyrim bloom
  817. r2.xyz=r2 * _c1.y;
  818. r2.xyz=r0.x * r2;
  819. r1.xyz=r1 * r0.z + r2;
  820. r0.x=dot(r1.xyz, _c7.xyz);
  821. r1.w=_c7.w;
  822. r2=lerp(r0.x, r1, _c3.x);
  823. r1=r0.x * _c4 - r2;
  824. r1=_c4.w * r1 + r2;
  825. r1=_c3.w * r1 - r0.y; //khajiit night vision _c3.w
  826. r0=_c3.z * r1 + r0.y;
  827. r1=-r0 + _c5;
  828. _oC0=_c5.w * r1 + r0;
  829.  
  830. #endif //APPLYGAMECOLORCORRECTION
  831.  
  832. /*
  833. #ifndef APPLYGAMECOLORCORRECTION
  834. //temporary fix for khajiit night vision, but it also degrade colors.
  835. // r1=tex2D(_s2, _v0);
  836. // r0.y=r1.xy * _c1.y;
  837. r1=_oC0;
  838. r1.xyz=r1 * _c1.y;
  839. r0.x=dot(r1.xyz, _c7.xyz);
  840. r2=lerp(r0.x, r1, _c3.x);
  841. r1=r0.x * _c4 - r2;
  842. r1=_c4.w * r1 + r2;
  843. r1=_c3.w * r1;// - r0.y;
  844. r0=_c3.z * r1;// + r0.y;
  845. r1=-r0 + _c5;
  846. _oC0=_c5.w * r1 + r0;
  847. #endif //!APPLYGAMECOLORCORRECTION
  848. */
  849.  
  850. float4 color=_oC0;
  851.  
  852.  
  853. //adaptation in time
  854. float4 Adaptation=tex2D(_s4, 0.5);
  855. float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
  856. xcolorbloom=tex2D(_s3, _v0.xy); //bloom
  857. color.xyz+=xcolorbloom.xyz*EBloomAmount;
  858.  
  859. #if (POSTPROCESS==1)
  860.  
  861. grayadaptation=max(grayadaptation, 0.0);
  862. grayadaptation=min(grayadaptation, 50.0);
  863. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV1+EAdaptationMinV1);//*tempF1.x
  864.  
  865. float cgray=dot(color.xyz, float3(0.27, 0.67, 0.06));
  866. cgray=pow(cgray, EContrastV1);
  867. float3 poweredcolor=pow(color.xyz, EColorSaturationV1);
  868. float newgray=dot(poweredcolor.xyz, float3(0.27, 0.67, 0.06));
  869. color.xyz=poweredcolor.xyz*cgray/(newgray+0.0001);
  870.  
  871. float3 luma=color.xyz;
  872. float lumamax=300.0;
  873. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV1);
  874.  
  875. #endif
  876.  
  877.  
  878.  
  879. //Custom Night-Day separation
  880. #if (POSTPROCESS==2)
  881.  
  882. float newEAdaptationMax=lerp(EAdaptationMaxV2Night, EAdaptationMaxV2Day, ENightDayFactor);
  883. float newEAdaptationMin=lerp(EAdaptationMinV2Night, EAdaptationMinV2Day, ENightDayFactor);
  884. float newEBrightnessV2=lerp(EBrightnessV2Night, EBrightnessV2Day, ENightDayFactor);
  885. float newEToneMappingCurve=lerp(EToneMappingCurveV2Night, EToneMappingCurveV2Day, ENightDayFactor);
  886. float newEIntensityContrastV2=lerp(EIntensityContrastV2Night, EIntensityContrastV2Day, ENightDayFactor);
  887. float newEToneMappingOversaturationV2=lerp(EToneMappingOversaturationV2Night, EToneMappingOversaturationV2Day, ENightDayFactor);
  888. float newEColorSaturationV2=lerp(EColorSaturationV2Night, EColorSaturationV2Day, ENightDayFactor);
  889.  
  890. grayadaptation=max(grayadaptation, 0.0);
  891. grayadaptation=min(grayadaptation, 50.0);
  892. color.xyz=color.xyz/(grayadaptation*newEAdaptationMax+newEAdaptationMin);//*tempF1.x
  893.  
  894. color.xyz*=(newEBrightnessV2);
  895.  
  896. color.xyz+=0.000001;
  897. float3 xncol=normalize(color.xyz);
  898. float3 scl=color.xyz/xncol.xyz;
  899. scl=pow(scl, newEIntensityContrastV2);
  900. xncol.xyz=pow(xncol.xyz, newEColorSaturationV2);
  901. color.xyz=scl*xncol.xyz;
  902.  
  903. float lumamax=newEToneMappingOversaturationV2;
  904.  
  905. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + newEToneMappingCurve);
  906. #endif
  907.  
  908.  
  909. #if (POSTPROCESS==3)
  910.  
  911. grayadaptation=max(grayadaptation, 0.0);
  912. grayadaptation=min(grayadaptation, 50.0);
  913. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV3+EAdaptationMinV3);//*tempF1.x
  914.  
  915. float lumamax=EToneMappingOversaturationV3;
  916. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + EToneMappingCurveV3);
  917.  
  918. #endif
  919.  
  920. //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
  921. //color.xyz=tex2D(_s0, _v0.xy) + xcolorbloom.xyz*float3(0.7, 0.6, 1.0)*0.5;
  922. //color.xyz*=0.7;
  923.  
  924.  
  925. #if (POSTPROCESS==4)
  926.  
  927. grayadaptation=max(grayadaptation, 0.0);
  928. grayadaptation=min(grayadaptation, 50.0);
  929. color.xyz=color.xyz/(grayadaptation*EAdaptationMaxV4+EAdaptationMinV4);
  930.  
  931. float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
  932. float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  933. float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  934. Y=pow(Y, EBrightnessCurveV4);
  935. Y=Y*EBrightnessMultiplierV4;
  936. // Y=Y/(Y+EBrightnessToneMappingCurveV4);
  937. // float desaturatefact=saturate(Y*Y*Y*1.7);
  938. // U=lerp(U, 0.0, desaturatefact);
  939. // V=lerp(V, 0.0, desaturatefact);
  940. color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  941.  
  942. color.xyz=max(color.xyz, 0.0);
  943. color.xyz=color.xyz/(color.xyz+EBrightnessToneMappingCurveV4);
  944.  
  945. #endif
  946.  
  947.  
  948.  
  949. //pallete texture (0.082+ version feature)
  950. #ifdef E_CC_PALETTE
  951. color.rgb=saturate(color.rgb);
  952. float3 brightness=Adaptation.xyz;//tex2D(_s4, 0.5);//adaptation luminance
  953. // brightness=saturate(brightness);//old version from ldr games
  954. brightness=(brightness/(brightness+1.0));//new version
  955. brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
  956. float3 palette;
  957. float4 uvsrc=0.0;
  958. uvsrc.y=brightness.r;
  959. uvsrc.x=color.r;
  960. palette.r=tex2Dlod(_s7, uvsrc).r;
  961. uvsrc.x=color.g;
  962. uvsrc.y=brightness.g;
  963. palette.g=tex2Dlod(_s7, uvsrc).g;
  964. uvsrc.x=color.b;
  965. uvsrc.y=brightness.b;
  966. palette.b=tex2Dlod(_s7, uvsrc).b;
  967. color.rgb=palette.rgb;
  968. #endif //E_CC_PALETTE
  969.  
  970.  
  971.  
  972. #ifdef E_CC_PROCEDURAL
  973. float tempgray;
  974. float4 tempvar;
  975. float3 tempcolor;
  976. /*
  977. //these replaced by "levels"
  978. //+++ gamma
  979. if (ECCGamma!=1.0)
  980. color=pow(color, 1.0/ECCGamma);
  981.  
  982. //+++ brightness like in photoshop
  983. color=color+ECCAditiveBrightness;
  984.  
  985. //+++ lightness
  986. tempvar.x=saturate(ELightness);
  987. tempvar.y=saturate(1.0+ECCLightness);
  988. color=tempvar.x*(1.0-color) + (tempvar.y*color);
  989. */
  990. //+++ levels like in photoshop, including gamma, lightness, additive brightness
  991. color=max(color-ECCInBlack, 0.0) / max(ECCInWhite-ECCInBlack, 0.0001);
  992. if (ECCGamma!=1.0) color=pow(color, ECCGamma);
  993. color=color*(ECCOutWhite-ECCOutBlack) + ECCOutBlack;
  994.  
  995. //+++ brightness
  996. color=color*ECCBrightness;
  997.  
  998. //+++ contrast
  999. color=(color-ECCContrastGrayLevel) * ECCContrast + ECCContrastGrayLevel;
  1000.  
  1001. //+++ saturation
  1002. tempgray=dot(color, 0.3333);
  1003. color=lerp(tempgray, color, ECCSaturation);
  1004.  
  1005. //+++ desaturate shadows
  1006. tempgray=dot(color, 0.3333);
  1007. tempvar.x=saturate(1.0-tempgray);
  1008. tempvar.x*=tempvar.x;
  1009. tempvar.x*=tempvar.x;
  1010. color=lerp(color, tempgray, ECCDesaturateShadows*tempvar.x);
  1011.  
  1012. //+++ color balance
  1013. color=saturate(color);
  1014. tempgray=dot(color, 0.3333);
  1015. float2 shadow_highlight=float2(1.0-tempgray, tempgray);
  1016. shadow_highlight*=shadow_highlight;
  1017. color.rgb+=(ECCColorBalanceHighlights*2.0-1.0)*color * shadow_highlight.x;
  1018. color.rgb+=(ECCColorBalanceShadows*2.0-1.0)*(1.0-color) * shadow_highlight.y;
  1019.  
  1020. //+++ channel mixer
  1021. tempcolor=color;
  1022. color.r=dot(tempcolor, ECCChannelMixerR);
  1023. color.g=dot(tempcolor, ECCChannelMixerG);
  1024. color.b=dot(tempcolor, ECCChannelMixerB);
  1025. #endif //E_CC_PROCEDURAL
  1026.  
  1027.  
  1028. // ##############################
  1029. // BEGIN NIGHTEYE IMPLEMENTATION
  1030. // ##############################
  1031. if(nightEyeEnable)
  1032. {
  1033. float vignette = 0.0;
  1034. if(nightEyeVignetteEnable) // Add Vignette
  1035. {
  1036. float2 vignetteTxCoord = IN.txcoord0.xy;
  1037. float2 center = float2(0.5, 0.5);
  1038. float2 txCorrected = float2((vignetteTxCoord.x - center.x) *
  1039. aspectRatio / nightEyeVignetteAspectRatio + center.x, vignetteTxCoord.y);
  1040. float dist;
  1041. [branch]if(nightEyeEnableEyes) // Eyes (2 centers)
  1042. {
  1043. float2 leftEyeCenter = float2(center.x - nightEyeEyesSeparation / 2.0, center.y);
  1044. float2 rightEyeCenter = float2(center.x + nightEyeEyesSeparation / 2.0, center.y);
  1045. float leftEyeDist = distance(txCorrected, leftEyeCenter);
  1046. float rightEyeDist = distance(txCorrected, rightEyeCenter);
  1047. dist = min(leftEyeDist, rightEyeDist);
  1048. }
  1049. else
  1050. {
  1051. dist = distance(txCorrected, center);
  1052. }
  1053. float distT = linStep(nightEyeVignetteMinDistance, nightEyeVignetteMaxDistance, dist);
  1054. vignette = pow(distT, nightEyeVignetteDistancePower);
  1055. }
  1056.  
  1057. if(nightEyeCCEnable) // Color Correct
  1058. {
  1059. float3 nightEye = color.xyz;
  1060. nightEye = pow(nightEye, nightEyeGamma);
  1061. nightEye = RGBtoHSV(nightEye);
  1062. nightEye.x += nightEyeHueShift + nightEyeHueSpeed * Timer.x * 1000.0;
  1063. nightEye.y *= nightEyeSaturationMult;
  1064. nightEye.z *= nightEyeValueMult;
  1065. nightEye = HSVtoRGB(nightEye);
  1066. nightEye *= nightEyeTint;
  1067. float mask = vignette;
  1068. if(nightEyeVignetteMaskMult < 0) mask = -1.0 * (1.0 - vignette);
  1069. mask *= nightEyeVignetteMaskMult;
  1070. nightEye *= (1.0 - mask) + (mask * nightEyeVignetteValueMult);
  1071. color.xyz = saturate((nightEye.xyz * nightEyeT) + (color.xyz * (1.0 - nightEyeT)));
  1072. //color.xyz = lerp(color.xyz, nightEye.xyz, t);
  1073. }
  1074.  
  1075. if(nightEyeBloomEnable) // Add Bloom
  1076. {
  1077. float3 nightEyeBloom = tex2D(_s3, _v0);
  1078. nightEyeBloom = pow(nightEyeBloom, nightEyeBloomGamma);
  1079. nightEyeBloom = RGBtoHSV(nightEyeBloom);
  1080. nightEyeBloom.x += nightEyeBloomHueShift + nightEyeBloomHueSpeed * Timer.x * 1000.0;
  1081. nightEyeBloom.y *= nightEyeBloomSaturationMult;
  1082. nightEyeBloom.z *= nightEyeBloomValueMult;
  1083. nightEyeBloom = HSVtoRGB(nightEyeBloom);
  1084. nightEyeBloom *= nightEyeBloomTint;
  1085. float mask = vignette;
  1086. if(nightEyeBloomVignetteMaskMult < 0) mask = -1.0 * (1.0 - vignette);
  1087. mask *= nightEyeBloomVignetteMaskMult;
  1088. nightEyeBloom *= (1.0 - mask) + (mask * nightEyeBloomVignetteMult);
  1089. nightEyeBloom *= nightEyeT;
  1090. color.xyz= saturate(color.xyz + nightEyeBloom.xyz);
  1091. }
  1092.  
  1093. if(nightEyeNoiseEnable) // Add Noise
  1094. {
  1095. float3 noiseCoord = float3(_v0.x, _v0.y, Timer.x);
  1096. float3 nightEyeNoise = randomNoise(noiseCoord);
  1097. nightEyeNoise *= nightEyeNoiseMult;
  1098. nightEyeNoise *= nightEyeNoiseTint;
  1099. float mask = vignette;
  1100. if(nightEyeNoiseVignetteMaskMult < 0) mask = -1.0 * (1.0 - vignette);
  1101. mask *= nightEyeNoiseVignetteMaskMult;
  1102. nightEyeNoise *= mask + ((1.0 - mask) * nightEyeNoiseVignetteMult);
  1103. nightEyeNoise *= nightEyeT;
  1104. color.xyz = saturate(color.xyz + nightEyeNoise.xyz);
  1105. }
  1106. if(nightEyeCalibrate) // Calibrate
  1107. {
  1108.  
  1109. float2 calibrateCoords = IN.txcoord0;
  1110. float4 calibrateText = 0;
  1111. calibrateText += float4(1.0, 1.0, 0.0, 1.0) *
  1112. EED_drawFloatText(
  1113. //ASCII N i g h
  1114. float4(78, 105, 103, 104),
  1115. // ACII t E y e
  1116. float4(116, 69, 121, 101),
  1117. nightEyeT,
  1118. calibrateCoords,
  1119. float2(0.85, 0),
  1120. 1.2,
  1121. 6 // precision
  1122. );
  1123.  
  1124. calibrateText += EED_drawFloatText(
  1125. //ASCII N i g h
  1126. float4(78, 105, 103, 104),
  1127. // ACII t D a y
  1128. float4(116, 68, 97, 121),
  1129. ENightDayFactor,
  1130. calibrateCoords,
  1131. float2(0.85, 0.05),
  1132. 1.0,
  1133. 6 // precision
  1134. );
  1135.  
  1136. calibrateText += EED_drawFloatText(
  1137. //ASCII I n t e
  1138. float4(73, 110, 116, 101),
  1139. // ACII r i o r
  1140. float4(114, 105, 111, 114),
  1141. EInteriorFactor,
  1142. calibrateCoords,
  1143. float2(0.85, 0.075),
  1144. 1.0,
  1145. 6 // precision
  1146. );
  1147.  
  1148. calibrateText += EED_drawCRegistersText(_c1, _c2, _c3, _c4, _c5,
  1149. calibrateCoords, float2(0.85, 0.125), 1.0, 6);
  1150.  
  1151. color.xyz += calibrateText.xyz;
  1152. }
  1153.  
  1154. }
  1155. // ##############################
  1156. // END NIGHTEYE IMPLEMENTATION
  1157. // ##############################
  1158.  
  1159. _oC0.w=1.0;
  1160. _oC0.xyz=color.xyz;
  1161. return _oC0;
  1162. }
  1163.  
  1164.  
  1165.  
  1166. //switch between vanilla and mine post processing
  1167. #ifndef ENB_FLIPTECHNIQUE
  1168. technique Shader_D6EC7DD1
  1169. #else
  1170. technique Shader_ORIGINALPOSTPROCESS
  1171. #endif
  1172.  
  1173. {
  1174. pass p0
  1175. {
  1176. VertexShader = compile vs_3_0 VS_Quad();
  1177. PixelShader = compile ps_3_0 PS_D6EC7DD1();
  1178.  
  1179. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1180. ZEnable=FALSE;
  1181. ZWriteEnable=FALSE;
  1182. CullMode=NONE;
  1183. AlphaTestEnable=FALSE;
  1184. AlphaBlendEnable=FALSE;
  1185. SRGBWRITEENABLE=FALSE;
  1186. }
  1187. }
  1188.  
  1189.  
  1190.  
  1191. //original shader of post processing
  1192. #ifndef ENB_FLIPTECHNIQUE
  1193. technique Shader_ORIGINALPOSTPROCESS
  1194. #else
  1195. technique Shader_D6EC7DD1
  1196.  
  1197. #endif
  1198. {
  1199. pass p0
  1200. {
  1201. VertexShader = compile vs_3_0 VS_Quad();
  1202. PixelShader=
  1203. asm
  1204. {
  1205. // Parameters:
  1206. // sampler2D Avg;
  1207. // sampler2D Blend;
  1208. // float4 Cinematic;
  1209. // float4 ColorRange;
  1210. // float4 Fade;
  1211. // sampler2D Image;
  1212. // float4 Param;
  1213. // float4 Tint;
  1214. // Registers:
  1215. // Name Reg Size
  1216. // ------------ ----- ----
  1217. // ColorRange c1 1
  1218. // Param c2 1
  1219. // Cinematic c3 1
  1220. // Tint c4 1
  1221. // Fade c5 1
  1222. // Image s0 1
  1223. // Blend s1 1
  1224. // Avg s2 1
  1225. //s0 bloom result
  1226. //s1 color
  1227. //s2 is average color
  1228.  
  1229. ps_3_0
  1230. def c6, 0, 0, 0, 0
  1231. //was c0 originally
  1232. def c7, 0.212500006, 0.715399981, 0.0720999986, 1
  1233. dcl_texcoord v0.xy
  1234. dcl_2d s0
  1235. dcl_2d s1
  1236. dcl_2d s2
  1237. rcp r0.x, c2.y
  1238. texld r1, v0, s2
  1239. mul r0.yz, r1.xxyw, c1.y
  1240. rcp r0.w, r0.y
  1241. mul r0.z, r0.w, r0.z
  1242. texld r1, v0, s1
  1243. mul r1.xyz, r1, c1.y
  1244. dp3 r0.w, c7, r1
  1245. mul r1.w, r0.w, r0.z
  1246. mad r0.z, r0.z, r0.w, c7.w
  1247. rcp r0.z, r0.z
  1248. mad r0.x, r1.w, r0.x, c7.w
  1249. mul r0.x, r0.x, r1.w
  1250. mul r0.x, r0.z, r0.x
  1251. cmp r0.x, -r0.w, c6.x, r0.x
  1252. rcp r0.z, r0.w
  1253. mul r0.z, r0.z, r0.x
  1254. add_sat r0.x, -r0.x, c2.x
  1255. texld r2, v0, s0
  1256. mul r2.xyz, r2, c1.y
  1257. mul r2.xyz, r0.x, r2
  1258. mad r1.xyz, r1, r0.z, r2
  1259. dp3 r0.x, r1, c7
  1260. mov r1.w, c7.w
  1261. lrp r2, c3.x, r1, r0.x
  1262. mad r1, r0.x, c4, -r2
  1263. mad r1, c4.w, r1, r2
  1264. mad r1, c3.w, r1, -r0.y
  1265. mad r0, c3.z, r1, r0.y
  1266. add r1, -r0, c5
  1267. mad oC0, c5.w, r1, r0
  1268. };
  1269. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1270. ZEnable=FALSE;
  1271. ZWriteEnable=FALSE;
  1272. CullMode=NONE;
  1273. AlphaTestEnable=FALSE;
  1274. AlphaBlendEnable=FALSE;
  1275. SRGBWRITEENABLE=FALSE;
  1276. }
  1277. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement