Guest User

Original NLA ENBEffect.fx

a guest
Mar 5th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 46.33 KB | None | 0 0
  1. //++++++++++++++++++++++++++++++++++++++++++++
  2. // ENBSeries effect file
  3. // visit http://enbdev.com for updates
  4. // Copyright (c) 2007-2013 Boris Vorontsov
  5. // Nighteye code by scegielski http://www.nexusmods.com/skyrim/mods/50731/?
  6. //++++++++++++++++++++++++++++++++++++++++++++
  7.  
  8. //use original game processing first, then mine
  9. //#define APPLYGAMECOLORCORRECTION
  10.  
  11. //#define LETTERBOX_BARS 1 // Enable Matso's cinematic bars (black bars at top and bottom).
  12.  
  13. // #########################
  14. // BEGIN NIGHTEYE UTILITIES
  15. // #########################
  16.  
  17. // ##########################################
  18. // INCLUDE ENHANCED ENB DIAGNOSTICS HEADER
  19. // ##########################################
  20. #include "EnhancedENBDiagnostics.fxh"
  21.  
  22. float3 RGBtoHSV(float3 c)
  23. {
  24. float4 K = float4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);
  25. float4 p = lerp(float4(c.bg, K.wz), float4(c.gb, K.xy), step(c.b, c.g));
  26. float4 q = lerp(float4(p.xyw, c.r), float4(c.r, p.yzx), step(p.x, c.r));
  27.  
  28. float d = q.x - min(q.w, q.y);
  29. float e = 1.0e-10;
  30. return float3(abs(q.z + (q.w - q.y) / (6.0 * d + e)), d / (q.x + e), q.x);
  31. }
  32.  
  33. float3 HSVtoRGB(float3 c)
  34. {
  35. float4 K = float4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);
  36. float3 p = abs(frac(c.xxx + K.xyz) * 6.0 - K.www);
  37. return c.z * lerp(K.xxx, saturate(p - K.xxx), c.y);
  38. }
  39.  
  40. float randomNoise(in float3 uvw)
  41. {
  42. float3 noise = (frac(sin(dot(uvw ,float3(12.9898,78.233, 42.2442)*2.0)) * 43758.5453));
  43. return abs(noise.x + noise.y + noise.z) * 0.3333;
  44. }
  45.  
  46. float linStep(float minVal, float maxVal, float t)
  47. {
  48. return saturate((t - minVal) / (maxVal - minVal));
  49. }
  50. // #########################
  51. // END NIGHTEYE UTILITIES
  52. // #########################
  53.  
  54. //+++++++++++++++++++++++++++++
  55. //internal parameters, can be modified
  56. //+++++++++++++++++++++++++++++
  57.  
  58. // Interior controls
  59.  
  60. float AdaptationMinInterior
  61. <
  62. string UIName="A: Adaptation Min Interior";
  63. string UIWidget="Spinner";
  64. float UIMin=0.000;
  65. float UIMax=1.0;
  66. > = {0.003};
  67.  
  68. float AdaptationMaxInterior
  69. <
  70. string UIName="A: Adaptation Max Interior";
  71. string UIWidget="Spinner";
  72. float UIMin=0.000;
  73. float UIMax=1.0;
  74. > = {0.004};
  75.  
  76. float PaletteInterior
  77. <
  78. string UIName="CC: Palette Intensity Interior";
  79. string UIWidget="Spinner";
  80. float UIMin=0.0;
  81. float UIMax=5.0;
  82. > = {1.0};
  83.  
  84. float PaletteBrightnessInterior
  85. <
  86. string UIName="CC: Palette Gamma Interior";
  87. string UIWidget="Spinner";
  88. float UIMin=1.0;
  89. float UIMax=5.0;
  90. > = {3.0};
  91.  
  92. float GammaInterior
  93. <
  94. string UIName="CC: Gamma Interior";
  95. string UIWidget="Spinner";
  96. float UIMin=0.0;
  97. float UIMax=5.0;
  98. > = {1.1};
  99.  
  100. float RedFilterInterior
  101. <
  102. string UIName="CC: Red Filter Interior";
  103. string UIWidget="Spinner";
  104. float UIMin=0.0;
  105. float UIMax=1.0;
  106. > = {0.98};
  107.  
  108. float GreenFilterInterior
  109. <
  110. string UIName="CC: Green Filter Interior";
  111. string UIWidget="Spinner";
  112. float UIMin=0.0;
  113. float UIMax=1.0;
  114. > = {0.98};
  115.  
  116. float BlueFilterInterior
  117. <
  118. string UIName="CC: Blue Filter Interior";
  119. string UIWidget="Spinner";
  120. float UIMin=0.0;
  121. float UIMax=1.0;
  122. > = {1.0};
  123.  
  124. float DesatRInterior
  125. <
  126. string UIName="CC: Desat Red Interior";
  127. string UIWidget="Spinner";
  128. float UIMin=0.0;
  129. float UIMax=1.0;
  130. > = {1.0};
  131.  
  132. float DesatGInterior
  133. <
  134. string UIName="CC: Desat Green Interior";
  135. string UIWidget="Spinner";
  136. float UIMin=0.0;
  137. float UIMax=1.0;
  138. > = {0.2};
  139.  
  140. float DesatBInterior
  141. <
  142. string UIName="CC: Desat Blue Interior";
  143. string UIWidget="Spinner";
  144. float UIMin=0.0;
  145. float UIMax=1.0;
  146. > = {0.6};
  147.  
  148. float IntensityContrastInterior
  149. <
  150. string UIName="TM: Intensity Contrast Interior";
  151. string UIWidget="Spinner";
  152. float UIMin=0.0;
  153. float UIMax=10.0;
  154. > = {1.3};
  155.  
  156. float SaturationInterior
  157. <
  158. string UIName="TM: Saturation Interior";
  159. string UIWidget="Spinner";
  160. float UIMin=0.0;
  161. float UIMax=10.0;
  162. > = {1.3};
  163.  
  164. float ToneMappingCurveInterior
  165. <
  166. string UIName="TM: ToneMapping Curve Interior";
  167. string UIWidget="Spinner";
  168. float UIMin=0.0;
  169. float UIMax=10.0;
  170. > = {1.8};
  171.  
  172. float ToneMappingOversaturationInterior
  173. <
  174. string UIName="TM: ToneMapping Oversaturation Interior";
  175. string UIWidget="Spinner";
  176. float UIMin=0.1;
  177. float UIMax=999.0;
  178. > = {20.0};
  179.  
  180. float BrightnessInterior
  181. <
  182. string UIName="B: Brightness Interior";
  183. string UIWidget="Spinner";
  184. float UIMin=0.0;
  185. float UIMax=1.0;
  186. > = {0.15};
  187.  
  188. float BrightnessCurveInterior
  189. <
  190. string UIName="B: Brightness Curve Interior";
  191. string UIWidget="Spinner";
  192. float UIMin=0.0;
  193. float UIMax=10.0;
  194. > = {1.22};
  195.  
  196. float BrightnessMultiplierInterior
  197. <
  198. string UIName="B: Brightness Multiplier Interior";
  199. string UIWidget="Spinner";
  200. float UIMin=0.0;
  201. float UIMax=1.0;
  202. > = {0.15};
  203.  
  204. float BrightnessToneMappingCurveInterior
  205. <
  206. string UIName="B: Brightness ToneMapping Curve Interior";
  207. string UIWidget="Spinner";
  208. float UIMin=0.0;
  209. float UIMax=1.0;
  210. > = {0.15};
  211.  
  212. // Exterior controls
  213. // Day
  214.  
  215. float AdaptationMinDay
  216. <
  217. string UIName="A: Adaptation Min Day";
  218. string UIWidget="Spinner";
  219. float UIMin=0.000;
  220. float UIMax=1.0;
  221. > = {0.00038};
  222.  
  223. float AdaptationMaxDay
  224. <
  225. string UIName="A: Adaptation Max Day";
  226. string UIWidget="Spinner";
  227. float UIMin=0.000;
  228. float UIMax=1.0;
  229. > = {0.042};
  230.  
  231. float PaletteDay
  232. <
  233. string UIName="CC: Palette Intensity Day";
  234. string UIWidget="Spinner";
  235. float UIMin=0.0;
  236. float UIMax=5.0;
  237. > = {1.05};
  238.  
  239. float PaletteBrightnessDay
  240. <
  241. string UIName="CC: Palette Gamma Day";
  242. string UIWidget="Spinner";
  243. float UIMin=1.0;
  244. float UIMax=3.0;
  245. > = {1.0};
  246.  
  247. float GammaDay
  248. <
  249. string UIName="CC: Gamma Day";
  250. string UIWidget="Spinner";
  251. float UIMin=0.0;
  252. float UIMax=5.0;
  253. > = {1.38};
  254.  
  255. float RedFilterDay
  256. <
  257. string UIName="CC: Red Filter Day";
  258. string UIWidget="Spinner";
  259. float UIMin=0.0;
  260. float UIMax=1.0;
  261. > = {1.0};
  262.  
  263. float GreenFilterDay
  264. <
  265. string UIName="CC: Green Filter Day";
  266. string UIWidget="Spinner";
  267. float UIMin=0.0;
  268. float UIMax=1.0;
  269. > = {1.0};
  270.  
  271. float BlueFilterDay
  272. <
  273. string UIName="CC: Blue Filter Day";
  274. string UIWidget="Spinner";
  275. float UIMin=0.0;
  276. float UIMax=1.0;
  277. > = {1.0};
  278.  
  279. float DesatRDay
  280. <
  281. string UIName="CC: Desat Red Day";
  282. string UIWidget="Spinner";
  283. float UIMin=0.0;
  284. float UIMax=1.0;
  285. > = {1.0};
  286.  
  287. float DesatGDay
  288. <
  289. string UIName="CC: Desat Green Day";
  290. string UIWidget="Spinner";
  291. float UIMin=0.0;
  292. float UIMax=1.0;
  293. > = {0.1};
  294.  
  295. float DesatBDay
  296. <
  297. string UIName="CC: Desat Blue Day";
  298. string UIWidget="Spinner";
  299. float UIMin=0.0;
  300. float UIMax=1.0;
  301. > = {0.6};
  302.  
  303. float IntensityContrastDay
  304. <
  305. string UIName="TM: Intensity Contrast Day";
  306. string UIWidget="Spinner";
  307. float UIMin=0.0;
  308. float UIMax=10.0;
  309. > = {1.3};
  310.  
  311. float SaturationDay
  312. <
  313. string UIName="TM: Saturation Day";
  314. string UIWidget="Spinner";
  315. float UIMin=0.0;
  316. float UIMax=10.0;
  317. > = {1.7};
  318.  
  319. float ToneMappingCurveDay
  320. <
  321. string UIName="TM: ToneMapping Curve Day";
  322. string UIWidget="Spinner";
  323. float UIMin=0.0;
  324. float UIMax=10.0;
  325. > = {2.0};
  326.  
  327. float ToneMappingOversaturationDay
  328. <
  329. string UIName="TM: ToneMapping Oversaturation Day";
  330. string UIWidget="Spinner";
  331. float UIMin=0.1;
  332. float UIMax=999.0;
  333. > = {120.0};
  334.  
  335. float BrightnessDay
  336. <
  337. string UIName="B: Brightness Day";
  338. string UIWidget="Spinner";
  339. float UIMin=0.0;
  340. float UIMax=1.0;
  341. > = {0.15};
  342.  
  343. float BrightnessCurveDay
  344. <
  345. string UIName="B: Brightness Curve Day";
  346. string UIWidget="Spinner";
  347. float UIMin=0.0;
  348. float UIMax=10.0;
  349. > = {1.28};
  350.  
  351. float BrightnessMultiplierDay
  352. <
  353. string UIName="B: Brightness Multiplier Day";
  354. string UIWidget="Spinner";
  355. float UIMin=0.0;
  356. float UIMax=1.0;
  357. > = {0.9};
  358.  
  359. float BrightnessToneMappingCurveDay
  360. <
  361. string UIName="B: Brightness ToneMapping Curve Day";
  362. string UIWidget="Spinner";
  363. float UIMin=0.0;
  364. float UIMax=1.0;
  365. > = {0.5};
  366.  
  367. //--------------------------------------------------
  368. // Night
  369.  
  370. float AdaptationMinNight
  371. <
  372. string UIName="A: Adaptation Min Night";
  373. string UIWidget="Spinner";
  374. float UIMin=0.000;
  375. float UIMax=1.0;
  376. > = {0.0016};
  377.  
  378. float AdaptationMaxNight
  379. <
  380. string UIName="A: Adaptation Max Night";
  381. string UIWidget="Spinner";
  382. float UIMin=0.000;
  383. float UIMax=1.0;
  384. > = {0.0026};
  385.  
  386. float PaletteNight
  387. <
  388. string UIName="CC: Palette Intensity Night";
  389. string UIWidget="Spinner";
  390. float UIMin=0.0;
  391. float UIMax=5.0;
  392. > = {1.05};
  393.  
  394. float PaletteBrightnessNight
  395. <
  396. string UIName="CC: Palette Gamma Night";
  397. string UIWidget="Spinner";
  398. float UIMin=1.0;
  399. float UIMax=3.0;
  400. > = {3.0};
  401.  
  402. float GammaNight
  403. <
  404. string UIName="CC: Gamma Night";
  405. string UIWidget="Spinner";
  406. float UIMin=0.0;
  407. float UIMax=5.0;
  408. > = {1.25};
  409.  
  410. float RedFilterNight
  411. <
  412. string UIName="CC: Red Filter Night";
  413. string UIWidget="Spinner";
  414. float UIMin=0.0;
  415. float UIMax=1.0;
  416. > = {1.0};
  417.  
  418. float GreenFilterNight
  419. <
  420. string UIName="CC: Green Filter Night";
  421. string UIWidget="Spinner";
  422. float UIMin=0.0;
  423. float UIMax=1.0;
  424. > = {1.0};
  425.  
  426. float BlueFilterNight
  427. <
  428. string UIName="CC: Blue Filter Night";
  429. string UIWidget="Spinner";
  430. float UIMin=0.0;
  431. float UIMax=1.0;
  432. > = {0.975};
  433.  
  434. float DesatRNight
  435. <
  436. string UIName="CC: Desat Red Night";
  437. string UIWidget="Spinner";
  438. float UIMin=0.0;
  439. float UIMax=1.0;
  440. > = {1.0};
  441.  
  442. float DesatGNight
  443. <
  444. string UIName="CC: Desat Green Night";
  445. string UIWidget="Spinner";
  446. float UIMin=0.0;
  447. float UIMax=1.0;
  448. > = {0.2};
  449.  
  450. float DesatBNight
  451. <
  452. string UIName="CC: Desat Blue Night";
  453. string UIWidget="Spinner";
  454. float UIMin=0.0;
  455. float UIMax=1.0;
  456. > = {0.8};
  457.  
  458. float IntensityContrastNight
  459. <
  460. string UIName="TM: Intensity Contrast Night";
  461. string UIWidget="Spinner";
  462. float UIMin=0.0;
  463. float UIMax=10.0;
  464. > = {1.3};
  465.  
  466. float SaturationNight
  467. <
  468. string UIName="TM: Saturation Night";
  469. string UIWidget="Spinner";
  470. float UIMin=0.0;
  471. float UIMax=10.0;
  472. > = {1.3};
  473.  
  474. float ToneMappingCurveNight
  475. <
  476. string UIName="TM: ToneMapping Curve Night";
  477. string UIWidget="Spinner";
  478. float UIMin=0.0;
  479. float UIMax=10.0;
  480. > = {2.0};
  481.  
  482. float ToneMappingOversaturationNight
  483. <
  484. string UIName="TM: ToneMapping Oversaturation Night";
  485. string UIWidget="Spinner";
  486. float UIMin=0.1;
  487. float UIMax=999.0;
  488. > = {12.0};
  489.  
  490. float BrightnessNight
  491. <
  492. string UIName="B: Brightness Night";
  493. string UIWidget="Spinner";
  494. float UIMin=0.0;
  495. float UIMax=1.0;
  496. > = {0.15};
  497.  
  498. float BrightnessCurveNight
  499. <
  500. string UIName="B: Brightness Curve Night";
  501. string UIWidget="Spinner";
  502. float UIMin=0.0;
  503. float UIMax=10.0;
  504. > = {1.28};
  505.  
  506. float BrightnessMultiplierNight
  507. <
  508. string UIName="B: Brightness Multiplier Night";
  509. string UIWidget="Spinner";
  510. float UIMin=0.0;
  511. float UIMax=1.0;
  512. > = {0.9};
  513.  
  514. float BrightnessToneMappingCurveNight
  515. <
  516. string UIName="B: Brightness ToneMapping Curve Night";
  517. string UIWidget="Spinner";
  518. float UIMin=0.0;
  519. float UIMax=1.0;
  520. > = {0.5};
  521.  
  522. bool SimpleNightEyeEnable <
  523. string UIName = "Simple Night Eye Enable";
  524. > = {true};
  525.  
  526. // ##########################
  527. // BEGIN NIGHTEYE PARAMETERS
  528. // ##########################
  529. // #### GENERAL PARAMETERS ####
  530. bool nightEyeEnable <
  531. string UIName = "Night Eye Enable";
  532. > = {true};
  533.  
  534. // #### CALIBRATION PARAMETERS ####
  535. // #### Calibrate PARAMETERS ####
  536. bool nightEyeCalibrate <
  537. string UIName = "Night Eye Calibrate";
  538. > = {false};
  539.  
  540. float nightEyeDayMult
  541. <
  542. string UIName="Night Eye Day";
  543. string UIWidget="Spinner";
  544. float UIMin=0.0;
  545. float UIMax=100.0;
  546. float UIStep=0.01;
  547. > = {0.25};
  548.  
  549. float nightEyeDayOffset
  550. <
  551. string UIName="Night Eye Day Offset";
  552. string UIWidget="Spinner";
  553. float UIMin=-100.0;
  554. float UIMax=100.0;
  555. float UIStep=0.01;
  556. > = {-1.0};
  557.  
  558. float nightEyeNightMult
  559. <
  560. string UIName="Night Eye Night";
  561. string UIWidget="Spinner";
  562. float UIMin=0.0;
  563. float UIMax=100.0;
  564. float UIStep=0.01;
  565. > = {1.34};
  566.  
  567. float nightEyeNightOffset
  568. <
  569. string UIName="Night Eye Night Offset";
  570. string UIWidget="Spinner";
  571. float UIMin=-100.0;
  572. float UIMax=100.0;
  573. float UIStep=0.01;
  574. > = {-1.0};
  575.  
  576. float nightEyeInteriorMult
  577. <
  578. string UIName="Night Eye Interior";
  579. string UIWidget="Spinner";
  580. float UIMin=0.0;
  581. float UIMax=100.0;
  582. float UIStep=0.01;
  583. > = {1.34};
  584.  
  585. float nightEyeInteriorOffset
  586. <
  587. string UIName="Night Eye Interior Offset";
  588. string UIWidget="Spinner";
  589. float UIMin=-100.0;
  590. float UIMax=100.0;
  591. float UIStep=0.01;
  592. > = {-1.0};
  593.  
  594. // #### VIGNETTE PARAMETERS ####
  595. bool nightEyeVignetteEnable <
  596. string UIName = "Night Eye Vignette Enable";
  597. > = {false};
  598.  
  599. float nightEyeVignetteMinDistance
  600. <
  601. string UIName="Night Eye Vignette Min Distance";
  602. string UIWidget="Spinner";
  603. float UIMin=0.0;
  604. float UIMax=10.0;
  605. > = {0.5};
  606.  
  607. float nightEyeVignetteMaxDistance
  608. <
  609. string UIName="Night Eye Vignette Max Distance";
  610. string UIWidget="Spinner";
  611. float UIMin=0.0;
  612. float UIMax=10.0;
  613. > = {0.9};
  614.  
  615. float nightEyeVignetteDistancePower
  616. <
  617. string UIName="Night Eye Vignette Distance Power";
  618. string UIWidget="Spinner";
  619. float UIMin=0.0;
  620. float UIMax=10.0;
  621. > = {1.5};
  622.  
  623. float nightEyeVignetteAspectRatio
  624. <
  625. string UIName="Night Eye Vignette Aspect Ratio Power";
  626. string UIWidget="Spinner";
  627. float UIMin=0.0;
  628. float UIMax=10.0;
  629. > = {1.0};
  630.  
  631. // #### COLOR CORRECT PARAMETERS ####
  632. bool nightEyeCCEnable <
  633. string UIName = "Night Eye CC Enable";
  634. > = {true};
  635.  
  636. float nightEyeGamma
  637. <
  638. string UIName="Night Eye Gamma";
  639. string UIWidget="Spinner";
  640. float UIMin=0.0;
  641. float UIMax=10.0;
  642. > = {0.5};
  643.  
  644. float nightEyeHueShift
  645. <
  646. string UIName="Night Eye Hue Shift";
  647. string UIWidget="Spinner";
  648. float UIMin=0.0;
  649. float UIMax=100.0;
  650. > = {0.25};
  651.  
  652. float nightEyeHueSpeed
  653. <
  654. string UIName="Night Eye Hue Speed";
  655. string UIWidget="Spinner";
  656. float UIMin=-100.0;
  657. float UIMax=100.0;
  658. > = {0.0};
  659.  
  660. float nightEyeSaturationMult
  661. <
  662. string UIName="Night Eye Saturation";
  663. string UIWidget="Spinner";
  664. float UIMin=0.0;
  665. float UIMax=10.0;
  666. > = {0.0};
  667.  
  668. float nightEyeValueMult
  669. <
  670. string UIName="Night Eye Value";
  671. string UIWidget="Spinner";
  672. float UIMin=0.0;
  673. float UIMax=100.0;
  674. > = {0.5};
  675.  
  676. float3 nightEyeTint <
  677. string UIName="Night Eye Tint";
  678. string UIWidget="Color";
  679. > = {1.0, 1.0, 1.0};
  680.  
  681. float nightEyeVignetteValueMult
  682. <
  683. string UIName="Night Eye Vignette Value Mult";
  684. string UIWidget="Spinner";
  685. float UIMin=0.0;
  686. float UIMax=100.0;
  687. > = {0.0};
  688.  
  689. float nightEyeVignetteMaskMult
  690. <
  691. string UIName="Night Eye Vignette Mask Mult";
  692. string UIWidget="Spinner";
  693. float UIMin=-100.0;
  694. float UIMax=100.0;
  695. > = {1.0};
  696.  
  697. // #### BLOOM PARAMETERS ####
  698. bool nightEyeBloomEnable <
  699. string UIName = "Night Eye Bloom Enable";
  700. > = {true};
  701.  
  702. float nightEyeBloomGamma
  703. <
  704. string UIName="Night Eye Bloom Gamma";
  705. string UIWidget="Spinner";
  706. float UIMin=0.0;
  707. float UIMax=10.0;
  708. > = {1.0};
  709.  
  710. float nightEyeBloomHueShift
  711. <
  712. string UIName="Night Eye Bloom Hue Shift";
  713. string UIWidget="Spinner";
  714. float UIMin=0.0;
  715. float UIMax=100.0;
  716. > = {0.5};
  717.  
  718. float nightEyeBloomHueSpeed
  719. <
  720. string UIName="Night Eye Bloom Hue Speed";
  721. string UIWidget="Spinner";
  722. float UIMin=-100.0;
  723. float UIMax=100.0;
  724. > = {0.0};
  725.  
  726. float nightEyeBloomSaturationMult
  727. <
  728. string UIName="Night Eye Bloom Saturation";
  729. string UIWidget="Spinner";
  730. float UIMin=0.0;
  731. float UIMax=10.0;
  732. > = {1.0};
  733.  
  734. float nightEyeBloomValueMult
  735. <
  736. string UIName="Night Eye Bloom Value";
  737. string UIWidget="Spinner";
  738. float UIMin=0.0;
  739. float UIMax=100.0;
  740. > = {20.0};
  741.  
  742. float3 nightEyeBloomTint <
  743. string UIName="Night Eye Bloom Tint";
  744. string UIWidget="Color";
  745. > = {1.0, 1.0, 1.0};
  746.  
  747. float nightEyeBloomVignetteMult
  748. <
  749. string UIName="Night Eye Bloom Vignette Mult";
  750. string UIWidget="Spinner";
  751. float UIMin=0.0;
  752. float UIMax=100.0;
  753. > = {1.0};
  754.  
  755. float nightEyeBloomVignetteMaskMult
  756. <
  757. string UIName="Night Eye Bloom Vignette Mask Mult";
  758. string UIWidget="Spinner";
  759. float UIMin=-100.0;
  760. float UIMax=100.0;
  761. > = {1.0};
  762.  
  763.  
  764. // #### NOISE PARAMETERS ####
  765. bool nightEyeNoiseEnable <
  766. string UIName = "Night Eye Noise Enable";
  767. > = {true};
  768.  
  769. float nightEyeNoiseMult
  770. <
  771. string UIName="Night Eye Noise Mult";
  772. string UIWidget="Spinner";
  773. float UIMin=0.0;
  774. float UIMax=100.0;
  775. > = {0.15};
  776.  
  777. float3 nightEyeNoiseTint <
  778. string UIName="Night Eye Noise Tint";
  779. string UIWidget="Color";
  780. > = {1.0, 1.0, 1.0};
  781.  
  782. float nightEyeNoiseVignetteMult
  783. <
  784. string UIName="Night Eye Noise Vignette Mult";
  785. string UIWidget="Spinner";
  786. float UIMin=0.0;
  787. float UIMax=100.0;
  788. > = {1.0};
  789.  
  790. float nightEyeNoiseVignetteMaskMult
  791. <
  792. string UIName="Night Eye Noise Vignette Mask Mult";
  793. string UIWidget="Spinner";
  794. float UIMin=-100.0;
  795. float UIMax=100.0;
  796. > = {1.0};
  797.  
  798. // #### WARP PARAMETERS ####
  799. bool nightEyeWarpEnable <
  800. string UIName = "Night Eye Warp Enable";
  801. > = {false};
  802.  
  803. float nightEyeWarpMult
  804. <
  805. string UIName="Night Eye Warp Mult";
  806. string UIWidget="Spinner";
  807. float UIMin=-100.0;
  808. float UIMax=100.0;
  809. > = {25.0};
  810.  
  811. float nightEyeWarpShift
  812. <
  813. string UIName="Night Eye Warp Shift";
  814. string UIWidget="Spinner";
  815. float UIMin=-100.0;
  816. float UIMax=100.0;
  817. > = {-0.05};
  818.  
  819. float nightEyeWarpMinDistance
  820. <
  821. string UIName="Night Eye Warp Min Distance";
  822. string UIWidget="Spinner";
  823. float UIMin=0.0;
  824. float UIMax=10.0;
  825. > = {0.4};
  826.  
  827. float nightEyeWarpMaxDistance
  828. <
  829. string UIName="Night Eye Warp Max Distance";
  830. string UIWidget="Spinner";
  831. float UIMin=0.0;
  832. float UIMax=10.0;
  833. > = {1.0};
  834.  
  835. float nightEyeWarpDistancePower
  836. <
  837. string UIName="Night Eye Warp Distance Power";
  838. string UIWidget="Spinner";
  839. float UIMin=0.0;
  840. float UIMax=10.0;
  841. > = {1.75};
  842.  
  843. float nightEyeWarpAspectRatio
  844. <
  845. string UIName="Night Eye Warp Aspect Ratio Power";
  846. string UIWidget="Spinner";
  847. float UIMin=0.0;
  848. float UIMax=10.0;
  849. > = {1.0};
  850. // #### Eyes PARAMETERS ####
  851. bool nightEyeEnableEyes <
  852. string UIName = "Night Eye Enable Eyes";
  853. > = {false};
  854.  
  855. float nightEyeEyesSeparation
  856. <
  857. string UIName="Night Eye Eyes Separation";
  858. string UIWidget="Spinner";
  859. float UIMin=0.0;
  860. float UIMax=10.0;
  861. > = {0.35};
  862.  
  863. // ##########################
  864. // END NIGHTEYE PARAMETERS
  865. // ##########################
  866.  
  867. //--------------------------------------------------
  868.  
  869. //parameters for ldr color correction, if enabled
  870. float ECCGamma
  871. <
  872. string UIName="CC: Gamma";
  873. string UIWidget="Spinner";
  874. float UIMin=0.2;//not zero!!!
  875. float UIMax=5.0;
  876. > = {1.0};
  877.  
  878. float ECCInBlack
  879. <
  880. string UIName="CC: In black";
  881. string UIWidget="Spinner";
  882. float UIMin=0.0;
  883. float UIMax=1.0;
  884. > = {0.0};
  885.  
  886. float ECCInWhite
  887. <
  888. string UIName="CC: In white";
  889. string UIWidget="Spinner";
  890. float UIMin=0.0;
  891. float UIMax=1.0;
  892. > = {1.0};
  893.  
  894. float ECCOutBlack
  895. <
  896. string UIName="CC: Out black";
  897. string UIWidget="Spinner";
  898. float UIMin=0.0;
  899. float UIMax=1.0;
  900. > = {0.0};
  901.  
  902. float ECCOutWhite
  903. <
  904. string UIName="CC: Out white";
  905. string UIWidget="Spinner";
  906. float UIMin=0.0;
  907. float UIMax=1.0;
  908. > = {1.0};
  909.  
  910. float ECCBrightness
  911. <
  912. string UIName="CC: Brightness";
  913. string UIWidget="Spinner";
  914. float UIMin=0.0;
  915. float UIMax=10.0;
  916. > = {1.0};
  917.  
  918. float ECCContrastGrayLevel
  919. <
  920. string UIName="CC: Contrast gray level";
  921. string UIWidget="Spinner";
  922. float UIMin=0.01;
  923. float UIMax=0.99;
  924. > = {0.5};
  925.  
  926. float ECCContrast
  927. <
  928. string UIName="CC: Contrast";
  929. string UIWidget="Spinner";
  930. float UIMin=0.0;
  931. float UIMax=10.0;
  932. > = {1.0};
  933.  
  934. float ECCSaturation
  935. <
  936. string UIName="CC: Saturation";
  937. string UIWidget="Spinner";
  938. float UIMin=0.0;
  939. float UIMax=10.0;
  940. > = {1.0};
  941.  
  942. float ECCDesaturateShadows
  943. <
  944. string UIName="CC: Desaturate shadows";
  945. string UIWidget="Spinner";
  946. float UIMin=0.0;
  947. float UIMax=1.0;
  948. > = {0.0};
  949.  
  950. float3 ECCColorBalanceShadows <
  951. string UIName="CC: Color balance shadows";
  952. string UIWidget="Color";
  953. > = {0.5, 0.5, 0.5};
  954.  
  955. float3 ECCColorBalanceHighlights <
  956. string UIName="CC: Color balance highlights";
  957. string UIWidget="Color";
  958. > = {0.5, 0.5, 0.5};
  959.  
  960. float3 ECCChannelMixerR <
  961. string UIName="CC: Channel mixer R";
  962. string UIWidget="Color";
  963. > = {1.0, 0.0, 0.0};
  964.  
  965. float3 ECCChannelMixerG <
  966. string UIName="CC: Channel mixer G";
  967. string UIWidget="Color";
  968. > = {0.0, 1.0, 0.0};
  969.  
  970. float3 ECCChannelMixerB <
  971. string UIName="CC: Channel mixer B";
  972. string UIWidget="Color";
  973. > = {0.0, 0.0, 1.0};
  974.  
  975.  
  976. //FiftyTifty Vibrance Begin
  977. bool bFiftyTiftyVibrance
  978. <
  979. string UIName = "Vibrance: Enable";
  980. > = {false};
  981.  
  982. float VibranceIntensity
  983. <
  984. string UIName="Vibrance: Intensity";
  985. string UIWidget="spinner";
  986. float UIMin=0.0000;
  987. float UIMax=1000.0000;
  988. float UIStep=0.01;
  989. > = {1.00};
  990.  
  991. float VibranceR
  992. <
  993. string UIName = "Vibrance: Red Amount";
  994. string UIWidget = "Spinner";
  995. float UIStep=0.01;
  996. > = {1.00};
  997.  
  998. float VibranceRBrightness
  999. <
  1000. string UIName = "Vibrance: Red - Brightness";
  1001. string UIWidget = "Spinner";
  1002. float UIStep=0.01;
  1003. > = {1.00};
  1004.  
  1005. float VibranceG
  1006. <
  1007. string UIName = "Vibrance: Green Amount";
  1008. string UIWidget = "Spinner";
  1009. float UIStep=0.01;
  1010. > = {1.00};
  1011.  
  1012. float VibranceGBrightness
  1013. <
  1014. string UIName = "Vibrance: Green - Brightness";
  1015. string UIWidget = "Spinner";
  1016. float UIStep=0.01;
  1017. > = {1.00};
  1018.  
  1019. float VibranceB
  1020. <
  1021. string UIName = "Vibrance: Blue Amount";
  1022. string UIWidget = "Spinner";
  1023. float UIStep=0.01;
  1024. > = {1.00};
  1025.  
  1026. float VibranceBBrightness
  1027. <
  1028. string UIName = "Vibrance: Blue - Brightness";
  1029. string UIWidget = "Spinner";
  1030. float UIStep=0.01;
  1031. > = {1.00};
  1032. //FiftyTifty Vibrance End
  1033.  
  1034.  
  1035. //FiftyTifty HPD Tonemapping Begin
  1036. bool bFiftyTiftyHPDTonemapping
  1037. <
  1038. string UIName = "HPD Tonemapping: Enable";
  1039. > = {false};
  1040.  
  1041. bool bFiftyTiftyHPDTonemappingMethod
  1042. <
  1043. string UIName = "HPD Tonemapping: Use 2nd Method?";
  1044. > = {false};
  1045.  
  1046. float HPDTonemappingExposure
  1047. <
  1048. string UIName="HPD Tonemapping: Exposure.";
  1049. string UIWidget="spinner";
  1050. float UIMin=0.00;
  1051. float UIMax=1000.00;
  1052. float UIStep=0.01;
  1053. > = {2.2f};
  1054.  
  1055. float HPDTonemappingClipping
  1056. <
  1057. string UIName="HPD Tonemapping: Clipping";
  1058. string UIWidget="spinner";
  1059. float UIMin=0.0;
  1060. float UIMax=1000.0;
  1061. float UIStep=0.0001;
  1062. > = {0.004f};
  1063.  
  1064. float HPDTonemappingUpperTone
  1065. <
  1066. string UIName="HPD Tonemapping: Upper Tone";
  1067. string UIWidget="spinner";
  1068. float UIMin=0.01;
  1069. float UIMax=100.00;
  1070. float UIStep=0.01;
  1071. > = {6.2f};
  1072.  
  1073. float HPDTonemappingGreyTone
  1074. <
  1075. string UIName="HPD Tonemapping: Grey Tone";
  1076. string UIWidget="spinner";
  1077. float UIMin=0.01;
  1078. float UIMax=100.00;
  1079. float UIStep=0.01;
  1080. > = {0.5f};
  1081.  
  1082. float HPDTonemappingMiddleTone
  1083. <
  1084. string UIName="HPD Tonemapping: Middle Tone";
  1085. string UIWidget="spinner";
  1086. float UIMin=0.01;
  1087. float UIMax=100.00;
  1088. float UIStep=0.01;
  1089. > = {1.7f};
  1090.  
  1091. float HPDTonemappingLowerTone
  1092. <
  1093. string UIName="HPD Tonemapping: Lower Tone";
  1094. string UIWidget="spinner";
  1095. float UIMin=0.01;
  1096. float UIMax=100.00;
  1097. float UIStep=0.01;
  1098. > = {0.06};
  1099.  
  1100. float HPDTonemappingLerp // 1.0 = None, 0.001 = Practically entire effect
  1101. <
  1102. string UIName="HPD Tonemapping: Amount";
  1103. string UIWidget="spinner";
  1104. float UIMin=0.0001;
  1105. float UIMax=1.0000;
  1106. float UIStep=0.0001;
  1107. > = {0.0001};
  1108. //FiftyTifty HPD Tonemapping End
  1109.  
  1110.  
  1111.  
  1112.  
  1113. //+++++++++++++++++++++++++++++
  1114. //external parameters, do not modify
  1115. //+++++++++++++++++++++++++++++
  1116. //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
  1117. float4 tempF1; //0,1,2,3
  1118. float4 tempF2; //5,6,7,8
  1119. float4 tempF3; //9,0
  1120. //x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
  1121. float4 Timer;
  1122. //x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
  1123. float4 ScreenSize;
  1124. //changes in range 0..1, 0 means that night time, 1 - day time
  1125. float ENightDayFactor;
  1126. //changes 0 or 1. 0 means that exterior, 1 - interior
  1127. float EInteriorFactor;
  1128. //changes in range 0..1, 0 means full quality, 1 lowest dynamic quality (0.33, 0.66 are limits for quality levels)
  1129. float EAdaptiveQualityFactor;
  1130. //enb version of bloom applied, ignored if original post processing used
  1131. float EBloomAmount;
  1132.  
  1133.  
  1134.  
  1135. texture2D texs0;//color
  1136. texture2D texs1;//bloom skyrim
  1137. texture2D texs2;//adaptation skyrim
  1138. texture2D texs3;//bloom enb
  1139. texture2D texs4;//adaptation enb
  1140. texture2D texs7;//palette enb
  1141.  
  1142. sampler2D _s0 = sampler_state
  1143. {
  1144. Texture = <texs0>;
  1145. MinFilter = POINT;//
  1146. MagFilter = POINT;//
  1147. MipFilter = NONE;//LINEAR;
  1148. AddressU = Clamp;
  1149. AddressV = Clamp;
  1150. SRGBTexture=FALSE;
  1151. MaxMipLevel=0;
  1152. MipMapLodBias=0;
  1153. };
  1154.  
  1155. sampler2D _s1 = sampler_state
  1156. {
  1157. Texture = <texs1>;
  1158. MinFilter = LINEAR;//
  1159. MagFilter = LINEAR;//
  1160. MipFilter = NONE;//LINEAR;
  1161. AddressU = Clamp;
  1162. AddressV = Clamp;
  1163. SRGBTexture=FALSE;
  1164. MaxMipLevel=0;
  1165. MipMapLodBias=0;
  1166. };
  1167.  
  1168. sampler2D _s2 = sampler_state
  1169. {
  1170. Texture = <texs2>;
  1171. MinFilter = LINEAR;//
  1172. MagFilter = LINEAR;//
  1173. MipFilter = NONE;//LINEAR;
  1174. AddressU = Clamp;
  1175. AddressV = Clamp;
  1176. SRGBTexture=FALSE;
  1177. MaxMipLevel=0;
  1178. MipMapLodBias=0;
  1179. };
  1180.  
  1181. sampler2D _s3 = sampler_state
  1182. {
  1183. Texture = <texs3>;
  1184. MinFilter = LINEAR;//
  1185. MagFilter = LINEAR;//
  1186. MipFilter = NONE;//LINEAR;
  1187. AddressU = Clamp;
  1188. AddressV = Clamp;
  1189. SRGBTexture=FALSE;
  1190. MaxMipLevel=0;
  1191. MipMapLodBias=0;
  1192. };
  1193.  
  1194. sampler2D _s4 = sampler_state
  1195. {
  1196. Texture = <texs4>;
  1197. MinFilter = LINEAR;//
  1198. MagFilter = LINEAR;//
  1199. MipFilter = NONE;//LINEAR;
  1200. AddressU = Clamp;
  1201. AddressV = Clamp;
  1202. SRGBTexture=FALSE;
  1203. MaxMipLevel=0;
  1204. MipMapLodBias=0;
  1205. };
  1206.  
  1207. sampler2D _s7 = sampler_state
  1208. {
  1209. Texture = <texs7>;
  1210. MinFilter = LINEAR;
  1211. MagFilter = LINEAR;
  1212. MipFilter = NONE;
  1213. AddressU = Clamp;
  1214. AddressV = Clamp;
  1215. SRGBTexture=FALSE;
  1216. MaxMipLevel=0;
  1217. MipMapLodBias=0;
  1218. };
  1219.  
  1220. struct VS_OUTPUT_POST
  1221. {
  1222. float4 vpos : POSITION;
  1223. float2 txcoord0 : TEXCOORD0;
  1224. };
  1225. struct VS_INPUT_POST
  1226. {
  1227. float3 pos : POSITION;
  1228. float2 txcoord0 : TEXCOORD0;
  1229. };
  1230.  
  1231.  
  1232.  
  1233. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1234. //
  1235. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  1236. VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
  1237. {
  1238. VS_OUTPUT_POST OUT;
  1239.  
  1240. OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  1241.  
  1242. OUT.txcoord0.xy=IN.txcoord0.xy;
  1243.  
  1244. return OUT;
  1245. }
  1246.  
  1247.  
  1248. //skyrim shader specific externals, do not modify
  1249. float4 _c1 : register(c1);
  1250. float4 _c2 : register(c2);
  1251. float4 _c3 : register(c3);
  1252. float4 _c4 : register(c4);
  1253. float4 _c5 : register(c5);
  1254.  
  1255. float4 PS_D6EC7DD1(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
  1256. {
  1257. float4 _oC0=0.0; //output
  1258.  
  1259. float4 _c6=float4(0, 0, 0, 0);
  1260. float4 _c7=float4(0.212500006, 0.715399981, 0.0720999986, 1.0);
  1261.  
  1262. float4 r0;
  1263. float4 r1;
  1264. float4 r2;
  1265. float4 r3;
  1266. float4 r4;
  1267. float4 r5;
  1268. float4 r6;
  1269. float4 r7;
  1270. float4 r8;
  1271. float4 r9;
  1272. float4 r10;
  1273. float4 r11;
  1274.  
  1275.  
  1276. float4 _v0=0.0;
  1277.  
  1278. _v0.xy=IN.txcoord0.xy;
  1279. // ################################## //
  1280. // BEGIN NIGHT EYE SETUP AND WARPING //
  1281. // ################################## //
  1282. float2 unwarpedTxCoord = _v0.xy;
  1283.  
  1284. // The _c3.w value is from the game needs to be manipulated as
  1285. // below to get a value from 0 (night eye off) to 1 (night eye on).
  1286. // The Day, Night, and Interior GUI controls can be used to tune this.
  1287. float3 nightEyeDayFactor = clamp(_c3.w + nightEyeDayOffset, 0.0, 1.0) * nightEyeDayMult;
  1288. float3 nightEyeNightFactor = clamp(_c3.w + nightEyeNightOffset, 0.0, 1.0) * nightEyeNightMult;
  1289. float3 nightEyeInteriorFactor = clamp(_c3.w + nightEyeInteriorOffset, 0.0, 1.0) * nightEyeInteriorMult;
  1290.  
  1291. // Interpolate night/day/interior
  1292. float nightEyeT;;
  1293. nightEyeT = nightEyeDayFactor * ENightDayFactor +
  1294. nightEyeNightFactor * (1.0 - ENightDayFactor);
  1295. nightEyeT = nightEyeInteriorFactor * EInteriorFactor +
  1296. nightEyeT * (1.0 - EInteriorFactor);
  1297. float aspectRatio = ScreenSize.z;
  1298.  
  1299. float2 warpVector;
  1300. [branch] if(nightEyeEnable && nightEyeWarpEnable) // Warp
  1301. {
  1302. float2 warpedTxCoord = IN.txcoord0.xy;
  1303. float2 center = float2(0.5, 0.5);
  1304. float2 txCorrected = float2((warpedTxCoord.x - center.x) *
  1305. aspectRatio / nightEyeWarpAspectRatio + center.x, warpedTxCoord.y);
  1306. float dist;
  1307. [branch]if(nightEyeEnableEyes) // Eyes (2 centers)
  1308. {
  1309. float2 leftEyeCenter = float2(center.x - nightEyeEyesSeparation / 2.0, center.y);
  1310. float2 rightEyeCenter = float2(center.x + nightEyeEyesSeparation / 2.0, center.y);
  1311. float leftEyeDist = distance(txCorrected, leftEyeCenter);
  1312. float rightEyeDist = distance(txCorrected, rightEyeCenter);
  1313. float leftEyeDistT = linStep(nightEyeWarpMinDistance, nightEyeWarpMaxDistance, leftEyeDist);
  1314. float rightEyeDistT = linStep(nightEyeWarpMinDistance, nightEyeWarpMaxDistance, rightEyeDist);
  1315. if(leftEyeDist < rightEyeDist){
  1316. dist = leftEyeDist;
  1317. warpVector = (txCorrected - leftEyeCenter) / leftEyeDist;
  1318. }
  1319. else
  1320. {
  1321. dist = rightEyeDist;
  1322. warpVector = (txCorrected - rightEyeCenter) / rightEyeDist;
  1323. }
  1324. }
  1325. else
  1326. {
  1327. dist = distance(txCorrected, center);
  1328. warpVector = (txCorrected - center) / dist;
  1329. }
  1330.  
  1331. float distT = linStep(nightEyeWarpMinDistance, nightEyeWarpMaxDistance, dist);
  1332. distT = pow(distT, nightEyeWarpDistancePower);
  1333. warpedTxCoord += nightEyeT * nightEyeWarpMult * -0.05 *
  1334. (distT + nightEyeWarpShift * 0.1) * warpVector;
  1335.  
  1336. // Mirror and wrap if warped beyond screen border
  1337. warpedTxCoord = fmod(abs(warpedTxCoord), 2.0);
  1338. if(warpedTxCoord.x > 1.0) warpedTxCoord.x = warpedTxCoord.x - 2.0 * (warpedTxCoord.x - 1.0);
  1339. if(warpedTxCoord.y > 1.0) warpedTxCoord.y = warpedTxCoord.y - 2.0 * (warpedTxCoord.y - 1.0);
  1340.  
  1341. _v0.xy = warpedTxCoord.xy;
  1342. }
  1343. // ################################ //
  1344. // END NIGHT EYE SETUP AND WARPING //
  1345. // ################################ //
  1346.  
  1347. r1=tex2D(_s0, _v0.xy); //color
  1348.  
  1349. //apply bloom
  1350.  
  1351. //Begin New Bloom - FiftyTifty
  1352. //float4 xcolorbloom=tex2D(_s3, _v0.xy);
  1353.  
  1354. //xcolorbloom.xyz=xcolorbloom-r1;
  1355. //xcolorbloom.xyz=max(xcolorbloom, 0.0);
  1356. float3 xcolorbloom = tex2D(_s3, _v0.xy).xyz * 2;
  1357. r1.xyz += ( xcolorbloom.xyz * EBloomAmount );
  1358. //r1.xyz += ( xcolorbloom*EBloomAmount );
  1359. //End New Bloom - FiftyTifty
  1360.  
  1361. r11=r1; //my bypass
  1362. _oC0.xyz=r1.xyz; //for future use without game color corrections
  1363.  
  1364. #ifdef APPLYGAMECOLORCORRECTION
  1365. //apply original
  1366. r0.x=1.0/_c2.y;
  1367. r1=tex2D(_s2, _v0);
  1368. r0.yz=r1.xy * _c1.y;
  1369. r0.w=1.0/r0.y;
  1370. r0.z=r0.w * r0.z;
  1371. r1=tex2D(_s0, _v0);
  1372. r1.xyz=r1 * _c1.y;
  1373. r0.w=dot(_c7.xyz, r1.xyz);
  1374. r1.w=r0.w * r0.z;
  1375. r0.z=r0.z * r0.w + _c7.w;
  1376. r0.z=1.0/r0.z;
  1377. r0.x=r1.w * r0.x + _c7.w;
  1378. r0.x=r0.x * r1.w;
  1379. r0.x=r0.z * r0.x;
  1380. if (r0.w<0) r0.x=_c6.x;
  1381. r0.z=1.0/r0.w;
  1382. r0.z=r0.z * r0.x;
  1383. r0.x=saturate(-r0.x + _c2.x);
  1384. // r2=tex2D(_s3, _v0);//enb bloom
  1385. r2=tex2D(_s1, _v0);//skyrim bloom
  1386. r2.xyz=r2 * _c1.y;
  1387. r2.xyz=r0.x * r2;
  1388. r1.xyz=r1 * r0.z + r2;
  1389. r0.x=dot(r1.xyz, _c7.xyz);
  1390. r1.w=_c7.w;
  1391. r2=lerp(r0.x, r1, _c3.x);
  1392. r1=r0.x * _c4 - r2;
  1393. r1=_c4.w * r1 + r2;
  1394. r1=_c3.w * r1 - r0.y; //khajiit night vision _c3.w
  1395. r0=_c3.z * r1 + r0.y;
  1396. r1=-r0 + _c5;
  1397. _oC0=_c5.w * r1 + r0;
  1398.  
  1399. #endif //APPLYGAMECOLORCORRECTION
  1400.  
  1401. /*
  1402. #ifndef APPLYGAMECOLORCORRECTION
  1403. //temporary fix for khajiit night vision, but it also degrade colors.
  1404. // r1=tex2D(_s2, _v0);
  1405. // r0.y=r1.xy * _c1.y;
  1406. r1=_oC0;
  1407. r1.xyz=r1 * _c1.y;
  1408. r0.x=dot(r1.xyz, _c7.xyz);
  1409. r2=lerp(r0.x, r1, _c3.x);
  1410. r1=r0.x * _c4 - r2;
  1411. r1=_c4.w * r1 + r2;
  1412. r1=_c3.w * r1;// - r0.y;
  1413. r0=_c3.z * r1;// + r0.y;
  1414. r1=-r0 + _c5;
  1415. _oC0=_c5.w * r1 + r0;
  1416. #endif //!APPLYGAMECOLORCORRECTION
  1417. */
  1418.  
  1419.  
  1420. float4 color=_oC0;
  1421.  
  1422. if(SimpleNightEyeEnable)
  1423. {
  1424. color.xyz = _c3.w * color.xyz;
  1425. }
  1426.  
  1427. //adaptation in time
  1428. float4 Adaptation=tex2D(_s4, 0.5);
  1429. float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
  1430.  
  1431. float Gamma=lerp(lerp(GammaNight, GammaDay, ENightDayFactor), GammaInterior, EInteriorFactor);
  1432. float RedFilter=lerp(lerp(RedFilterNight, RedFilterDay, ENightDayFactor), RedFilterInterior, EInteriorFactor);
  1433. float GreenFilter=lerp(lerp(GreenFilterNight, GreenFilterDay, ENightDayFactor), GreenFilterInterior, EInteriorFactor);
  1434. float BlueFilter=lerp(lerp(BlueFilterNight, BlueFilterDay, ENightDayFactor), BlueFilterInterior, EInteriorFactor);
  1435.  
  1436. float DesatR=lerp(lerp(DesatRNight, DesatRDay, ENightDayFactor), DesatRInterior, EInteriorFactor);
  1437. float DesatG=lerp(lerp(DesatGNight, DesatGDay, ENightDayFactor), DesatGInterior, EInteriorFactor);
  1438. float DesatB=lerp(lerp(DesatBNight, DesatBDay, ENightDayFactor), DesatBInterior, EInteriorFactor);
  1439.  
  1440. float AdaptationMin=lerp(lerp(AdaptationMinNight, AdaptationMinDay, ENightDayFactor), AdaptationMinInterior, EInteriorFactor);
  1441. float AdaptationMax=lerp(lerp(AdaptationMaxNight, AdaptationMaxDay, ENightDayFactor), AdaptationMaxInterior, EInteriorFactor);
  1442.  
  1443. float Saturation=lerp(lerp(SaturationNight, SaturationDay, ENightDayFactor), SaturationInterior, EInteriorFactor);
  1444. float ToneMappingCurve=lerp(lerp(ToneMappingCurveNight, ToneMappingCurveDay, ENightDayFactor), ToneMappingCurveInterior, EInteriorFactor);
  1445. float ToneMappingOversaturation=lerp(lerp(ToneMappingOversaturationNight, ToneMappingOversaturationDay, ENightDayFactor), ToneMappingOversaturationInterior, EInteriorFactor);
  1446. float IntensityContrast=lerp(lerp(IntensityContrastNight, IntensityContrastDay, ENightDayFactor), IntensityContrastInterior, EInteriorFactor);
  1447. float Brightness=lerp(lerp(BrightnessNight, BrightnessDay, ENightDayFactor), BrightnessInterior, EInteriorFactor);
  1448. float BrightnessCurve=lerp(lerp(BrightnessCurveNight, BrightnessCurveDay, ENightDayFactor), BrightnessCurveInterior, EInteriorFactor);
  1449. float BrightnessMultiplier=lerp(lerp(BrightnessMultiplierNight, BrightnessMultiplierDay, ENightDayFactor), BrightnessMultiplierInterior, EInteriorFactor);
  1450. float BrightnessToneMappingCurve=lerp(lerp(BrightnessToneMappingCurveNight, BrightnessToneMappingCurveDay, ENightDayFactor), BrightnessToneMappingCurveInterior, EInteriorFactor);
  1451.  
  1452.  
  1453. float greyscale = dot(color.xyz, float3(0.3, 0.59, 0.11));
  1454. color.r = lerp(greyscale, color.r, DesatR);
  1455. color.g = lerp(greyscale, color.g, DesatG);
  1456. color.b = lerp(greyscale, color.b, DesatB);
  1457.  
  1458. color = pow(color, Gamma);
  1459.  
  1460. color.r = pow(color.r, RedFilter);
  1461. color.g = pow(color.g, GreenFilter);
  1462. color.b = pow(color.b, BlueFilter);
  1463.  
  1464. grayadaptation=max(grayadaptation, 0.0); //0.0
  1465. grayadaptation=min(grayadaptation, 50.0); //50.0
  1466. color.xyz=color.xyz/(grayadaptation*AdaptationMax+AdaptationMin);//*tempF1.x
  1467.  
  1468. color.xyz*=Brightness;
  1469. color.xyz+=0.000001;
  1470. float3 xncol=normalize(color.xyz);
  1471. float3 scl=color.xyz/xncol.xyz;
  1472. scl=pow(scl, IntensityContrast);
  1473. xncol.xyz=pow(xncol.xyz, Saturation);
  1474. color.xyz=scl*xncol.xyz;
  1475.  
  1476. float lumamax=ToneMappingOversaturation;
  1477. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + ToneMappingCurve);
  1478.  
  1479. float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
  1480. float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  1481. float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  1482.  
  1483. Y=pow(Y, BrightnessCurve);
  1484. Y=Y*BrightnessMultiplier;
  1485. Y=Y/(Y+BrightnessToneMappingCurve);
  1486. float desaturatefact=saturate(Y*Y*Y*1.7);
  1487. U=lerp(U, 0.0, desaturatefact);
  1488. V=lerp(V, 0.0, desaturatefact);
  1489. color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  1490.  
  1491.  
  1492.  
  1493. //pallete texture (0.082+ version feature)
  1494. #ifdef E_CC_PALETTE
  1495. float Palette=lerp(lerp(PaletteNight, PaletteDay, ENightDayFactor), PaletteInterior, EInteriorFactor);
  1496. float PaletteBrightness=lerp(lerp(PaletteBrightnessNight, PaletteBrightnessDay, ENightDayFactor), PaletteBrightnessInterior, EInteriorFactor);
  1497.  
  1498. color.rgb=saturate(color.rgb);
  1499. float3 brightness=Adaptation.xyz;//tex2D(_s4, 0.5);//adaptation luminance
  1500. // brightness=saturate(brightness);//old version from ldr games
  1501. brightness=(brightness/(brightness*PaletteBrightness));//new version
  1502. brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
  1503. float3 palette;
  1504. float4 uvsrc=0.0;
  1505. uvsrc.y=brightness.r;
  1506. uvsrc.x=color.r;
  1507. palette.r=tex2Dlod(_s7, uvsrc).r;
  1508. uvsrc.x=color.g;
  1509. uvsrc.y=brightness.g;
  1510. palette.g=tex2Dlod(_s7, uvsrc).g;
  1511. uvsrc.x=color.b;
  1512. uvsrc.y=brightness.b;
  1513. palette.b=tex2Dlod(_s7, uvsrc).b;
  1514. color.rgb=palette.rgb * Palette;
  1515. #endif //E_CC_PALETTE
  1516.  
  1517.  
  1518.  
  1519. #ifdef E_CC_PROCEDURAL
  1520. float tempgray;
  1521. float4 tempvar;
  1522. float3 tempcolor;
  1523. /*
  1524. //these replaced by "levels"
  1525. //+++ gamma
  1526. if (ECCGamma!=1.0)
  1527. color=pow(color, 1.0/ECCGamma);
  1528.  
  1529. //+++ brightness like in photoshop
  1530. color=color+ECCAditiveBrightness;
  1531.  
  1532. //+++ lightness
  1533. tempvar.x=saturate(ELightness);
  1534. tempvar.y=saturate(1.0+ECCLightness);
  1535. color=tempvar.x*(1.0-color) + (tempvar.y*color);
  1536. */
  1537. //+++ levels like in photoshop, including gamma, lightness, additive brightness
  1538. color=max(color-ECCInBlack, 0.0) / max(ECCInWhite-ECCInBlack, 0.0001);
  1539. if (ECCGamma!=1.0) color=pow(color, ECCGamma);
  1540. color=color*(ECCOutWhite-ECCOutBlack) + ECCOutBlack;
  1541.  
  1542. //+++ brightness
  1543. color=color*ECCBrightness;
  1544.  
  1545. //+++ contrast
  1546. color=(color-ECCContrastGrayLevel) * ECCContrast + ECCContrastGrayLevel;
  1547.  
  1548. //+++ saturation
  1549. tempgray=dot(color, 0.3333);
  1550. color=lerp(tempgray, color, ECCSaturation);
  1551.  
  1552. //+++ desaturate shadows
  1553. tempgray=dot(color, 0.3333);
  1554. tempvar.x=saturate(1.0-tempgray);
  1555. tempvar.x*=tempvar.x;
  1556. tempvar.x*=tempvar.x;
  1557. color=lerp(color, tempgray, ECCDesaturateShadows*tempvar.x);
  1558.  
  1559. //+++ color balance
  1560. color=saturate(color);
  1561. tempgray=dot(color, 0.3333);
  1562. float2 shadow_highlight=float2(1.0-tempgray, tempgray);
  1563. shadow_highlight*=shadow_highlight;
  1564. color.rgb+=(ECCColorBalanceHighlights*2.0-1.0)*color * shadow_highlight.x;
  1565. color.rgb+=(ECCColorBalanceShadows*2.0-1.0)*(1.0-color) * shadow_highlight.y;
  1566.  
  1567. //+++ channel mixer
  1568. tempcolor=color;
  1569. color.r=dot(tempcolor, ECCChannelMixerR);
  1570. color.g=dot(tempcolor, ECCChannelMixerG);
  1571. color.b=dot(tempcolor, ECCChannelMixerB);
  1572. #endif //E_CC_PROCEDURAL
  1573.  
  1574.  
  1575. //FiftyTifty Vibrance begin
  1576. if(bFiftyTiftyVibrance)
  1577. {
  1578. float3 VibCoeff = float3((VibranceR * VibranceIntensity), (VibranceG * VibranceIntensity), (VibranceB * VibranceIntensity));
  1579.  
  1580. float3 VibColor = color.rgb;
  1581.  
  1582. float3 LumCoeff = float3(0.2127, 0.7152, 0.0722);
  1583. float Luma = dot(LumCoeff, VibColor.rgb);
  1584.  
  1585. float VibMaxColor = max(color.r, max(color.g, color.b));
  1586. float VibMinColor = min(color.r, min(color.g, color.b));
  1587.  
  1588. float VibSaturation = VibMaxColor - VibMinColor;
  1589.  
  1590. VibColor.rgb = lerp(Luma, VibColor.rgb, (1.0 + (VibCoeff * (1.0 - (sign(VibCoeff) * VibSaturation)))));
  1591. VibColor.rgb = float3((VibColor.r * VibranceRBrightness), (VibColor.g * VibranceGBrightness), (VibColor.b * VibranceBBrightness)); //Made it possible to adjust the colours' brightness
  1592.  
  1593. color.rgb = VibColor.rgb;
  1594. }
  1595. //FiftyTifty Vibrance end
  1596.  
  1597.  
  1598.  
  1599.  
  1600. // ##############################
  1601. // BEGIN NIGHTEYE IMPLEMENTATION
  1602. // ##############################
  1603. if(nightEyeEnable)
  1604. {
  1605. float vignette = 0.0;
  1606. if(nightEyeVignetteEnable) // Add Vignette
  1607. {
  1608. float2 vignetteTxCoord = IN.txcoord0.xy;
  1609. float2 center = float2(0.5, 0.5);
  1610. float2 txCorrected = float2((vignetteTxCoord.x - center.x) *
  1611. aspectRatio / nightEyeVignetteAspectRatio + center.x, vignetteTxCoord.y);
  1612. float dist;
  1613. [branch]if(nightEyeEnableEyes) // Eyes (2 centers)
  1614. {
  1615. float2 leftEyeCenter = float2(center.x - nightEyeEyesSeparation / 2.0, center.y);
  1616. float2 rightEyeCenter = float2(center.x + nightEyeEyesSeparation / 2.0, center.y);
  1617. float leftEyeDist = distance(txCorrected, leftEyeCenter);
  1618. float rightEyeDist = distance(txCorrected, rightEyeCenter);
  1619. dist = min(leftEyeDist, rightEyeDist);
  1620. }
  1621. else
  1622. {
  1623. dist = distance(txCorrected, center);
  1624. }
  1625. float distT = linStep(nightEyeVignetteMinDistance, nightEyeVignetteMaxDistance, dist);
  1626. vignette = pow(distT, nightEyeVignetteDistancePower);
  1627. }
  1628.  
  1629. if(nightEyeCCEnable) // Color Correct
  1630. {
  1631. float3 nightEye = color.xyz;
  1632. nightEye = pow(nightEye, nightEyeGamma);
  1633. nightEye = RGBtoHSV(nightEye);
  1634. nightEye.x += nightEyeHueShift + nightEyeHueSpeed * Timer.x * 1000.0;
  1635. nightEye.y *= nightEyeSaturationMult;
  1636. nightEye.z *= nightEyeValueMult;
  1637. nightEye = HSVtoRGB(nightEye);
  1638. nightEye *= nightEyeTint;
  1639. float mask = vignette;
  1640. if(nightEyeVignetteMaskMult < 0) mask = -1.0 * (1.0 - vignette);
  1641. mask *= nightEyeVignetteMaskMult;
  1642. nightEye *= (1.0 - mask) + (mask * nightEyeVignetteValueMult);
  1643. color.xyz = saturate((nightEye.xyz * nightEyeT) + (color.xyz * (1.0 - nightEyeT)));
  1644. //color.xyz = lerp(color.xyz, nightEye.xyz, t);
  1645. }
  1646.  
  1647. if(nightEyeBloomEnable) // Add Bloom
  1648. {
  1649. float3 nightEyeBloom = tex2D(_s3, _v0);
  1650. nightEyeBloom = pow(nightEyeBloom, nightEyeBloomGamma);
  1651. nightEyeBloom = RGBtoHSV(nightEyeBloom);
  1652. nightEyeBloom.x += nightEyeBloomHueShift + nightEyeBloomHueSpeed * Timer.x * 1000.0;
  1653. nightEyeBloom.y *= nightEyeBloomSaturationMult;
  1654. nightEyeBloom.z *= nightEyeBloomValueMult;
  1655. nightEyeBloom = HSVtoRGB(nightEyeBloom);
  1656. nightEyeBloom *= nightEyeBloomTint;
  1657. float mask = vignette;
  1658. if(nightEyeBloomVignetteMaskMult < 0) mask = -1.0 * (1.0 - vignette);
  1659. mask *= nightEyeBloomVignetteMaskMult;
  1660. nightEyeBloom *= (1.0 - mask) + (mask * nightEyeBloomVignetteMult);
  1661. nightEyeBloom *= nightEyeT;
  1662. color.xyz= saturate(color.xyz + nightEyeBloom.xyz);
  1663. }
  1664.  
  1665. if(nightEyeNoiseEnable) // Add Noise
  1666. {
  1667. float3 noiseCoord = float3(_v0.x, _v0.y, Timer.x);
  1668. float3 nightEyeNoise = randomNoise(noiseCoord);
  1669. nightEyeNoise *= nightEyeNoiseMult;
  1670. nightEyeNoise *= nightEyeNoiseTint;
  1671. float mask = vignette;
  1672. if(nightEyeNoiseVignetteMaskMult < 0) mask = -1.0 * (1.0 - vignette);
  1673. mask *= nightEyeNoiseVignetteMaskMult;
  1674. nightEyeNoise *= mask + ((1.0 - mask) * nightEyeNoiseVignetteMult);
  1675. nightEyeNoise *= nightEyeT;
  1676. color.xyz = saturate(color.xyz + nightEyeNoise.xyz);
  1677. }
  1678. if(nightEyeCalibrate) // Calibrate
  1679. {
  1680.  
  1681. float2 calibrateCoords = IN.txcoord0;
  1682. float4 calibrateText = 0;
  1683. calibrateText += float4(1.0, 1.0, 0.0, 1.0) *
  1684. EED_drawFloatText(
  1685. //ASCII N i g h
  1686. float4(78, 105, 103, 104),
  1687. // ACII t E y e
  1688. float4(116, 69, 121, 101),
  1689. nightEyeT,
  1690. calibrateCoords,
  1691. float2(0.85, 0),
  1692. 1.2,
  1693. 6 // precision
  1694. );
  1695.  
  1696. calibrateText += EED_drawFloatText(
  1697. //ASCII N i g h
  1698. float4(78, 105, 103, 104),
  1699. // ACII t D a y
  1700. float4(116, 68, 97, 121),
  1701. ENightDayFactor,
  1702. calibrateCoords,
  1703. float2(0.85, 0.05),
  1704. 1.0,
  1705. 6 // precision
  1706. );
  1707.  
  1708. calibrateText += EED_drawFloatText(
  1709. //ASCII I n t e
  1710. float4(73, 110, 116, 101),
  1711. // ACII r i o r
  1712. float4(114, 105, 111, 114),
  1713. EInteriorFactor,
  1714. calibrateCoords,
  1715. float2(0.85, 0.075),
  1716. 1.0,
  1717. 6 // precision
  1718. );
  1719.  
  1720. calibrateText += EED_drawCRegistersText(_c1, _c2, _c3, _c4, _c5,
  1721. calibrateCoords, float2(0.85, 0.125), 1.0, 6);
  1722.  
  1723. color.xyz += calibrateText.xyz;
  1724. }
  1725.  
  1726. }
  1727. // ##############################
  1728. // END NIGHTEYE IMPLEMENTATION
  1729. // ##############################
  1730.  
  1731.  
  1732. //FiftyTifty HPD Tonemapping begin
  1733. if(bFiftyTiftyHPDTonemapping)
  1734. {
  1735. float3 xColor = color.xyz;
  1736. xColor = max(xColor, HPDTonemappingClipping);
  1737. float3 HPDcolor = pow(abs((xColor * (HPDTonemappingUpperTone * xColor + HPDTonemappingGreyTone )) / (xColor * (HPDTonemappingUpperTone * xColor + HPDTonemappingMiddleTone) + HPDTonemappingLowerTone )), HPDTonemappingExposure);
  1738.  
  1739. if(bFiftyTiftyHPDTonemappingMethod)
  1740. {
  1741. color.xyz = lerp(pow(HPDcolor.xyz, 1.0/2.2), color.xyz, HPDTonemappingLerp);
  1742. }
  1743. else
  1744. {
  1745. color.xyz = lerp(HPDcolor.xyz, color.xyz, HPDTonemappingLerp);
  1746. }
  1747. }
  1748. //FiftyTifty HPD Tonemapping end
  1749.  
  1750.  
  1751.  
  1752. _oC0.w=1.0;
  1753. _oC0.xyz=color.xyz;
  1754.  
  1755. return _oC0;
  1756. }
  1757.  
  1758.  
  1759.  
  1760. //switch between vanilla and mine post processing
  1761. technique Shader_D6EC7DD1 <string UIName="ENBSeries";>
  1762. {
  1763. pass p0
  1764. {
  1765. VertexShader = compile vs_3_0 VS_Quad();
  1766. PixelShader = compile ps_3_0 PS_D6EC7DD1();
  1767.  
  1768. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1769. ZEnable=FALSE;
  1770. ZWriteEnable=FALSE;
  1771. CullMode=NONE;
  1772. AlphaTestEnable=FALSE;
  1773. AlphaBlendEnable=FALSE;
  1774. SRGBWRITEENABLE=FALSE;
  1775. }
  1776. }
  1777.  
  1778.  
  1779.  
  1780. //original shader of post processing
  1781. technique Shader_ORIGINALPOSTPROCESS <string UIName="Vanilla";>
  1782. {
  1783. pass p0
  1784. {
  1785. VertexShader = compile vs_3_0 VS_Quad();
  1786. PixelShader=
  1787. asm
  1788. {
  1789. // Parameters:
  1790. // sampler2D Avg;
  1791. // sampler2D Blend;
  1792. // float4 Cinematic;
  1793. // float4 ColorRange;
  1794. // float4 Fade;
  1795. // sampler2D Image;
  1796. // float4 Param;
  1797. // float4 Tint;
  1798. // Registers:
  1799. // Name Reg Size
  1800. // ------------ ----- ----
  1801. // ColorRange c1 1
  1802. // Param c2 1
  1803. // Cinematic c3 1
  1804. // Tint c4 1
  1805. // Fade c5 1
  1806. // Image s0 1
  1807. // Blend s1 1
  1808. // Avg s2 1
  1809. //s0 bloom result
  1810. //s1 color
  1811. //s2 is average color
  1812.  
  1813. ps_3_0
  1814. def c6, 0, 0, 0, 0
  1815. //was c0 originally
  1816. def c7, 0.212500006, 0.715399981, 0.0720999986, 1
  1817. dcl_texcoord v0.xy
  1818. dcl_2d s0
  1819. dcl_2d s1
  1820. dcl_2d s2
  1821. rcp r0.x, c2.y
  1822. texld r1, v0, s2
  1823. mul r0.yz, r1.xxyw, c1.y
  1824. rcp r0.w, r0.y
  1825. mul r0.z, r0.w, r0.z
  1826. texld r1, v0, s1
  1827. mul r1.xyz, r1, c1.y
  1828. dp3 r0.w, c7, r1
  1829. mul r1.w, r0.w, r0.z
  1830. mad r0.z, r0.z, r0.w, c7.w
  1831. rcp r0.z, r0.z
  1832. mad r0.x, r1.w, r0.x, c7.w
  1833. mul r0.x, r0.x, r1.w
  1834. mul r0.x, r0.z, r0.x
  1835. cmp r0.x, -r0.w, c6.x, r0.x
  1836. rcp r0.z, r0.w
  1837. mul r0.z, r0.z, r0.x
  1838. add_sat r0.x, -r0.x, c2.x
  1839. texld r2, v0, s0
  1840. mul r2.xyz, r2, c1.y
  1841. mul r2.xyz, r0.x, r2
  1842. mad r1.xyz, r1, r0.z, r2
  1843. dp3 r0.x, r1, c7
  1844. mov r1.w, c7.w
  1845. lrp r2, c3.x, r1, r0.x
  1846. mad r1, r0.x, c4, -r2
  1847. mad r1, c4.w, r1, r2
  1848. mad r1, c3.w, r1, -r0.y
  1849. mad r0, c3.z, r1, r0.y
  1850. add r1, -r0, c5
  1851. mad oC0, c5.w, r1, r0
  1852. };
  1853. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1854. ZEnable=FALSE;
  1855. ZWriteEnable=FALSE;
  1856. CullMode=NONE;
  1857. AlphaTestEnable=FALSE;
  1858. AlphaBlendEnable=FALSE;
  1859. SRGBWRITEENABLE=FALSE;
  1860. }
  1861. }
Add Comment
Please, Sign In to add comment