Advertisement
Guest User

ENB - NLA enbeffect.fx -> New Vegas

a guest
Mar 5th, 2016
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.98 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 3
  12. #endif
  13.  
  14. //use original game processing first, then mine
  15. //#define APPLYGAMECOLORCORRECTION
  16. #define NLA_COLOUR_CONTROLS
  17. #define NLA_TONEMAPPING_CONTROLS
  18. #define NLA_BRIGHTNESS_CONTROLS
  19. #define NLA_LOWDEF_COLOUR_CONTROLS
  20.  
  21.  
  22.  
  23. //+++++++++++++++++++++++++++++
  24. //internal parameters, can be modified
  25. //+++++++++++++++++++++++++++++
  26.  
  27. //begin NLA Colour
  28. #ifdef NLA_COLOUR_CONTROLS
  29.  
  30. float PaletteDay
  31. <
  32. string UIName="CC: Palette Intensity Day";
  33. string UIWidget="Spinner";
  34. float UIMin=0.0;
  35. float UIMax=5.0;
  36. > = {1.05};
  37.  
  38. float PaletteNight
  39. <
  40. string UIName="CC: Palette Intensity Night";
  41. string UIWidget="Spinner";
  42. float UIMin=0.0;
  43. float UIMax=5.0;
  44. > = {1.05};
  45.  
  46. float PaletteInterior
  47. <
  48. string UIName="CC: Palette Intensity Interior";
  49. string UIWidget="Spinner";
  50. float UIMin=0.0;
  51. float UIMax=5.0;
  52. > = {1.0};
  53.  
  54. float PaletteBrightnessDay
  55. <
  56. string UIName="CC: Palette Gamma Day";
  57. string UIWidget="Spinner";
  58. float UIMin=1.0;
  59. float UIMax=3.0;
  60. > = {1.0};
  61.  
  62. float PaletteBrightnessNight
  63. <
  64. string UIName="CC: Palette Gamma Night";
  65. string UIWidget="Spinner";
  66. float UIMin=1.0;
  67. float UIMax=3.0;
  68. > = {3.0};
  69.  
  70. float PaletteBrightnessInterior
  71. <
  72. string UIName="CC: Palette Gamma Interior";
  73. string UIWidget="Spinner";
  74. float UIMin=1.0;
  75. float UIMax=5.0;
  76. > = {3.0};
  77.  
  78. float GammaDay
  79. <
  80. string UIName="CC: Gamma Day";
  81. string UIWidget="Spinner";
  82. float UIMin=0.0;
  83. float UIMax=5.0;
  84. > = {1.38};
  85.  
  86. float GammaNight
  87. <
  88. string UIName="CC: Gamma Night";
  89. string UIWidget="Spinner";
  90. float UIMin=0.0;
  91. float UIMax=5.0;
  92. > = {1.25};
  93.  
  94. float GammaInterior
  95. <
  96. string UIName="CC: Gamma Interior";
  97. string UIWidget="Spinner";
  98. float UIMin=0.0;
  99. float UIMax=5.0;
  100. > = {1.1};
  101.  
  102. float RedFilterDay
  103. <
  104. string UIName="CC: Red Filter Day";
  105. string UIWidget="Spinner";
  106. float UIMin=0.0;
  107. float UIMax=1.0;
  108. > = {1.0};
  109.  
  110. float RedFilterNight
  111. <
  112. string UIName="CC: Red Filter Night";
  113. string UIWidget="Spinner";
  114. float UIMin=0.0;
  115. float UIMax=1.0;
  116. > = {1.0};
  117.  
  118. float RedFilterInterior
  119. <
  120. string UIName="CC: Red Filter Interior";
  121. string UIWidget="Spinner";
  122. float UIMin=0.0;
  123. float UIMax=1.0;
  124. > = {0.98};
  125.  
  126. float GreenFilterDay
  127. <
  128. string UIName="CC: Green Filter Day";
  129. string UIWidget="Spinner";
  130. float UIMin=0.0;
  131. float UIMax=1.0;
  132. > = {1.0};
  133.  
  134. float GreenFilterNight
  135. <
  136. string UIName="CC: Green Filter Night";
  137. string UIWidget="Spinner";
  138. float UIMin=0.0;
  139. float UIMax=1.0;
  140. > = {1.0};
  141.  
  142. float GreenFilterInterior
  143. <
  144. string UIName="CC: Green Filter Interior";
  145. string UIWidget="Spinner";
  146. float UIMin=0.0;
  147. float UIMax=1.0;
  148. > = {0.98};
  149.  
  150. float BlueFilterDay
  151. <
  152. string UIName="CC: Blue Filter Day";
  153. string UIWidget="Spinner";
  154. float UIMin=0.0;
  155. float UIMax=1.0;
  156. > = {1.0};
  157.  
  158. float BlueFilterNight
  159. <
  160. string UIName="CC: Blue Filter Night";
  161. string UIWidget="Spinner";
  162. float UIMin=0.0;
  163. float UIMax=1.0;
  164. > = {0.975};
  165.  
  166. float BlueFilterInterior
  167. <
  168. string UIName="CC: Blue Filter Interior";
  169. string UIWidget="Spinner";
  170. float UIMin=0.0;
  171. float UIMax=1.0;
  172. > = {1.0};
  173.  
  174. float DesatRDay
  175. <
  176. string UIName="CC: Desat Red Day";
  177. string UIWidget="Spinner";
  178. float UIMin=0.0;
  179. float UIMax=1.0;
  180. > = {1.0};
  181.  
  182. float DesatRNight
  183. <
  184. string UIName="CC: Desat Red Night";
  185. string UIWidget="Spinner";
  186. float UIMin=0.0;
  187. float UIMax=1.0;
  188. > = {1.0};
  189.  
  190. float DesatRInterior
  191. <
  192. string UIName="CC: Desat Red Interior";
  193. string UIWidget="Spinner";
  194. float UIMin=0.0;
  195. float UIMax=1.0;
  196. > = {1.0};
  197.  
  198. float DesatGDay
  199. <
  200. string UIName="CC: Desat Green Day";
  201. string UIWidget="Spinner";
  202. float UIMin=0.0;
  203. float UIMax=1.0;
  204. > = {0.1};
  205.  
  206. float DesatGNight
  207. <
  208. string UIName="CC: Desat Green Night";
  209. string UIWidget="Spinner";
  210. float UIMin=0.0;
  211. float UIMax=1.0;
  212. > = {0.2};
  213.  
  214. float DesatGInterior
  215. <
  216. string UIName="CC: Desat Green Interior";
  217. string UIWidget="Spinner";
  218. float UIMin=0.0;
  219. float UIMax=1.0;
  220. > = {0.2};
  221.  
  222. float DesatBDay
  223. <
  224. string UIName="CC: Desat Blue Day";
  225. string UIWidget="Spinner";
  226. float UIMin=0.0;
  227. float UIMax=1.0;
  228. > = {0.6};
  229.  
  230. float DesatBNight
  231. <
  232. string UIName="CC: Desat Blue Night";
  233. string UIWidget="Spinner";
  234. float UIMin=0.0;
  235. float UIMax=1.0;
  236. > = {0.8};
  237.  
  238. float DesatBInterior
  239. <
  240. string UIName="CC: Desat Blue Interior";
  241. string UIWidget="Spinner";
  242. float UIMin=0.0;
  243. float UIMax=1.0;
  244. > = {0.6};
  245. #endif
  246. //end NLA Colour
  247.  
  248. //begin NLA Tonemapping
  249. #ifdef NLA_TONEMAPPING_CONTROLS
  250. float IntensityContrastDay
  251. <
  252. string UIName="TM: Intensity Contrast Day";
  253. string UIWidget="Spinner";
  254. float UIMin=0.0;
  255. float UIMax=10.0;
  256. > = {1.3};
  257.  
  258. float IntensityContrastNight
  259. <
  260. string UIName="TM: Intensity Contrast Night";
  261. string UIWidget="Spinner";
  262. float UIMin=0.0;
  263. float UIMax=10.0;
  264. > = {1.3};
  265.  
  266. float IntensityContrastInterior
  267. <
  268. string UIName="TM: Intensity Contrast Interior";
  269. string UIWidget="Spinner";
  270. float UIMin=0.0;
  271. float UIMax=10.0;
  272. > = {1.3};
  273.  
  274. float SaturationDay
  275. <
  276. string UIName="TM: Saturation Day";
  277. string UIWidget="Spinner";
  278. float UIMin=0.0;
  279. float UIMax=10.0;
  280. > = {1.7};
  281.  
  282. float SaturationNight
  283. <
  284. string UIName="TM: Saturation Night";
  285. string UIWidget="Spinner";
  286. float UIMin=0.0;
  287. float UIMax=10.0;
  288. > = {1.3};
  289.  
  290. float SaturationInterior
  291. <
  292. string UIName="TM: Saturation Interior";
  293. string UIWidget="Spinner";
  294. float UIMin=0.0;
  295. float UIMax=10.0;
  296. > = {1.3};
  297.  
  298. float ToneMappingCurveDay
  299. <
  300. string UIName="TM: ToneMapping Curve Day";
  301. string UIWidget="Spinner";
  302. float UIMin=0.0;
  303. float UIMax=10.0;
  304. > = {2.0};
  305.  
  306. float ToneMappingCurveNight
  307. <
  308. string UIName="TM: ToneMapping Curve Night";
  309. string UIWidget="Spinner";
  310. float UIMin=0.0;
  311. float UIMax=10.0;
  312. > = {2.0};
  313.  
  314. float ToneMappingCurveInterior
  315. <
  316. string UIName="TM: ToneMapping Curve Interior";
  317. string UIWidget="Spinner";
  318. float UIMin=0.0;
  319. float UIMax=10.0;
  320. > = {1.8};
  321.  
  322. float ToneMappingOversaturationDay
  323. <
  324. string UIName="TM: ToneMapping Oversaturation Day";
  325. string UIWidget="Spinner";
  326. float UIMin=0.1;
  327. float UIMax=999.0;
  328. > = {120.0};
  329.  
  330. float ToneMappingOversaturationNight
  331. <
  332. string UIName="TM: ToneMapping Oversaturation Night";
  333. string UIWidget="Spinner";
  334. float UIMin=0.1;
  335. float UIMax=999.0;
  336. > = {12.0};
  337.  
  338. float ToneMappingOversaturationInterior
  339. <
  340. string UIName="TM: ToneMapping Oversaturation Interior";
  341. string UIWidget="Spinner";
  342. float UIMin=0.1;
  343. float UIMax=999.0;
  344. > = {20.0};
  345. #endif
  346. //end NLA Tonemapping
  347.  
  348. //begin NLA Brightness
  349. #ifdef NLA_BRIGHTNESS_CONTROLS
  350.  
  351. float BrightnessDay
  352. <
  353. string UIName="B: Brightness Day";
  354. string UIWidget="Spinner";
  355. float UIMin=0.0;
  356. float UIMax=1.0;
  357. > = {0.15};
  358.  
  359. float BrightnessNight
  360. <
  361. string UIName="B: Brightness Night";
  362. string UIWidget="Spinner";
  363. float UIMin=0.0;
  364. float UIMax=1.0;
  365. > = {0.15};
  366.  
  367. float BrightnessInterior
  368. <
  369. string UIName="B: Brightness Interior";
  370. string UIWidget="Spinner";
  371. float UIMin=0.0;
  372. float UIMax=1.0;
  373. > = {0.15};
  374.  
  375. float BrightnessCurveDay
  376. <
  377. string UIName="B: Brightness Curve Day";
  378. string UIWidget="Spinner";
  379. float UIMin=0.0;
  380. float UIMax=10.0;
  381. > = {1.28};
  382.  
  383. float BrightnessCurveNight
  384. <
  385. string UIName="B: Brightness Curve Night";
  386. string UIWidget="Spinner";
  387. float UIMin=0.0;
  388. float UIMax=10.0;
  389. > = {1.28};
  390.  
  391. float BrightnessCurveInterior
  392. <
  393. string UIName="B: Brightness Curve Interior";
  394. string UIWidget="Spinner";
  395. float UIMin=0.0;
  396. float UIMax=10.0;
  397. > = {1.22};
  398.  
  399. float BrightnessMultiplierDay
  400. <
  401. string UIName="B: Brightness Multiplier Day";
  402. string UIWidget="Spinner";
  403. float UIMin=0.0;
  404. float UIMax=1.0;
  405. > = {0.9};
  406.  
  407. float BrightnessMultiplierNight
  408. <
  409. string UIName="B: Brightness Multiplier Night";
  410. string UIWidget="Spinner";
  411. float UIMin=0.0;
  412. float UIMax=1.0;
  413. > = {0.9};
  414.  
  415. float BrightnessMultiplierInterior
  416. <
  417. string UIName="B: Brightness Multiplier Interior";
  418. string UIWidget="Spinner";
  419. float UIMin=0.0;
  420. float UIMax=1.0;
  421. > = {0.15};
  422.  
  423. float BrightnessToneMappingCurveDay
  424. <
  425. string UIName="B: Brightness ToneMapping Curve Day";
  426. string UIWidget="Spinner";
  427. float UIMin=0.0;
  428. float UIMax=1.0;
  429. > = {0.5};
  430.  
  431. float BrightnessToneMappingCurveNight
  432. <
  433. string UIName="B: Brightness ToneMapping Curve Night";
  434. string UIWidget="Spinner";
  435. float UIMin=0.0;
  436. float UIMax=1.0;
  437. > = {0.5};
  438.  
  439. float BrightnessToneMappingCurveInterior
  440. <
  441. string UIName="B: Brightness ToneMapping Curve Interior";
  442. string UIWidget="Spinner";
  443. float UIMin=0.0;
  444. float UIMax=1.0;
  445. > = {0.15};
  446.  
  447. #endif
  448. //end NLA Brightness
  449.  
  450. #ifdef NLA_LOWDEF_COLOUR_CONTROLS
  451. float ECCGamma
  452. <
  453. string UIName="CC: Gamma";
  454. string UIWidget="Spinner";
  455. float UIMin=0.2;//not zero!!!
  456. float UIMax=5.0;
  457. > = {1.0};
  458.  
  459. float ECCInBlack
  460. <
  461. string UIName="CC: In black";
  462. string UIWidget="Spinner";
  463. float UIMin=0.0;
  464. float UIMax=1.0;
  465. > = {0.0};
  466.  
  467. float ECCInWhite
  468. <
  469. string UIName="CC: In white";
  470. string UIWidget="Spinner";
  471. float UIMin=0.0;
  472. float UIMax=1.0;
  473. > = {1.0};
  474.  
  475. float ECCOutBlack
  476. <
  477. string UIName="CC: Out black";
  478. string UIWidget="Spinner";
  479. float UIMin=0.0;
  480. float UIMax=1.0;
  481. > = {0.0};
  482.  
  483. float ECCOutWhite
  484. <
  485. string UIName="CC: Out white";
  486. string UIWidget="Spinner";
  487. float UIMin=0.0;
  488. float UIMax=1.0;
  489. > = {1.0};
  490.  
  491. float ECCBrightness
  492. <
  493. string UIName="CC: Brightness";
  494. string UIWidget="Spinner";
  495. float UIMin=0.0;
  496. float UIMax=10.0;
  497. > = {1.0};
  498.  
  499. float ECCContrastGrayLevel
  500. <
  501. string UIName="CC: Contrast gray level";
  502. string UIWidget="Spinner";
  503. float UIMin=0.01;
  504. float UIMax=0.99;
  505. > = {0.5};
  506.  
  507. float ECCContrast
  508. <
  509. string UIName="CC: Contrast";
  510. string UIWidget="Spinner";
  511. float UIMin=0.0;
  512. float UIMax=10.0;
  513. > = {1.0};
  514.  
  515. float ECCSaturation
  516. <
  517. string UIName="CC: Saturation";
  518. string UIWidget="Spinner";
  519. float UIMin=0.0;
  520. float UIMax=10.0;
  521. > = {1.0};
  522.  
  523. float ECCDesaturateShadows
  524. <
  525. string UIName="CC: Desaturate shadows";
  526. string UIWidget="Spinner";
  527. float UIMin=0.0;
  528. float UIMax=1.0;
  529. > = {0.0};
  530.  
  531. float3 ECCColorBalanceShadows <
  532. string UIName="CC: Color balance shadows";
  533. string UIWidget="Color";
  534. > = {0.5, 0.5, 0.5};
  535.  
  536. float3 ECCColorBalanceHighlights <
  537. string UIName="CC: Color balance highlights";
  538. string UIWidget="Color";
  539. > = {0.5, 0.5, 0.5};
  540.  
  541. float3 ECCChannelMixerR <
  542. string UIName="CC: Channel mixer R";
  543. string UIWidget="Color";
  544. > = {1.0, 0.0, 0.0};
  545.  
  546. float3 ECCChannelMixerG <
  547. string UIName="CC: Channel mixer G";
  548. string UIWidget="Color";
  549. > = {0.0, 1.0, 0.0};
  550.  
  551. float3 ECCChannelMixerB <
  552. string UIName="CC: Channel mixer B";
  553. string UIWidget="Color";
  554. > = {0.0, 0.0, 1.0};
  555. #endif
  556.  
  557.  
  558. //+++++++++++++++++++++++++++++
  559. //external parameters, do not modify
  560. //+++++++++++++++++++++++++++++
  561. //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
  562. float4 tempF1; //0,1,2,3
  563. float4 tempF2; //5,6,7,8
  564. float4 tempF3; //9,0
  565. //x=generic timer in range 0..1, period of 16777216 ms (4.6 hours), w=frame time elapsed (in seconds)
  566. float4 Timer;
  567. //x=Width, y=1/Width, z=ScreenScaleY, w=1/ScreenScaleY
  568. float4 ScreenSize;
  569. //changes in range 0..1, 0 means that night time, 1 - day time
  570. float ENightDayFactor;
  571. //changes 0 or 1. 0 means that exterior, 1 - interior
  572. float EInteriorFactor;
  573. //enb version of bloom applied, ignored if original post processing used
  574. float EBloomAmount;
  575.  
  576.  
  577.  
  578. texture2D texs0;//color falloutnv
  579. texture2D texs1;//bloom falloutnv
  580. texture2D texs3;//bloom enb
  581. texture2D texs4;//adaptation enb
  582. texture2D texs7;//palette enb
  583.  
  584. sampler2D _s0 = sampler_state
  585. {
  586. Texture = <texs0>;
  587. MinFilter = POINT;//
  588. MagFilter = POINT;//
  589. MipFilter = NONE;//LINEAR;
  590. AddressU = Clamp;
  591. AddressV = Clamp;
  592. SRGBTexture=FALSE;
  593. MaxMipLevel=0;
  594. MipMapLodBias=0;
  595. };
  596.  
  597. sampler2D _s1 = sampler_state
  598. {
  599. Texture = <texs1>;
  600. MinFilter = LINEAR;//
  601. MagFilter = LINEAR;//
  602. MipFilter = NONE;//LINEAR;
  603. AddressU = Clamp;
  604. AddressV = Clamp;
  605. SRGBTexture=FALSE;
  606. MaxMipLevel=0;
  607. MipMapLodBias=0;
  608. };
  609.  
  610. sampler2D _s3 = sampler_state
  611. {
  612. Texture = <texs3>;
  613. MinFilter = LINEAR;//
  614. MagFilter = LINEAR;//
  615. MipFilter = NONE;//LINEAR;
  616. AddressU = Clamp;
  617. AddressV = Clamp;
  618. SRGBTexture=FALSE;
  619. MaxMipLevel=0;
  620. MipMapLodBias=0;
  621. };
  622.  
  623. sampler2D _s4 = sampler_state
  624. {
  625. Texture = <texs4>;
  626. MinFilter = LINEAR;//
  627. MagFilter = LINEAR;//
  628. MipFilter = NONE;//LINEAR;
  629. AddressU = Clamp;
  630. AddressV = Clamp;
  631. SRGBTexture=FALSE;
  632. MaxMipLevel=0;
  633. MipMapLodBias=0;
  634. };
  635.  
  636. sampler2D _s7 = sampler_state
  637. {
  638. Texture = <texs7>;
  639. MinFilter = LINEAR;
  640. MagFilter = LINEAR;
  641. MipFilter = NONE;
  642. AddressU = Clamp;
  643. AddressV = Clamp;
  644. SRGBTexture=FALSE;
  645. MaxMipLevel=0;
  646. MipMapLodBias=0;
  647. };
  648.  
  649. struct VS_OUTPUT_POST
  650. {
  651. float4 vpos : POSITION;
  652. float2 txcoord0 : TEXCOORD0;
  653. };
  654. struct VS_INPUT_POST
  655. {
  656. float3 pos : POSITION;
  657. float2 txcoord0 : TEXCOORD0;
  658. };
  659.  
  660.  
  661.  
  662. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  663. //
  664. //+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
  665. VS_OUTPUT_POST VS_Quad(VS_INPUT_POST IN)
  666. {
  667. VS_OUTPUT_POST OUT;
  668.  
  669. OUT.vpos=float4(IN.pos.x,IN.pos.y,IN.pos.z,1.0);
  670.  
  671. OUT.txcoord0.xy=IN.txcoord0.xy;
  672.  
  673. return OUT;
  674. }
  675.  
  676.  
  677.  
  678. //falloutnv shader specific externals, do not modify
  679. float4 _c1 : register(c1);
  680. float4 _c2 : register(c2);
  681. float4 _c19 : register(c19);
  682. float4 _c20 : register(c20);
  683. float4 _c22 : register(c22);
  684.  
  685. float4 PS_C1DAE3F7(VS_OUTPUT_POST IN, float2 vPos : VPOS) : COLOR
  686. {
  687. float4 _oC0=0.0; //output
  688.  
  689. float4 r0;
  690. float4 r1;
  691. float4 r2;
  692. float4 r3;
  693. float4 r4;
  694. float4 r5;
  695. float4 r6;
  696. float4 r7;
  697. float4 r8;
  698. float4 r9;
  699. float4 r10;
  700. float4 r11;
  701.  
  702.  
  703. float4 _v0=0.0;
  704.  
  705. _v0.xy=IN.txcoord0.xy;
  706. r1=tex2D(_s0, _v0.xy); //color
  707.  
  708. //apply bloom
  709. float4 xcolorbloom=tex2D(_s3, _v0.xy);
  710.  
  711. xcolorbloom.xyz=xcolorbloom-r1;
  712. xcolorbloom.xyz=max(xcolorbloom, 0.0);
  713. r1.xyz+=xcolorbloom*EBloomAmount;
  714.  
  715. r11=r1; //my bypass
  716. _oC0.xyz=r1.xyz; //for future use without game color corrections
  717.  
  718.  
  719. #ifdef APPLYGAMECOLORCORRECTION
  720. //apply original
  721.  
  722. // float3 BlurScale;
  723. // float4 Cinematic;
  724. // sampler2D DestBlend;
  725. // float4 Fade;
  726. // float4 HDRParam;
  727. // sampler2D Src0;
  728. // float4 Tint;
  729. // Registers:
  730. // Name Reg Size
  731. // ------------ ----- ----
  732. // HDRParam c1 1
  733. // BlurScale c2 1
  734. // Cinematic c19 1
  735. // Tint c20 1
  736. // Fade c22 1
  737. // Src0 s0 1
  738. // DestBlend s1 1
  739. //todo apply uv offsets to coordinates
  740. r0=tex2D(_s0, IN.txcoord0.xy);//r0=tex2D(_s0, IN.txcoord1.xy);
  741. r1=tex2D(_s1, IN.txcoord0.xy);
  742. r0.w=max(r1.w, _c1.x);
  743. r0.w=1.0/r0.w;
  744. r1.w=r0.w * 0.5;
  745. r0.w=r0.w * _c1.x;
  746. r1.xyz=r1 * r1.w;
  747. r2.xyz=max(r1, 0.0);
  748. r0.xyz=r0.w * r0 + r2.xyz;
  749. r0.w=dot(r0.xyz, float3(0.298999995, 0.587000012, 0.114));
  750. r1.xyz=lerp(r0.w, r0, _c19.x);
  751. r0.xyz=_c20 * r0.w - r1;
  752. r0.xyz=_c20.w * r0 + r1;
  753. r0.xyz=_c19.w * r0 - _c19.y;
  754. r0.xyz=_c19.z * r0 + _c19.y;
  755. r1.xyz=lerp(r0, _c22, _c22.w);
  756. r1.w=_c2.z;
  757. _oC0=r1;
  758.  
  759. #endif //APPLYGAMECOLORCORRECTION
  760.  
  761.  
  762.  
  763. float4 color=_oC0;
  764.  
  765.  
  766. //adaptation in time
  767. float4 Adaptation=tex2D(_s4, 0.5);
  768. float grayadaptation=max(max(Adaptation.x, Adaptation.y), Adaptation.z);
  769.  
  770. #if (POSTPROCESS==3)
  771.  
  772. float Gamma=lerp(lerp(GammaNight, GammaDay, ENightDayFactor), GammaInterior, EInteriorFactor);
  773. float RedFilter=lerp(lerp(RedFilterNight, RedFilterDay, ENightDayFactor), RedFilterInterior, EInteriorFactor);
  774. float GreenFilter=lerp(lerp(GreenFilterNight, GreenFilterDay, ENightDayFactor), GreenFilterInterior, EInteriorFactor);
  775. float BlueFilter=lerp(lerp(BlueFilterNight, BlueFilterDay, ENightDayFactor), BlueFilterInterior, EInteriorFactor);
  776.  
  777. float DesatR=lerp(lerp(DesatRNight, DesatRDay, ENightDayFactor), DesatRInterior, EInteriorFactor);
  778. float DesatG=lerp(lerp(DesatGNight, DesatGDay, ENightDayFactor), DesatGInterior, EInteriorFactor);
  779. float DesatB=lerp(lerp(DesatBNight, DesatBDay, ENightDayFactor), DesatBInterior, EInteriorFactor);
  780.  
  781. float AdaptationMin=lerp(lerp(AdaptationMinNight, AdaptationMinDay, ENightDayFactor), AdaptationMinInterior, EInteriorFactor);
  782. float AdaptationMax=lerp(lerp(AdaptationMaxNight, AdaptationMaxDay, ENightDayFactor), AdaptationMaxInterior, EInteriorFactor);
  783.  
  784. float Saturation=lerp(lerp(SaturationNight, SaturationDay, ENightDayFactor), SaturationInterior, EInteriorFactor);
  785. float ToneMappingCurve=lerp(lerp(ToneMappingCurveNight, ToneMappingCurveDay, ENightDayFactor), ToneMappingCurveInterior, EInteriorFactor);
  786. float ToneMappingOversaturation=lerp(lerp(ToneMappingOversaturationNight, ToneMappingOversaturationDay, ENightDayFactor), ToneMappingOversaturationInterior, EInteriorFactor);
  787. float IntensityContrast=lerp(lerp(IntensityContrastNight, IntensityContrastDay, ENightDayFactor), IntensityContrastInterior, EInteriorFactor);
  788. float Brightness=lerp(lerp(BrightnessNight, BrightnessDay, ENightDayFactor), BrightnessInterior, EInteriorFactor);
  789. float BrightnessCurve=lerp(lerp(BrightnessCurveNight, BrightnessCurveDay, ENightDayFactor), BrightnessCurveInterior, EInteriorFactor);
  790. float BrightnessMultiplier=lerp(lerp(BrightnessMultiplierNight, BrightnessMultiplierDay, ENightDayFactor), BrightnessMultiplierInterior, EInteriorFactor);
  791. float BrightnessToneMappingCurve=lerp(lerp(BrightnessToneMappingCurveNight, BrightnessToneMappingCurveDay, ENightDayFactor), BrightnessToneMappingCurveInterior, EInteriorFactor);
  792.  
  793.  
  794. float greyscale = dot(color.xyz, float3(0.3, 0.59, 0.11));
  795. color.r = lerp(greyscale, color.r, DesatR);
  796. color.g = lerp(greyscale, color.g, DesatG);
  797. color.b = lerp(greyscale, color.b, DesatB);
  798.  
  799. color = pow(color, Gamma);
  800.  
  801. color.r = pow(color.r, RedFilter);
  802. color.g = pow(color.g, GreenFilter);
  803. color.b = pow(color.b, BlueFilter);
  804.  
  805. grayadaptation=max(grayadaptation, 0.0); //0.0
  806. grayadaptation=min(grayadaptation, 50.0); //50.0
  807. color.xyz=color.xyz/(grayadaptation*AdaptationMax+AdaptationMin);//*tempF1.x
  808.  
  809. color.xyz*=Brightness;
  810. color.xyz+=0.000001;
  811. float3 xncol=normalize(color.xyz);
  812. float3 scl=color.xyz/xncol.xyz;
  813. scl=pow(scl, IntensityContrast);
  814. xncol.xyz=pow(xncol.xyz, Saturation);
  815. color.xyz=scl*xncol.xyz;
  816.  
  817. float lumamax=ToneMappingOversaturation;
  818. color.xyz=(color.xyz * (1.0 + color.xyz/lumamax))/(color.xyz + ToneMappingCurve);
  819.  
  820. float Y = dot(color.xyz, float3(0.299, 0.587, 0.114)); //0.299 * R + 0.587 * G + 0.114 * B;
  821. float U = dot(color.xyz, float3(-0.14713, -0.28886, 0.436)); //-0.14713 * R - 0.28886 * G + 0.436 * B;
  822. float V = dot(color.xyz, float3(0.615, -0.51499, -0.10001)); //0.615 * R - 0.51499 * G - 0.10001 * B;
  823.  
  824. Y=pow(Y, BrightnessCurve);
  825. Y=Y*BrightnessMultiplier;
  826. Y=Y/(Y+BrightnessToneMappingCurve);
  827. float desaturatefact=saturate(Y*Y*Y*1.7);
  828. U=lerp(U, 0.0, desaturatefact);
  829. V=lerp(V, 0.0, desaturatefact);
  830. color.xyz=V * float3(1.13983, -0.58060, 0.0) + U * float3(0.0, -0.39465, 2.03211) + Y;
  831.  
  832. #endif
  833.  
  834.  
  835.  
  836. //pallete texture (0.082+ version feature)
  837. #ifdef E_CC_PALETTE
  838. float Palette=lerp(lerp(PaletteNight, PaletteDay, ENightDayFactor), PaletteInterior, EInteriorFactor);
  839. float PaletteBrightness=lerp(lerp(PaletteBrightnessNight, PaletteBrightnessDay, ENightDayFactor), PaletteBrightnessInterior, EInteriorFactor);
  840.  
  841. color.rgb=saturate(color.rgb);
  842. float3 brightness=Adaptation.xyz;//tex2D(_s4, 0.5);//adaptation luminance
  843. // brightness=saturate(brightness);//old version from ldr games
  844. brightness=(brightness/(brightness+PaletteBrightness));//new version
  845. brightness=max(brightness.x, max(brightness.y, brightness.z));//new version
  846. float3 palette;
  847. float4 uvsrc=0.0;
  848. uvsrc.y=brightness.r;
  849. uvsrc.x=color.r;
  850. palette.r=tex2Dlod(_s7, uvsrc).r;
  851. uvsrc.x=color.g;
  852. uvsrc.y=brightness.g;
  853. palette.g=tex2Dlod(_s7, uvsrc).g;
  854. uvsrc.x=color.b;
  855. uvsrc.y=brightness.b;
  856. palette.b=tex2Dlod(_s7, uvsrc).b;
  857. color.rgb=palette.rgb * Palette;
  858. #endif //E_CC_PALETTE
  859.  
  860.  
  861.  
  862. #ifdef E_CC_PROCEDURAL
  863. float tempgray;
  864. float4 tempvar;
  865. float3 tempcolor;
  866. /*
  867. //these replaced by "levels"
  868. //+++ gamma
  869. if (ECCGamma!=1.0)
  870. color=pow(color, 1.0/ECCGamma);
  871.  
  872. //+++ brightness like in photoshop
  873. color=color+ECCAditiveBrightness;
  874.  
  875. //+++ lightness
  876. tempvar.x=saturate(ELightness);
  877. tempvar.y=saturate(1.0+ECCLightness);
  878. color=tempvar.x*(1.0-color) + (tempvar.y*color);
  879. */
  880. //+++ levels like in photoshop, including gamma, lightness, additive brightness
  881. color=max(color-ECCInBlack, 0.0) / max(ECCInWhite-ECCInBlack, 0.0001);
  882. if (ECCGamma!=1.0) color=pow(color, ECCGamma);
  883. color=color*(ECCOutWhite-ECCOutBlack) + ECCOutBlack;
  884.  
  885. //+++ brightness
  886. color=color*ECCBrightness;
  887.  
  888. //+++ contrast
  889. color=(color-ECCContrastGrayLevel) * ECCContrast + ECCContrastGrayLevel;
  890.  
  891. //+++ saturation
  892. tempgray=dot(color, 0.3333);
  893. color=lerp(tempgray, color, ECCSaturation);
  894.  
  895. //+++ desaturate shadows
  896. tempgray=dot(color, 0.3333);
  897. tempvar.x=saturate(1.0-tempgray);
  898. tempvar.x*=tempvar.x;
  899. tempvar.x*=tempvar.x;
  900. color=lerp(color, tempgray, ECCDesaturateShadows*tempvar.x);
  901.  
  902. //+++ color balance
  903. color=saturate(color);
  904. tempgray=dot(color, 0.3333);
  905. float2 shadow_highlight=float2(1.0-tempgray, tempgray);
  906. shadow_highlight*=shadow_highlight;
  907. color.rgb+=(ECCColorBalanceHighlights*2.0-1.0)*color * shadow_highlight.x;
  908. color.rgb+=(ECCColorBalanceShadows*2.0-1.0)*(1.0-color) * shadow_highlight.y;
  909.  
  910. //+++ channel mixer
  911. tempcolor=color;
  912. color.r=dot(tempcolor, ECCChannelMixerR);
  913. color.g=dot(tempcolor, ECCChannelMixerG);
  914. color.b=dot(tempcolor, ECCChannelMixerB);
  915. #endif //E_CC_PROCEDURAL
  916.  
  917. _oC0.w=1.0;
  918. _oC0.xyz=color.xyz;
  919. return _oC0;
  920. }
  921.  
  922.  
  923.  
  924. //switch between vanilla and mine post processing
  925. technique Shader_C1DAE3F7 <string UIName="ENBSeries";>
  926. {
  927. pass p0
  928. {
  929. VertexShader = compile vs_3_0 VS_Quad();
  930. PixelShader = compile ps_3_0 PS_C1DAE3F7();
  931.  
  932. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  933. ZEnable=FALSE;
  934. ZWriteEnable=FALSE;
  935. CullMode=NONE;
  936. AlphaTestEnable=FALSE;
  937. AlphaBlendEnable=FALSE;
  938. SRGBWRITEENABLE=FALSE;
  939. }
  940. }
  941.  
  942.  
  943.  
  944. //original shader of post processing
  945. technique Shader_ORIGINALPOSTPROCESS <string UIName="Vanilla";>
  946. {
  947. pass p0
  948. {
  949. //VertexShader = compile vs_3_0 VS_Quad();
  950. VertexShader=
  951. asm
  952. {
  953. // Parameters:
  954. // float4 geometryOffset;
  955. // float4 texOffset0;
  956. // float4 texOffset1;
  957. // Registers:
  958. // Name Reg Size
  959. // -------------- ----- ----
  960. // geometryOffset c0 1
  961. // texOffset0 c1 1
  962. // texOffset1 c2 1
  963. //
  964. vs_1_1
  965. def c3, 2, -2, 0, 0
  966. dcl_position v0
  967. dcl_texcoord v1
  968. mov r0.xy, c0
  969. mad oPos.xy, r0, -c3, v0
  970. add oT0.xy, v1, c1
  971. add oT1.xy, v1, c2
  972. mov oPos.zw, v0
  973. };
  974. PixelShader=
  975. asm
  976. {
  977. // Parameters:
  978. // float3 BlurScale;
  979. // float4 Cinematic;
  980. // sampler2D DestBlend;
  981. // float4 Fade;
  982. // float4 HDRParam;
  983. // sampler2D Src0;
  984. // float4 Tint;
  985. // Registers:
  986. // Name Reg Size
  987. // ------------ ----- ----
  988. // HDRParam c1 1
  989. // BlurScale c2 1
  990. // Cinematic c19 1
  991. // Tint c20 1
  992. // Fade c22 1
  993. // Src0 s0 1
  994. // DestBlend s1 1
  995. //
  996. ps_2_x
  997. def c0, 0.5, 0, 0, 0
  998. def c3, 0.298999995, 0.587000012, 0.114, 0
  999. dcl t0.xy
  1000. dcl t1.xy
  1001. dcl_2d s0
  1002. dcl_2d s1
  1003. texld r0, t1, s1
  1004. texld r1, t0, s0
  1005. max r0.w, r1.w, c1.x
  1006. rcp r0.w, r0.w
  1007. mul r1.w, r0.w, c0.x
  1008. mul r0.w, r0.w, c1.x
  1009. mul r1.xyz, r1, r1.w
  1010. max r2.xyz, r1, c0.y
  1011. mad r0.xyz, r0.w, r0, r2
  1012. dp3 r0.w, r0, c3
  1013. lrp r1.xyz, c19.x, r0, r0.w
  1014. mad r0.xyz, r0.w, c20, -r1
  1015. mad r0.xyz, c20.w, r0, r1
  1016. mad r0.xyz, c19.w, r0, -c19.y
  1017. mad r0.xyz, c19.z, r0, c19.y
  1018. lrp r1.xyz, c22.w, c22, r0
  1019. mov r1.w, c2.z
  1020. mov oC0, r1
  1021. };
  1022. ColorWriteEnable=ALPHA|RED|GREEN|BLUE;
  1023. ZEnable=FALSE;
  1024. ZWriteEnable=FALSE;
  1025. CullMode=NONE;
  1026. AlphaTestEnable=FALSE;
  1027. AlphaBlendEnable=FALSE;
  1028. SRGBWRITEENABLE=FALSE;
  1029. }
  1030. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement