Guest User

CRT-Guest-HD Aspect Ratio TEST

a guest
Jul 9th, 2025
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 48.19 KB | None | 0 0
  1. uniform float internal_res <
  2. ui_type = "drag";
  3. ui_min = 0.5;
  4. ui_max = 8.0;
  5. ui_step = 0.1;
  6. ui_label = "Internal Resolution";
  7. > = 1.0;
  8.  
  9. uniform float vigstr <
  10. ui_type = "drag";
  11. ui_min = 0.0;
  12. ui_max = 2.0;
  13. ui_step = 0.05;
  14. ui_label = "Vignette Strength";
  15. > = 0.0;
  16.  
  17. uniform float vigdef <
  18. ui_type = "drag";
  19. ui_min = 0.5;
  20. ui_max = 3.0;
  21. ui_step = 0.1;
  22. ui_label = "Vignette Size";
  23. > = 1.0;
  24.  
  25. uniform float gamma_i <
  26. ui_type = "drag";
  27. ui_min = 1.0;
  28. ui_max = 5.0;
  29. ui_step = 0.05;
  30. ui_label = "Gamma Input";
  31. > = 1.80;
  32.  
  33. uniform float gamma_o <
  34. ui_type = "drag";
  35. ui_min = 1.0;
  36. ui_max = 5.0;
  37. ui_step = 0.05;
  38. ui_label = "Gamma Out";
  39. > = 1.75;
  40.  
  41. uniform float interr <
  42. ui_type = "drag";
  43. ui_min = 0.0;
  44. ui_max = 800.0;
  45. ui_step = 25.0;
  46. ui_label = "Interlace Trigger Resolution / VGA Trigger";
  47. > = 375.0;
  48.  
  49. uniform float interm <
  50. ui_type = "drag";
  51. ui_min = 0.0;
  52. ui_max = 4.0;
  53. ui_step = 1.0;
  54. ui_label = "Interlace Mode: 0:OFF | 1-3:Normal | 4:Interpolation";
  55. > = 4.0;
  56.  
  57. uniform float iscanb <
  58. ui_type = "drag";
  59. ui_min = 0.0;
  60. ui_max = 1.0;
  61. ui_step = 0.05;
  62. ui_label = "Interlacing Scanlines Effect (Interlaced Brightness)";
  63. > = 0.2;
  64.  
  65. uniform float iscans <
  66. ui_type = "drag";
  67. ui_min = 0.0;
  68. ui_max = 1.0;
  69. ui_step = 0.05;
  70. ui_label = "Interlacing Scanlines Saturation";
  71. > = 0.25;
  72.  
  73. uniform float vga_mode <
  74. ui_type = "drag";
  75. ui_min = 0.0;
  76. ui_max = 1.0;
  77. ui_step = 1.0;
  78. ui_label = "VGA Single/Double Scan Mode";
  79. > = 0.0;
  80.  
  81. uniform float hiscan <
  82. ui_type = "drag";
  83. ui_min = 0.0;
  84. ui_max = 1.0;
  85. ui_step = 1.0;
  86. ui_label = "High Resolution Scanlines (Prepend A Scaler)";
  87. > = 0.0;
  88.  
  89. uniform float intres <
  90. ui_type = "drag";
  91. ui_min = 0.0;
  92. ui_max = 10.0;
  93. ui_step = 0.5;
  94. ui_label = "Internal Resolution Y: 0.5 | Y-Dowsample";
  95. > = 0.0;
  96.  
  97. uniform float HSHARPNESS <
  98. ui_type = "drag";
  99. ui_min = 1.0;
  100. ui_max = 8.0;
  101. ui_step = 0.05;
  102. ui_label = "Horizontal Filter Range";
  103. > = 1.0;
  104.  
  105. uniform float LIGMA_H <
  106. ui_type = "drag";
  107. ui_min = 0.1;
  108. ui_max = 7.0;
  109. ui_step = 0.025;
  110. ui_label = "Horizontal Blur Sigma";
  111. > = 0.5;
  112.  
  113. uniform float VSHARPNESS <
  114. ui_type = "drag";
  115. ui_min = 1.0;
  116. ui_max = 8.0;
  117. ui_step = 0.05;
  118. ui_label = "Vertical Filter Range";
  119. > = 1.0;
  120.  
  121. uniform float LIGMA_V <
  122. ui_type = "drag";
  123. ui_min = 0.1;
  124. ui_max = 7.0;
  125. ui_step = 0.025;
  126. ui_label = "Vertical Blur Sigma";
  127. > = 0.5;
  128.  
  129. uniform float S_SHARP <
  130. ui_type = "drag";
  131. ui_min = 0.0;
  132. ui_max = 2.0;
  133. ui_step = 0.1;
  134. ui_label = "Substractive Sharpness";
  135. > = 1.0;
  136.  
  137. uniform float SHARP <
  138. ui_type = "drag";
  139. ui_min = 0.0;
  140. ui_max = 2.0;
  141. ui_step = 0.1;
  142. ui_label = "Sharpness Definition";
  143. > = 1.2;
  144.  
  145. uniform float MAXS <
  146. ui_type = "drag";
  147. ui_min = 0.0;
  148. ui_max = 0.3;
  149. ui_step = 0.01;
  150. ui_label = "Maximum Sharpness";
  151. > = 0.15;
  152.  
  153. uniform float SSRNG <
  154. ui_type = "drag";
  155. ui_min = 0.0;
  156. ui_max = 4.0;
  157. ui_step = 0.1;
  158. ui_label = "Substractive Sharpness Ringing";
  159. > = 0.2;
  160.  
  161. uniform float m_glow <
  162. ui_type = "drag";
  163. ui_min = 0.0;
  164. ui_max = 2.0;
  165. ui_step = 1.0;
  166. ui_label = "Ordinary Glow | Magic Glow";
  167. > = 0.0;
  168.  
  169. uniform float m_glow_cutoff <
  170. ui_type = "drag";
  171. ui_min = 0.0;
  172. ui_max = 0.4;
  173. ui_step = 0.01;
  174. ui_label = "Magic Glow Cutoff";
  175. > = 0.12;
  176.  
  177. uniform float m_glow_low <
  178. ui_type = "drag";
  179. ui_min = 0.0;
  180. ui_max = 7.0;
  181. ui_step = 0.05;
  182. ui_label = "Magic Glow Low Strength";
  183. > = 0.35;
  184.  
  185. uniform float m_glow_high <
  186. ui_type = "drag";
  187. ui_min = 0.0;
  188. ui_max = 7.0;
  189. ui_step = 0.1;
  190. ui_label = "Magic Glow High Strength";
  191. > = 5.0;
  192.  
  193. uniform float m_glow_dist <
  194. ui_type = "drag";
  195. ui_min = 0.2;
  196. ui_max = 4.0;
  197. ui_step = 0.05;
  198. ui_label = "Magic Glow Distribution";
  199. > = 1.0;
  200.  
  201. uniform float m_glow_mask <
  202. ui_type = "drag";
  203. ui_min = 0.0;
  204. ui_max = 2.0;
  205. ui_step = 0.025;
  206. ui_label = "Magic Glow Mask Strength";
  207. > = 1.0;
  208.  
  209. uniform float FINE_GAUSS <
  210. ui_type = "drag";
  211. ui_min = -1.0;
  212. ui_max = 5.0;
  213. ui_step = 1.0;
  214. ui_label = "Fine (Magic) Glow Sampling";
  215. > = 1.0;
  216.  
  217. uniform float SIZEH <
  218. ui_type = "drag";
  219. ui_min = 1.0;
  220. ui_max = 50.0;
  221. ui_step = 1.0;
  222. ui_label = "Horizontal Glow Radius";
  223. > = 6.0;
  224.  
  225. uniform float SIGMA_H <
  226. ui_type = "drag";
  227. ui_min = 0.2;
  228. ui_max = 15.0;
  229. ui_step = 0.05;
  230. ui_label = "Horizontal Glow Sigma";
  231. > = 1.2;
  232.  
  233. uniform float SIZEV <
  234. ui_type = "drag";
  235. ui_min = 1.0;
  236. ui_max = 50.0;
  237. ui_step = 1.0;
  238. ui_label = "Vertical Glow Radius";
  239. > = 6.0;
  240.  
  241. uniform float SIGMA_V <
  242. ui_type = "drag";
  243. ui_min = 0.2;
  244. ui_max = 15.0;
  245. ui_step = 0.05;
  246. ui_label = "Vertical Glow Sigma";
  247. > = 1.2;
  248.  
  249. uniform float FINE_BLOOM <
  250. ui_type = "drag";
  251. ui_min = -1.0;
  252. ui_max = 5.0;
  253. ui_step = 1.0;
  254. ui_label = "Fine Bloom/Halation Sampling";
  255. > = 1.0;
  256.  
  257. uniform float SIZEX <
  258. ui_type = "drag";
  259. ui_min = 1.0;
  260. ui_max = 50.0;
  261. ui_step = 1.0;
  262. ui_label = "Horizontal Bloom/Halation Radius";
  263. > = 3.0;
  264.  
  265. uniform float SIGMA_X <
  266. ui_type = "drag";
  267. ui_min = 0.25;
  268. ui_max = 15.0;
  269. ui_step = 0.025;
  270. ui_label = "Horizontal Bloom/Halation Sigma";
  271. > = 0.75;
  272.  
  273. uniform float SIZEY <
  274. ui_type = "drag";
  275. ui_min = 1.0;
  276. ui_max = 50.0;
  277. ui_step = 1.0;
  278. ui_label = "Vertical Bloom/Halation Radius";
  279. > = 3.0;
  280.  
  281. uniform float SIGMA_Y <
  282. ui_type = "drag";
  283. ui_min = 0.25;
  284. ui_max = 15.0;
  285. ui_step = 0.025;
  286. ui_label = "Vertical Bloom/Halation Sigma";
  287. > = 0.60;
  288.  
  289. uniform float glow <
  290. ui_type = "drag";
  291. ui_min = -2.0;
  292. ui_max = 2.0;
  293. ui_step = 0.01;
  294. ui_label = "(Magic) Glow Strength";
  295. > = 0.08;
  296.  
  297. uniform float bloom <
  298. ui_type = "drag";
  299. ui_min = -2.0;
  300. ui_max = 2.0;
  301. ui_step = 0.05;
  302. ui_label = "Bloom Strength";
  303. > = 0.0;
  304.  
  305. uniform float b_mask <
  306. ui_type = "drag";
  307. ui_min = -1.0;
  308. ui_max = 1.0;
  309. ui_step = 0.025;
  310. ui_label = "Bloom Mask Strength";
  311. > = 0.0;
  312.  
  313. uniform float mask_bloom <
  314. ui_type = "drag";
  315. ui_min = -2.0;
  316. ui_max = 2.0;
  317. ui_step = 0.05;
  318. ui_label = "Mask Bloom";
  319. > = 0.0;
  320.  
  321. uniform float bloom_dist <
  322. ui_type = "drag";
  323. ui_min = -2.0;
  324. ui_max = 3.0;
  325. ui_step = 0.05;
  326. ui_label = "Bloom Distribution";
  327. > = 0.0;
  328.  
  329. uniform float halation <
  330. ui_type = "drag";
  331. ui_min = -2.0;
  332. ui_max = 2.0;
  333. ui_step = 0.025;
  334. ui_label = "Halation Strength";
  335. > = 0.0;
  336.  
  337. uniform float h_mask <
  338. ui_type = "drag";
  339. ui_min = -1.0;
  340. ui_max = 1.0;
  341. ui_step = 0.025;
  342. ui_label = "Halation Mask Strength";
  343. > = 0.5;
  344.  
  345. uniform float gamma_c <
  346. ui_type = "drag";
  347. ui_min = 0.5;
  348. ui_max = 2.0;
  349. ui_step = 0.025;
  350. ui_label = "Gamma Correct";
  351. > = 1.0;
  352.  
  353. uniform float gamma_d <
  354. ui_type = "drag";
  355. ui_min = 1.0;
  356. ui_max = 2.0;
  357. ui_step = 0.025;
  358. ui_label = "Complementary Gamma Correct";
  359. > = 1.0;
  360.  
  361. uniform float brightboost1 <
  362. ui_type = "drag";
  363. ui_min = 0.25;
  364. ui_max = 10.0;
  365. ui_step = 0.05;
  366. ui_label = "Bright Boost Dark Pixels";
  367. > = 1.4;
  368.  
  369. uniform float brightboost2 <
  370. ui_type = "drag";
  371. ui_min = 0.25;
  372. ui_max = 3.0;
  373. ui_step = 0.025;
  374. ui_label = "Bright Boost Bright Pixels";
  375. > = 1.1;
  376.  
  377. uniform float clp <
  378. ui_type = "drag";
  379. ui_min = -1.0;
  380. ui_max = 1.0;
  381. ui_step = 0.05;
  382. ui_label = "Clip Saturated Color Beams";
  383. > = 0.0;
  384.  
  385. uniform float gsl <
  386. ui_type = "drag";
  387. ui_min = -1.0;
  388. ui_max = 2.0;
  389. ui_step = 1.0;
  390. ui_label = "Scanlines Type";
  391. > = 0.0;
  392.  
  393. uniform float scanline1 <
  394. ui_type = "drag";
  395. ui_min = -20.0;
  396. ui_max = 40.0;
  397. ui_step = 0.5;
  398. ui_label = "Scanlines Beam Shape Center";
  399. > = 6.0;
  400.  
  401. uniform float scanline2 <
  402. ui_type = "drag";
  403. ui_min = 0.0;
  404. ui_max = 70.0;
  405. ui_step = 1.0;
  406. ui_label = "Scanlines Beam Shape Edges";
  407. > = 8.0;
  408.  
  409. uniform float beam_min <
  410. ui_type = "drag";
  411. ui_min = 0.25;
  412. ui_max = 10.0;
  413. ui_step = 0.05;
  414. ui_label = "Scanlines Shape Dark Pixels";
  415. > = 1.2;
  416.  
  417. uniform float beam_max <
  418. ui_type = "drag";
  419. ui_min = 0.2;
  420. ui_max = 3.5;
  421. ui_step = 0.025;
  422. ui_label = "Scanlines Shape Bright Pixels";
  423. > = 1.0;
  424.  
  425. uniform float tds <
  426. ui_type = "drag";
  427. ui_min = 0.0;
  428. ui_max = 1.0;
  429. ui_step = 1.0;
  430. ui_label = "Thinner Dark Scanlines";
  431. > = 0.0;
  432.  
  433. uniform float beam_size <
  434. ui_type = "drag";
  435. ui_min = 0.0;
  436. ui_max = 1.0;
  437. ui_step = 0.05;
  438. ui_label = "Increased Bright Scanlines Beam";
  439. > = 0.6;
  440.  
  441. uniform float scans <
  442. ui_type = "drag";
  443. ui_min = 0.0;
  444. ui_max = 6.0;
  445. ui_step = 0.1;
  446. ui_label = "Scanlines Saturation / Mask Falloff";
  447. > = 0.5;
  448.  
  449. uniform float scan_falloff <
  450. ui_type = "drag";
  451. ui_min = 0.1;
  452. ui_max = 2.0;
  453. ui_step = 0.025;
  454. ui_label = "Scanlines Falloff";
  455. > = 1.0;
  456.  
  457. uniform float spike <
  458. ui_type = "drag";
  459. ui_min = 0.0;
  460. ui_max = 2.0;
  461. ui_step = 0.1;
  462. ui_label = "Scanlines Spike Removal";
  463. > = 1.0;
  464.  
  465. uniform float scangamma <
  466. ui_type = "drag";
  467. ui_min = 0.5;
  468. ui_max = 5.0;
  469. ui_step = 0.05;
  470. ui_label = "Scanlines Gamma";
  471. > = 2.4;
  472.  
  473. uniform float rolling_scan <
  474. ui_type = "drag";
  475. ui_min = -1.0;
  476. ui_max = 1.0;
  477. ui_step = 0.01;
  478. ui_label = "Rolling Scanlines";
  479. > = 0.0;
  480.  
  481. uniform float no_scanlines <
  482. ui_type = "drag";
  483. ui_min = 0.0;
  484. ui_max = 1.5;
  485. ui_step = 0.05;
  486. ui_label = "No-Scanlines Mode";
  487. > = 0.0;
  488.  
  489. uniform float IOS <
  490. ui_type = "drag";
  491. ui_min = 0.0;
  492. ui_max = 4.0;
  493. ui_step = 1.0;
  494. ui_label = "Integer Scaling: Odd:Y | Even:X+Y";
  495. > = 0.0;
  496.  
  497. uniform float csize <
  498. ui_type = "drag";
  499. ui_min = 0.0;
  500. ui_max = 0.25;
  501. ui_step = 0.005;
  502. ui_label = "Corner Size";
  503. > = 0.0;
  504.  
  505. uniform float bsize <
  506. ui_type = "drag";
  507. ui_min = 0.0;
  508. ui_max = 3.0;
  509. ui_step = 0.01;
  510. ui_label = "Border Size";
  511. > = 0.01;
  512.  
  513. uniform float sborder <
  514. ui_type = "drag";
  515. ui_min = 0.25;
  516. ui_max = 2.0;
  517. ui_step = 0.05;
  518. ui_label = "Border Intensity";
  519. > = 0.75;
  520.  
  521. uniform float barspeed <
  522. ui_type = "drag";
  523. ui_min = 5.0;
  524. ui_max = 200.0;
  525. ui_step = 1.0;
  526. ui_label = "Hum Bar Speed";
  527. > = 50.0;
  528.  
  529. uniform float barintensity <
  530. ui_type = "drag";
  531. ui_min = -1.0;
  532. ui_max = 1.0;
  533. ui_step = 0.01;
  534. ui_label = "Hum Bar Intensity";
  535. > = 0.0;
  536.  
  537. uniform float bardir <
  538. ui_type = "drag";
  539. ui_min = 0.0;
  540. ui_max = 1.0;
  541. ui_step = 1.0;
  542. ui_label = "Hum Bar Direction";
  543. > = 0.0;
  544.  
  545. uniform float warpx <
  546. ui_type = "drag";
  547. ui_min = 0.0;
  548. ui_max = 0.25;
  549. ui_step = 0.01;
  550. ui_label = "Curvature X (Default 0.03)";
  551. > = 0.0;
  552.  
  553. uniform float warpy <
  554. ui_type = "drag";
  555. ui_min = 0.0;
  556. ui_max = 0.25;
  557. ui_step = 0.01;
  558. ui_label = "Curvature Y (Default 0.04)";
  559. > = 0.0;
  560.  
  561. uniform float c_shape <
  562. ui_type = "drag";
  563. ui_min = 0.05;
  564. ui_max = 0.6;
  565. ui_step = 0.05;
  566. ui_label = "Curvature Shape";
  567. > = 0.25;
  568.  
  569. uniform float overscanx <
  570. ui_type = "drag";
  571. ui_min = -200.0;
  572. ui_max = 200.0;
  573. ui_step = 1.0;
  574. ui_label = "Overscan X Original Pixels";
  575. > = 0.0;
  576.  
  577. uniform float overscany <
  578. ui_type = "drag";
  579. ui_min = -200.0;
  580. ui_max = 200.0;
  581. ui_step = 1.0;
  582. ui_label = "Overscan Y Original Pixels";
  583. > = 0.0;
  584.  
  585. uniform float shadow_msk <
  586. ui_type = "drag";
  587. ui_min = 0.0;
  588. ui_max = 14.0;
  589. ui_step = 1.0;
  590. ui_label = "CRT Mask: 1:CGWG | 2-5:Lottes | 6-14:Trinitron";
  591. > = 1.0;
  592.  
  593. uniform float maskstr <
  594. ui_type = "drag";
  595. ui_min = -0.5;
  596. ui_max = 1.0;
  597. ui_step = 0.025;
  598. ui_label = "Mask Strength (1, 6-14)";
  599. > = 0.3;
  600.  
  601. uniform float mcut <
  602. ui_type = "drag";
  603. ui_min = 0.0;
  604. ui_max = 2.0;
  605. ui_step = 0.05;
  606. ui_label = "Mask 6-14 Low Strength";
  607. > = 1.1;
  608.  
  609. uniform float maskboost <
  610. ui_type = "drag";
  611. ui_min = 1.0;
  612. ui_max = 3.0;
  613. ui_step = 0.05;
  614. ui_label = "CRT Mask Boost";
  615. > = 1.0;
  616.  
  617. uniform float masksize <
  618. ui_type = "drag";
  619. ui_min = 1.0;
  620. ui_max = 4.0;
  621. ui_step = 1.0;
  622. ui_label = "CRT Mask Size";
  623. > = 1.0;
  624.  
  625. uniform float mask_zoom <
  626. ui_type = "drag";
  627. ui_min = -10.0;
  628. ui_max = 6.0;
  629. ui_step = 1.0;
  630. ui_label = "CRT Mask Zoom (+ Mask Width)";
  631. > = 0.0;
  632.  
  633. uniform float zoom_mask <
  634. ui_type = "drag";
  635. ui_min = 0.0;
  636. ui_max = 1.0;
  637. ui_step = 0.05;
  638. ui_label = "CRT Mask Zoom Sharpen";
  639. > = 0.0;
  640.  
  641. uniform float mshift <
  642. ui_type = "drag";
  643. ui_min = 0.0;
  644. ui_max = 1.0;
  645. ui_step = 0.5;
  646. ui_label = "(Transform to) Shadow Mask";
  647. > = 0.0;
  648.  
  649. uniform float mask_layout <
  650. ui_type = "drag";
  651. ui_min = 0.0;
  652. ui_max = 1.0;
  653. ui_step = 1.0;
  654. ui_label = "Mask Layout: RGB or BGR (Check LCD Panel)";
  655. > = 0.0;
  656.  
  657. uniform float mask_drk <
  658. ui_type = "drag";
  659. ui_min = 0.0;
  660. ui_max = 2.0;
  661. ui_step = 0.05;
  662. ui_label = "Lottes Mask Dark";
  663. > = 0.5;
  664.  
  665. uniform float mask_lgt <
  666. ui_type = "drag";
  667. ui_min = 0.0;
  668. ui_max = 2.0;
  669. ui_step = 0.05;
  670. ui_label = "Lottes Mask Bright";
  671. > = 1.5;
  672.  
  673. uniform float mask_gamma <
  674. ui_type = "drag";
  675. ui_min = 1.0;
  676. ui_max = 5.0;
  677. ui_step = 0.05;
  678. ui_label = "Mask Gamma";
  679. > = 2.4;
  680.  
  681. uniform float slotmask1 <
  682. ui_type = "drag";
  683. ui_min = 0.0;
  684. ui_max = 1.0;
  685. ui_step = 0.05;
  686. ui_label = "Slot Mask Strength Bright Pixels";
  687. > = 0.0;
  688.  
  689. uniform float slotmask2 <
  690. ui_type = "drag";
  691. ui_min = 0.0;
  692. ui_max = 1.0;
  693. ui_step = 0.05;
  694. ui_label = "Slot Mask Strength Dark Pixels";
  695. > = 0.0;
  696.  
  697. uniform float slotwidth <
  698. ui_type = "drag";
  699. ui_min = 0.0;
  700. ui_max = 16.0;
  701. ui_step = 1.0;
  702. ui_label = "Slot Mask Width (0:Auto)";
  703. > = 0.0;
  704.  
  705. uniform float double_slot <
  706. ui_type = "drag";
  707. ui_min = 1.0;
  708. ui_max = 4.0;
  709. ui_step = 1.0;
  710. ui_label = "Slot Mask Height: 2x1 or 4x1";
  711. > = 2.0;
  712.  
  713. uniform float slotms <
  714. ui_type = "drag";
  715. ui_min = 1.0;
  716. ui_max = 4.0;
  717. ui_step = 1.0;
  718. ui_label = "Slot Mask Thickness";
  719. > = 1.0;
  720.  
  721. uniform float smoothmask <
  722. ui_type = "drag";
  723. ui_min = 0.0;
  724. ui_max = 2.0;
  725. ui_step = 0.25;
  726. ui_label = "Smooth Masks In Bright Scanlines";
  727. > = 0.0;
  728.  
  729. uniform float smask_mit <
  730. ui_type = "drag";
  731. ui_min = 0.0;
  732. ui_max = 1.0;
  733. ui_step = 0.05;
  734. ui_label = "Mitigate Slot Mask Interaction";
  735. > = 0.0;
  736.  
  737. uniform float bmask <
  738. ui_type = "drag";
  739. ui_min = 0.0;
  740. ui_max = 0.25;
  741. ui_step = 0.01;
  742. ui_label = "Base (Black) Mask Strength";
  743. > = 0.0;
  744.  
  745. uniform float mclip <
  746. ui_type = "drag";
  747. ui_min = 0.0;
  748. ui_max = 1.0;
  749. ui_step = 0.025;
  750. ui_label = "Preserve Mask Strength";
  751. > = 0.0;
  752.  
  753. uniform float pr_scan <
  754. ui_type = "drag";
  755. ui_min = 0.0;
  756. ui_max = 1.0;
  757. ui_step = 0.025;
  758. ui_label = "Preserve Scanlines Strength";
  759. > = 0.1;
  760.  
  761. uniform float maskmid <
  762. ui_type = "drag";
  763. ui_min = 0.0;
  764. ui_max = 1.0;
  765. ui_step = 0.05;
  766. ui_label = "Mitigate Mask on Mid-Colors";
  767. > = 0.0;
  768.  
  769. uniform float edgemask <
  770. ui_type = "drag";
  771. ui_min = 0.0;
  772. ui_max = 1.0;
  773. ui_step = 0.1;
  774. ui_label = "Mitigate Mask on Edges";
  775. > = 0.0;
  776.  
  777. uniform float dctypex <
  778. ui_type = "drag";
  779. ui_min = 0.0;
  780. ui_max = 0.75;
  781. ui_step = 0.05;
  782. ui_label = "Deconvergence Type X: 0:Static | Other:Dynamic";
  783. > = 0.0;
  784.  
  785. uniform float dctypey <
  786. ui_type = "drag";
  787. ui_min = 0.0;
  788. ui_max = 0.75;
  789. ui_step = 0.05;
  790. ui_label = "Deconvergence Type Y: 0:Static | Other:Dynamic";
  791. > = 0.0;
  792.  
  793. uniform float deconrx <
  794. ui_type = "drag";
  795. ui_min = -15.0;
  796. ui_max = 15.0;
  797. ui_step = 0.25;
  798. ui_label = "Horizontal Deconvergence 'R' Range";
  799. > = 0.0;
  800.  
  801. uniform float decongx <
  802. ui_type = "drag";
  803. ui_min = -15.0;
  804. ui_max = 15.0;
  805. ui_step = 0.25;
  806. ui_label = "Horizontal Deconvergence 'G' Range";
  807. > = 0.0;
  808.  
  809. uniform float deconbx <
  810. ui_type = "drag";
  811. ui_min = -15.0;
  812. ui_max = 15.0;
  813. ui_step = 0.25;
  814. ui_label = "Horizontal Deconvergence 'B' Range";
  815. > = 0.0;
  816.  
  817. uniform float deconry <
  818. ui_type = "drag";
  819. ui_min = -15.0;
  820. ui_max = 15.0;
  821. ui_step = 0.25;
  822. ui_label = "Vertical Deconvergence 'R' Range";
  823. > = 0.0;
  824.  
  825. uniform float decongy <
  826. ui_type = "drag";
  827. ui_min = -15.0;
  828. ui_max = 15.0;
  829. ui_step = 0.25;
  830. ui_label = "Vertical Deconvergence 'G' Range";
  831. > = 0.0;
  832.  
  833. uniform float deconby <
  834. ui_type = "drag";
  835. ui_min = -15.0;
  836. ui_max = 15.0;
  837. ui_step = 0.25;
  838. ui_label = "Vertical Deconvergence 'B' Range";
  839. > = 0.0;
  840.  
  841. uniform float decons <
  842. ui_type = "drag";
  843. ui_min = 0.0;
  844. ui_max = 3.0;
  845. ui_step = 0.1;
  846. ui_label = "Deconvergence Strength";
  847. > = 1.0;
  848.  
  849. uniform float addnoised <
  850. ui_type = "drag";
  851. ui_min = -1.0;
  852. ui_max = 1.0;
  853. ui_step = 0.02;
  854. ui_label = "Add Noise";
  855. > = 0.0;
  856.  
  857. uniform float noiseresd <
  858. ui_type = "drag";
  859. ui_min = 1.0;
  860. ui_max = 10.0;
  861. ui_step = 1.0;
  862. ui_label = "Noise Resolution";
  863. > = 2.0;
  864.  
  865. uniform float noisetype <
  866. ui_type = "drag";
  867. ui_min = 0.0;
  868. ui_max = 1.0;
  869. ui_step = 1.0;
  870. ui_label = "Noise Type: Colored | Luma";
  871. > = 0.0;
  872.  
  873. uniform float post_br <
  874. ui_type = "drag";
  875. ui_min = 0.25;
  876. ui_max = 5.0;
  877. ui_step = 0.01;
  878. ui_label = "Post Brightness";
  879. > = 1.0;
  880.  
  881. #include "ReShade.fxh"
  882.  
  883. #define TexSize float2(Resolution_X,Resolution_Y)
  884. #define IptSize float2(800.00000000,600.00000000)
  885. #define BoxSize float2(AspectSize_X,AspectSize_Y)
  886. #define OptSize float4(BUFFER_SCREEN_SIZE,1.0/BUFFER_SCREEN_SIZE)
  887. #define OrgSize float4(TexSize,1.0/TexSize)
  888. #define SrcSize float4(IptSize,1.0/IptSize)
  889. #define NewSize float4(BoxSize,1.0/BoxSize)
  890. #define fuxcoord (texcoord*1.00001)
  891. #define scans 1.5*scans
  892. #define eps 1e-10
  893. #define fracoord (fuxcoord*NewSize.xy)
  894. #define texCD(c,d) tex2Dlod(c,float4(d,0,0))
  895. #define internal_rez internal_res*(1.0/(1+hiscan))
  896.  
  897. #ifndef Resolution_X
  898. #define Resolution_X 320
  899. #endif
  900.  
  901. #ifndef Resolution_Y
  902. #define Resolution_Y 240
  903. #endif
  904.  
  905. #ifndef AspectSize_X
  906. #define AspectSize_X BUFFER_SCREEN_SIZE.x
  907. #endif
  908.  
  909. #ifndef AspectSize_Y
  910. #define AspectSize_Y BUFFER_SCREEN_SIZE.y
  911. #endif
  912.  
  913. #define CGHD_S00 ReShade::BackBuffer
  914.  
  915. texture CGHD_T01{Width=Resolution_X;Height=Resolution_Y;Format=RGBA16F;};
  916. sampler CGHD_S01{Texture=CGHD_T01;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=POINT ;MinFilter=POINT ;MipFilter=POINT ;};
  917.  
  918. texture CGHD_T02{Width=Resolution_X;Height=Resolution_Y;Format=RGBA16F;};
  919. sampler CGHD_S02{Texture=CGHD_T02;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  920.  
  921. texture CGHD_T03{Width=AspectSize_X;Height=Resolution_Y;Format=RGBA16F;};
  922. sampler CGHD_S03{Texture=CGHD_T03;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  923.  
  924. texture CGHD_T04{Width=800.00000000;Height=Resolution_Y;Format=RGBA16F;};
  925. sampler CGHD_S04{Texture=CGHD_T04;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  926.  
  927. texture CGHD_T05{Width=800.00000000;Height=600.00000000;Format=RGBA16F;};
  928. sampler CGHD_S05{Texture=CGHD_T05;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  929.  
  930. texture CGHD_T06{Width=800.00000000;Height=600.00000000;Format=RGBA16F;};
  931. sampler CGHD_S06{Texture=CGHD_T06;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  932.  
  933. texture CGHD_T07{Width=800.00000000;Height=600.00000000;Format=RGBA16F;};
  934. sampler CGHD_S07{Texture=CGHD_T07;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  935.  
  936. texture CGHD_T08{Width=AspectSize_X;Height=AspectSize_Y;Format=RGBA16F;};
  937. sampler CGHD_S08{Texture=CGHD_T08;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  938.  
  939. texture CGHD_T09{Width=AspectSize_X;Height=AspectSize_Y;Format=RGBA16F;};
  940. sampler CGHD_S09{Texture=CGHD_T09;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
  941.  
  942. uniform int framecount<source="framecount";>;
  943.  
  944. float vignette(float2 pos)
  945. {
  946. float2 b=vigdef*float2(1.0,OrgSize.x/OrgSize.y)*0.125;
  947. pos=clamp(pos,0.0,1.0);
  948. pos=abs(2.0*(pos-0.5));
  949. float2 res=lerp(0.0.xx,1.0.xx,smoothstep(1.0.xx,1.0.xx-b,sqrt(pos)));
  950. res=pow(res,0.70.xx);
  951. return max(lerp(1.0,sqrt(res.x*res.y),vigstr),0.0);
  952. }
  953.  
  954. float3 plant(float3 tar,float r)
  955. {
  956. float t=max(max(tar.r,tar.g),tar.b)+0.00001;
  957. return tar*r/t;
  958. }
  959.  
  960. float gauss_h(float x)
  961. {
  962. float sigma=1.0/(2.0*SIGMA_H*SIGMA_H);
  963. return exp(-x*x*sigma);
  964. }
  965.  
  966. float gauss_v(float x)
  967. {
  968. float sigma=1.0/(2.0*SIGMA_V*SIGMA_V);
  969. return exp(-x*x*sigma);
  970. }
  971.  
  972. float bloom_h(float x)
  973. {
  974. float sigma=1.0/(2.0*SIGMA_X*SIGMA_X);
  975. return exp(-x*x*sigma);
  976. }
  977.  
  978. float bloom_v(float x)
  979. {
  980. float sigma=1.0/(2.0*SIGMA_Y*SIGMA_Y);
  981. return exp(-x*x*sigma);
  982. }
  983.  
  984. float crthd_h(float x)
  985. {
  986. float sigma=1.0/(2.0*LIGMA_H*LIGMA_H*internal_res*internal_res);
  987. return exp(-x*x*sigma);
  988. }
  989.  
  990. float crthd_v(float x)
  991. {
  992. float sigma=1.0/(2.0*LIGMA_V*LIGMA_V*internal_rez*internal_rez);
  993. return exp(-x*x*sigma);
  994. }
  995.  
  996. float mod(float x,float y)
  997. {
  998. return x-y* floor(x/y);
  999. }
  1000.  
  1001. float st0(float x)
  1002. {
  1003. return exp2(-10.0*x*x);
  1004. }
  1005.  
  1006. float3 sw0(float x,float color,float scanline,float3 c)
  1007. {
  1008. float3 xe=lerp(1.0.xxx+scans,1.0.xxx,c);
  1009. float tmp=lerp(beam_min,beam_max,color);
  1010. float ex=x*tmp;
  1011. ex=(gsl>-0.5)?ex*ex:lerp(ex*ex,ex*ex*ex,0.4);
  1012. return exp2(-scanline*ex*xe);
  1013. }
  1014.  
  1015. float3 sw1(float x,float color,float scanline,float3 c)
  1016. {
  1017. float3 xe=lerp(1.0.xxx+scans,1.0.xxx,c);
  1018. x=lerp(x,beam_min*x,max(x-0.4*color,0.0));
  1019. float tmp=lerp(1.2*beam_min,beam_max,color);
  1020. float ex=x*tmp;
  1021. return exp2(-scanline*ex*ex*xe);
  1022. }
  1023.  
  1024. float3 sw2(float x,float color,float scanline,float3 c)
  1025. {
  1026. float3 xe=lerp(1.0.xxx+scans,1.0.xxx,c);
  1027. float tmp=lerp((2.5-0.5*color)*beam_min,beam_max,color);
  1028. tmp=lerp(beam_max,tmp,pow(x,color+0.3));
  1029. float ex=x*tmp;
  1030. return exp2(-scanline*ex*ex*xe);
  1031. }
  1032.  
  1033. float2 overscan(float2 pos,float dx,float dy)
  1034. {
  1035. pos=pos*2.0-1.0;
  1036. pos*=float2(dx,dy);
  1037. return pos*0.5+0.5;
  1038. }
  1039.  
  1040. float2 warp(float2 pos)
  1041. {
  1042. pos=pos*2.0-1.0;
  1043. pos=lerp(pos,float2(pos.x*rsqrt(1.0-c_shape*pos.y*pos.y),pos.y*rsqrt(1.0-c_shape*pos.x*pos.x)),float2(warpx,warpy)/c_shape);
  1044. return pos*0.5+0.5;
  1045. }
  1046.  
  1047. float3 gc1(float3 c)
  1048. {
  1049. float mc=max(max(c.r,c.g),c.b);
  1050. float mg=pow(mc,1.0/gamma_c);
  1051. return c*mg/(mc+eps);
  1052. }
  1053.  
  1054. float3 v_resample(float2 tex0,float4 size)
  1055. {
  1056. float f= frac(size.y*tex0.y);
  1057. f=0.5-f;
  1058. float2 tex=tex0;
  1059. tex.y=floor(size.y*tex.y)*size.w+0.5*size.w;
  1060. float3 color=0.0.xxx;
  1061. float2 dy=float2(0.0,size.w);
  1062. float w=0.0;
  1063. float wsum=0.0;
  1064. float3 pixel;
  1065. float vsharpness=max(VSHARPNESS *internal_rez,0.6);
  1066. float3 cmax=0.0.xxx;
  1067. float3 cmin=1.0.xxx;
  1068. float sharp= crthd_v(vsharpness)*S_SHARP;
  1069. float maxsharp=MAXS;
  1070. float FPR=vsharpness;
  1071. float FPRi=1.0/vsharpness;
  1072. float fpx=0.0;
  1073. float LOOPSIZE=ceil(2.0*FPR);
  1074. float n=-LOOPSIZE;
  1075. do
  1076. {
  1077. pixel=texCD(CGHD_S03,tex+n*dy).rgb;
  1078. w=crthd_v(n+f)-sharp;
  1079. fpx=(abs(n+f)-FPR)*FPRi;
  1080. if(w<0.0)w=max(w,lerp(-maxsharp,0.0,pow(clamp(fpx,0.0,1.0),SHARP))); else
  1081. {
  1082. cmax=max(cmax,pixel);cmin=min(cmin,pixel);
  1083. }
  1084. color=color+w*pixel;
  1085. wsum=wsum+w;
  1086. n=n+1.0;
  1087. }
  1088. while(n<=LOOPSIZE);
  1089. color=color/wsum;
  1090. color=clamp(lerp( clamp (color,cmin,cmax),color,SSRNG),0.0,1.0);
  1091. return color;
  1092. }
  1093.  
  1094. float3 crt_mask(float2 pos,float mx,float mb)
  1095. {
  1096. float3 mask=mask_drk;
  1097. float3 one=1.0;
  1098. if(shadow_msk== 1.0)
  1099. {
  1100. float mc=1.0-max(maskstr,0.0);
  1101. pos.x=frac(pos.x*0.5);
  1102. if(pos.x<0.49)
  1103. {
  1104. mask.r=1.0;mask.g= mc;mask.b=1.0;
  1105. }else
  1106. {
  1107. mask.r= mc;mask.g=1.0;mask.b= mc;
  1108. }
  1109. }else
  1110. if(shadow_msk== 2.0)
  1111. {
  1112. float lane=mask_lgt;
  1113. float odd=0.0;
  1114. if(frac(pos.x/6.0)<0.49)odd=1.0;
  1115. if(frac((pos.y+odd)/2.0)<0.49)lane=mask_drk;
  1116. pos.x=floor(mod(pos.x,3.0));
  1117. if(pos.x<0.5)mask.r=mask_lgt;else
  1118. if(pos.x<1.5)mask.g=mask_lgt;else
  1119. mask.b= mask_lgt;
  1120. mask*=lane;
  1121. }else
  1122. if(shadow_msk== 3.0)
  1123. {
  1124. pos.x=floor(mod(pos.x,3.0));
  1125. if(pos.x<0.5)mask.r=mask_lgt;else
  1126. if(pos.x<1.5)mask.g=mask_lgt;else
  1127. mask.b= mask_lgt;
  1128. }else
  1129. if(shadow_msk== 4.0)
  1130. {
  1131. pos.x+=pos.y*3.0;
  1132. pos.x=frac(pos.x/6.0);
  1133. if(pos.x<0.3)mask.r=mask_lgt;else
  1134. if(pos.x<0.6)mask.g=mask_lgt;else
  1135. mask.b= mask_lgt;
  1136. }else
  1137. if(shadow_msk== 5.0)
  1138. {
  1139. pos.xy=floor(pos.xy*float2(1.0,0.5));
  1140. pos.x+=pos.y*3.0;
  1141. pos.x=frac(pos.x/6.0);
  1142. if(pos.x<0.3)mask.r=mask_lgt;else
  1143. if(pos.x<0.6)mask.g=mask_lgt;else
  1144. mask.b= mask_lgt;
  1145. }else
  1146. if(shadow_msk== 6.0)
  1147. {
  1148. mask=0.0;
  1149. pos.x=frac(pos.x/2.0);
  1150. if(pos.x<0.49)
  1151. {
  1152. mask.r=1.0;
  1153. mask.b=1.0;
  1154. }else
  1155. mask.g=1.0;
  1156. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1157. }else
  1158. if(shadow_msk== 7.0)
  1159. {
  1160. mask=0.0;
  1161. pos.x=floor(mod(pos.x,3.0));
  1162. if(pos.x<0.5)mask.r=1.0;else
  1163. if(pos.x<1.5)mask.g=1.0;else
  1164. mask.b=1.0;
  1165. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1166. }else
  1167. if(shadow_msk== 8.0)
  1168. {
  1169. mask=0.0;
  1170. pos.x=frac(pos.x/2.0);
  1171. if(pos.x<0.49)
  1172. {
  1173. mask=0.0.xxx;
  1174. }else
  1175. mask=1.0.xxx;
  1176. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1177. }else
  1178. if(shadow_msk== 9.0)
  1179. {
  1180. mask=0.0;
  1181. pos.x=frac(pos.x/3.0);
  1182. if(pos.x<0.3)mask=0.0.xxx;else
  1183. if(pos.x<0.6)mask=1.0.xxx;else
  1184. mask=1.0.xxx;
  1185. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1186. }else
  1187. if(shadow_msk==10.0)
  1188. {
  1189. mask=0.0;
  1190. pos.x=frac(pos.x/3.0);
  1191. if(pos.x<0.3)mask =0.0.xxx;else
  1192. if(pos.x<0.6)mask.rb=1.0.xx ;else
  1193. mask.g=1.0;
  1194. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1195. }else
  1196. if(shadow_msk==11.0)
  1197. {
  1198. mask=0.0;
  1199. pos.x=frac(pos.x*0.25);
  1200. if(pos.x<0.2)mask =0.0.xxx;else
  1201. if(pos.x<0.4)mask.r=1.0 ;else
  1202. if(pos.x<0.7)mask.g=1.0 ;else
  1203. mask.b=1.0;
  1204. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1205. }else
  1206. if(shadow_msk==12.0)
  1207. {
  1208. mask=0.0;
  1209. pos.x=frac(pos.x*0.25);
  1210. if(pos.x<0.2)mask.r =1.0 ;else
  1211. if(pos.x<0.4)mask.rg=1.0.xx;else
  1212. if(pos.x<0.7)mask.gb=1.0.xx;else
  1213. mask.b=1.0;mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1214. }else
  1215. if(shadow_msk==13.0)
  1216. {
  1217. mask=0.0;
  1218. pos.x=floor(mod(pos.x,7.0));
  1219. if(pos.x<0.5)mask =0.0.xxx;else
  1220. if(pos.x<2.5)mask.r=1.0 ;else
  1221. if(pos.x<4.5)mask.g=1.0 ;else
  1222. mask.b=1.0;
  1223. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1224. }else
  1225. {
  1226. mask=0.0;
  1227. pos.x=floor(mod(pos.x,6.0));
  1228. if(pos.x<0.5)mask =0.0.xxx;else
  1229. if(pos.x<1.5)mask.r =1.0 ;else
  1230. if(pos.x<2.5)mask.rg =1.0.xx ;else
  1231. if(pos.x<3.5)mask.rgb=1.0.xxx;else
  1232. if(pos.x<4.5)mask.gb =1.0.xx ;else
  1233. mask.b=1.0;
  1234. mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0);
  1235. }
  1236. if(mask_layout>0.5)mask=mask.rbg;
  1237. float maskmin=min(min(mask.r,mask.g),mask.b);
  1238. return (mask-maskmin)*(1.0+(maskboost-1.0)*mb)+maskmin;
  1239. }
  1240.  
  1241. float slt_mask(float2 pos,float m,float swidth)
  1242. {
  1243. if ((slotmask1+slotmask2)==0.0)return 1.0;else
  1244. {
  1245. pos.y=floor(pos.y/slotms);
  1246. float mlen=swidth*2.0;
  1247. float px=floor( mod(pos.x, 0.99999*mlen));
  1248. float py=floor(frac(pos.y/(2.0*double_slot))*2.0*double_slot);
  1249. float slot_dark=lerp(1.0-slotmask2,1.0-slotmask1,m);
  1250. float slot=1.0;
  1251. if(py==0.0&&px<swidth) slot=slot_dark;else
  1252. if(py==double_slot&&px>=swidth) slot=slot_dark;
  1253. return slot;
  1254. }
  1255. }
  1256.  
  1257. float humbars(float pos)
  1258. {
  1259. if (barintensity==0.0)return 1.0;else
  1260. {
  1261. pos=(barintensity>=0.0)?pos:(1.0-pos);
  1262. pos=frac(pos+ mod(float(framecount),barspeed)/(barspeed-1.0));
  1263. pos=(barintensity< 0.0)?pos:(1.0-pos);
  1264. return (1.0-barintensity)+barintensity*pos;
  1265. }
  1266. }
  1267.  
  1268. float corner(float2 pos)
  1269. {
  1270. float2 bc=bsize*float2(1.0,NewSize.x/NewSize.y)*0.050;
  1271. pos=clamp(pos,0.0,1.0);
  1272. pos=abs(2.0*(pos-0.5));
  1273. float csz=lerp(400.0,7.0,pow(4.0*csize,0.10));
  1274. float crn=dot(pow(pos,csz.xx*float2(1.0,NewSize.y/NewSize.x)),1.0.xx);
  1275. crn=(csize==0.0)? max(pos.x,pos.y):pow(crn,1.0/(csz));
  1276. pos=max(pos,crn);
  1277. float2 rs=(bsize==0.0)? 1.0.xx:lerp(0.0.xx,1.0.xx,smoothstep(1.0.xx,1.0.xx-bc,sqrt(pos)));
  1278. rs=pow(rs, sborder.xx);
  1279. return sqrt(rs.x*rs.y);
  1280. }
  1281.  
  1282. float3 declip(float3 c,float b)
  1283. {
  1284. float m=max(max(c.r,c.g),c.b);
  1285. if(m>b)c=c*b/m;
  1286. return c;
  1287. }
  1288.  
  1289. float igc(float mc)
  1290. {
  1291. return pow(mc,gamma_c);
  1292. }
  1293.  
  1294. float3 gc2(float3 c,float w3)
  1295. {
  1296. float mc=max(max(c.r,c.g),c.b);
  1297. float p=1.0/(1.0+(gamma_d-1.0)* lerp(0.375,1.0,w3));
  1298. float mg=pow(mc, p );
  1299. return c*mg/(mc+eps);
  1300. }
  1301.  
  1302. float3 noise(float3 v)
  1303. {
  1304. if(addnoised<0.0)v.z=-addnoised;else v.z= mod(v.z,6001.0)/1753.0;
  1305. v =frac(v)+frac(v*1e4)+frac(v*1e-4);
  1306. v+=float3(0.12345,0.6789,0.314159);
  1307. v =frac(v*dot(v,v)*123.456);
  1308. v =frac(v*dot(v,v)*123.456);
  1309. v =frac(v*dot(v,v)*123.456);
  1310. v =frac(v*dot(v,v)*123.456);
  1311. return v;
  1312. }
  1313.  
  1314. void bring_pixel(inout float3 c,inout float3 b,inout float3 g,float2 coord,float2 boord)
  1315. {
  1316. float stepx=NewSize.z;
  1317. float stepy=NewSize.w;
  1318. float2 dx=float2(stepx,0.0);
  1319. float2 dy=float2(0.0,stepy);
  1320. float posx= 2.0*coord.x-1.0;
  1321. float posy= 2.0*coord.y-1.0;
  1322. if(dctypex>0.025)
  1323. {
  1324. posx= sign(posx)*pow(abs(posx),1.05-dctypex);
  1325. dx=posx*dx;
  1326. }
  1327. if(dctypey>0.025)
  1328. {
  1329. posy= sign(posy)*pow(abs(posy),1.05-dctypey);
  1330. dy=posy*dy;
  1331. }
  1332. float2 rc=deconrx*dx+deconry*dy;
  1333. float2 gc=decongx*dx+decongy*dy;
  1334. float2 bc=deconbx*dx+deconby*dy;
  1335. float r1=texCD(CGHD_S08,coord+rc).r;
  1336. float g1=texCD(CGHD_S08,coord+gc).g;
  1337. float b1=texCD(CGHD_S08,coord+bc).b;
  1338. float ds=decons;
  1339. float3 d=float3(r1,g1,b1);
  1340. c=clamp(lerp(c,d,ds),0.0,1.0);
  1341. r1=texCD(CGHD_S07,boord+rc).r;
  1342. g1=texCD(CGHD_S07,boord+gc).g;
  1343. b1=texCD(CGHD_S07,boord+bc).b;
  1344. d=float3(r1,g1,b1);
  1345. b=g=lerp(b,d,min(ds,1.0));
  1346. r1=texCD(CGHD_S05,boord+rc).r;
  1347. g1=texCD(CGHD_S05,boord+gc).g;
  1348. b1=texCD(CGHD_S05,boord+bc).b;
  1349. d=float3(r1,g1,b1);
  1350. g=lerp(g,d,min(ds,1.0));
  1351. }
  1352.  
  1353. static const float2 expanse=BoxSize/ (2*OptSize.xy);
  1354. static const float2 capital=0.0/OptSize.xy+0.5;
  1355. static const float coord_w=capital.x-expanse.x;
  1356. static const float coord_e=capital.x+expanse.x;
  1357. static const float coord_n=capital.y-expanse.y;
  1358. static const float coord_s=capital.y+expanse.y;
  1359. static const float2 correct=float2(coord_w,coord_n);
  1360.  
  1361. void CropProcessVS(in uint id:SV_VertexID,out float4 position:SV_Position,out float2 texcoord:TEXCOORD)
  1362. {
  1363. #if __RENDERER__ <= 0x09300
  1364. texcoord.x=(id==1||id==3)?coord_e:coord_w;
  1365. texcoord.y=(id>1)?coord_s:coord_n;
  1366. position.x=(id==1||id==3)? 1:-1;
  1367. position.y=(id>1)?-1: 1;
  1368. position.zw=1;
  1369. #else
  1370. texcoord.x=(id&1)?coord_e:coord_w;
  1371. texcoord.y=(id&2)?coord_s:coord_n;
  1372. position.x=(id&1)? 1:-1;
  1373. position.y=(id&2)?-1: 1;
  1374. position.zw=1;
  1375. #endif
  1376. }
  1377.  
  1378. float4 StockPassPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1379. {
  1380. return tex2D(CGHD_S00,texcoord);
  1381. }
  1382.  
  1383. float4 LinearizePS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1384. {
  1385. float3 c1=texCD(CGHD_S01,fuxcoord).rgb;
  1386. float3 c2=texCD(CGHD_S01,fuxcoord+float2(0.0,OrgSize.w)).rgb;
  1387. float3 c=c1;
  1388. float intera=1.0;
  1389. float gamma_in=gamma_i;
  1390. float m1=max(max(c1.r,c1.g),c1.b);
  1391. float m2=max(max(c2.r,c2.g),c2.b);
  1392. float3 df=abs(c1-c2);
  1393. float d=max(max(df.r,df.g),df.b);
  1394. if(interm==2.0) d=lerp(0.1*d,10.0*d,step(m1/(m2+0.0001),m2/(m1+0.0001)));
  1395. float r=m1;
  1396. float yres_div=1.0;if(intres>1.25)yres_div=intres;
  1397. bool hscans=(hiscan>0.5);
  1398. if(interr<=OrgSize.y/yres_div&&interm>0.5&&intres!=1.0&&intres!=0.5&&vga_mode<0.5||hscans)
  1399. {
  1400. intera=0.25;
  1401. float liine_no=floor( mod(OrgSize.y*fuxcoord.y,2.0));
  1402. float frame_no=floor( mod(float(framecount),2.0));
  1403. float ii=abs(liine_no-frame_no);
  1404. if(interm< 3.5)
  1405. {
  1406. c2=plant(lerp(c2,c2*c2,iscans),max(max(c2.r,c2.g),c2.b));
  1407. r=max(m1*ii,(1.0-iscanb)*min(m1,m2));
  1408. c=plant(lerp(lerp(c1,c2,min(lerp(m1,1.0-m2,min(m1,1.0-m1))/(d+0.00001),1.0)),c1,ii),r);
  1409. if(interm==3.0) c=(1.0-0.5*iscanb)*lerp(c2,c1,ii);
  1410. }
  1411. if(interm==4.0){c=plant(lerp(c,c*c,0.5*iscans),max(max(c.r,c.g),c.b))*(1.0-0.5*iscanb);
  1412. }
  1413. if(hscans)c=c1;
  1414. }
  1415. if(vga_mode>0.5)
  1416. {
  1417. c=c1; if(interr<=OrgSize.y)intera=0.75; else intera=0.5;
  1418. }
  1419. c=pow(c,gamma_in);
  1420. if(fuxcoord.x>0.5)gamma_in=intera;else gamma_in=1.0/gamma_in;
  1421. return float4(c,gamma_in);
  1422. }
  1423.  
  1424. float4 HGaussianPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1425. {
  1426. float FINE_GAUSS= (FINE_GAUSS>0.5)? FINE_GAUSS: lerp(0.75,0.50,-FINE_GAUSS);
  1427. float4 AdvSize=float4(OrgSize.x,OrgSize.y,OrgSize.z,OrgSize.w)*float4(FINE_GAUSS,FINE_GAUSS,1.0/FINE_GAUSS,1.0/FINE_GAUSS);
  1428. float f=frac(AdvSize.x*texcoord.x);
  1429. f=0.5-f;
  1430. float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw;
  1431. float3 color=0.0;
  1432. float2 dx=float2(AdvSize.z ,0.0);
  1433. float3 pixel;
  1434. float w;
  1435. float wsum=0.0;
  1436. float n=-SIZEH;
  1437. do
  1438. {
  1439. pixel=texCD(CGHD_S02,tex+n*dx).rgb;
  1440. if(m_glow>0.5)
  1441. {
  1442. pixel=max(pixel-m_glow_cutoff,0.0);
  1443. pixel=plant(pixel,max(max(max(pixel.r,pixel.g),pixel.b)-m_glow_cutoff,0.0));
  1444. }
  1445. w=gauss_h(n+f);
  1446. color=color+w*pixel;
  1447. wsum=wsum+w;
  1448. n=n+1.0;
  1449. }
  1450. while(n<=SIZEH);
  1451. color=color/wsum;
  1452. return float4(color,1.0);
  1453. }
  1454.  
  1455. float4 VGaussianPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1456. {
  1457. float FINE_GAUSS= (FINE_GAUSS>0.5)? FINE_GAUSS: lerp(0.75,0.50,-FINE_GAUSS);
  1458. float4 AdvSize=float4(SrcSize.x,OrgSize.y,SrcSize.z,OrgSize.w)*float4(FINE_GAUSS,FINE_GAUSS,1.0/FINE_GAUSS,1.0/FINE_GAUSS);
  1459. float f=frac(AdvSize.y*texcoord.y);
  1460. f=0.5-f;
  1461. float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw;
  1462. float3 color=0.0;
  1463. float2 dy=float2(0.0,AdvSize.w );
  1464. float3 pixel;
  1465. float w;
  1466. float wsum=0.0;
  1467. float n=-SIZEV;
  1468. do
  1469. {
  1470. pixel=texCD(CGHD_S04,tex+n*dy).rgb;
  1471. w=gauss_v(n+f);
  1472. color=color+w*pixel;
  1473. wsum=wsum+w;
  1474. n=n+1.0;
  1475. }
  1476. while(n<=SIZEV);
  1477. color=color/wsum;
  1478. return float4(color,1.0);
  1479. }
  1480.  
  1481. float4 BloomHorzPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1482. {
  1483. float FINE_BLOOM= (FINE_BLOOM>0.5)? FINE_BLOOM: lerp(0.75,0.50,-FINE_BLOOM);
  1484. float4 AdvSize=float4(OrgSize.x,OrgSize.y,OrgSize.z,OrgSize.w)*float4(FINE_BLOOM,FINE_BLOOM,1.0/FINE_BLOOM,1.0/FINE_BLOOM);
  1485. float f=frac(AdvSize.x*texcoord.x);
  1486. f=0.5-f;
  1487. float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw;
  1488. float4 color=0.0;
  1489. float2 dx=float2(AdvSize.z ,0.0);
  1490. float4 pixel;
  1491. float w;
  1492. float wsum=0.0;
  1493. float n=-SIZEX;
  1494. do
  1495. {
  1496. pixel=texCD(CGHD_S02,tex+n*dx);
  1497. w=bloom_h(n+f);
  1498. pixel.a =max(max(pixel.r,pixel.g),pixel.b);
  1499. pixel.a*=pixel.a*pixel.a;
  1500. color=color+w*pixel;
  1501. wsum=wsum+w;
  1502. n=n+1.0;
  1503. }
  1504. while(n<=SIZEX);
  1505. color=color/wsum;
  1506. return float4(color.rgb,pow(color.a,0.333333));
  1507. }
  1508.  
  1509. float4 BloomVertPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1510. {
  1511. float FINE_BLOOM= (FINE_BLOOM>0.5)? FINE_BLOOM: lerp(0.75,0.50,-FINE_BLOOM);
  1512. float4 AdvSize=float4(SrcSize.x,OrgSize.y,SrcSize.z,OrgSize.w)*float4(FINE_BLOOM,FINE_BLOOM,1.0/FINE_BLOOM,1.0/FINE_BLOOM);
  1513. float f=frac(AdvSize.y*texcoord.y);
  1514. f=0.5-f;
  1515. float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw;
  1516. float4 color=0.0;
  1517. float2 dy=float2(0.0,AdvSize.w );
  1518. float4 pixel;
  1519. float w;
  1520. float wsum=0.0;
  1521. float n=-SIZEY;
  1522. do
  1523. {
  1524. pixel=texCD(CGHD_S06,tex+n*dy);
  1525. w=bloom_v(n+f);
  1526. pixel.a*=pixel.a*pixel.a;
  1527. color=color+w*pixel;
  1528. wsum=wsum+w;
  1529. n=n+1.0;
  1530. }
  1531. while(n<=SIZEY);
  1532. color=color/wsum;
  1533. return float4(color.rgb,pow(color.a,0.175000));
  1534. }
  1535.  
  1536. float4 HD_Pass1_PS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1537. {
  1538. float f=frac(OrgSize.x*fuxcoord.x);
  1539. f=0.5-f;
  1540. float2 tex=floor(OrgSize.xy*fuxcoord)*OrgSize.zw+0.5*OrgSize.zw;
  1541. float3 color=0.0.xxx;
  1542. float solor=0.0;
  1543. float2 dx=float2(OrgSize.z ,0.0);
  1544. float3 pixel;
  1545. float w=0.0;
  1546. float swum=0.0;
  1547. float wsum=0.0;
  1548. float hsharpness=HSHARPNESS*internal_res;
  1549. float3 cmax=0.0.xxx;
  1550. float3 cmin=1.0.xxx;
  1551. float sharp=crthd_h(hsharpness) *S_SHARP;
  1552. float maxsharp=MAXS;
  1553. float FPR=hsharpness;
  1554. float FPRi=1.0/hsharpness;
  1555. float fpx=0.0;
  1556. float sp=0.0;
  1557. float sw=0.0;
  1558. float ts=0.025;
  1559. float3 luma=float3(0.2126,0.7152,0.0722);
  1560. float LOOPSIZE=ceil(2.0*FPR);
  1561. float n=-LOOPSIZE;
  1562. do
  1563. {
  1564. pixel=texCD(CGHD_S02,tex+n*dx).rgb;
  1565. w=crthd_h(n+f)-sharp;
  1566. fpx=(abs(n+f)-FPR)*FPRi;
  1567. if(w<0.0)w=max(w,lerp(-maxsharp,0.0,pow(clamp(fpx,0.0,1.0),SHARP))); else
  1568. {
  1569. cmax=max(cmax,pixel);cmin=min(cmin,pixel);sw=w*(dot(pixel,luma)+ts);
  1570. sp=max(max(pixel.r,pixel.g),pixel.b);
  1571. solor=solor+sw*sp;
  1572. swum=swum+sw;
  1573. }
  1574. color=color+w*pixel;
  1575. wsum=wsum+w;
  1576. n=n+1.0;
  1577. }
  1578. while(n<=LOOPSIZE);
  1579. color=color/wsum;
  1580. solor=solor/swum;
  1581. color=clamp(lerp( clamp (color,cmin,cmax),color,SSRNG),0.0,1.0);
  1582. solor=clamp(lerp(max(max(color.r,color.g),color.b),solor,spike),0.0,1.0);
  1583. return float4(color,solor);
  1584. }
  1585.  
  1586. float4 HD_Pass2_PS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1587. {
  1588. float gamma_in=1.0/texCD(CGHD_S02,float2(0.25,0.25)).a;
  1589. float intera=texCD(CGHD_S02,float2(0.75,0.25)).a;
  1590. bool hscans=(hiscan>0.5);
  1591. bool interb=(((intera<0.35)||(no_scanlines>0.025))&&!hscans);
  1592. bool vgascan=((abs(intera-0.5)<0.05)&&(no_scanlines==0.0));
  1593. float4 AdvSize= OrgSize;
  1594. float SourceY=AdvSize.y;
  1595. float sy=1.0;
  1596. if( intres==1.0)sy=max(round(SourceY/224.0),1.0);
  1597. if( intres>0.25&&intres!=1.0)sy=intres;
  1598. if(vgascan)sy=0.5;else if(abs(intera-0.75)<0.05)sy=1.0;
  1599. AdvSize*=float4(1.0,1.0/sy,1.0,sy);
  1600. float2 lexcoord=fuxcoord.xy;
  1601. if(IOS> 0.0&& !interb)
  1602. {
  1603. float2 ofactor= NewSize.xy/OrgSize.xy;
  1604. float2 ifactor=(IOS<2.5)? floor(ofactor):ceil(ofactor);
  1605. float2 diff=ofactor/ifactor;
  1606. float scan=diff.y;
  1607. lexcoord=overscan(lexcoord,scan,scan);
  1608. if(IOS==1.0||IOS==3.0) lexcoord=float2(fuxcoord.x,lexcoord.y);
  1609. }
  1610. lexcoord=overscan(lexcoord,(OrgSize.x-overscanx)/OrgSize.x,(OrgSize.y-overscany)/OrgSize.y);
  1611. float2 pos = warp(lexcoord);
  1612. float coffset=0.5;
  1613. float2 ps=AdvSize.zw;
  1614. float OGL2Pos=pos.y*AdvSize.y-coffset;
  1615. float f=frac(OGL2Pos);
  1616. float2 dx=float2(ps.x,0.0);
  1617. float2 dy=float2(0.0,ps.y);
  1618. float2 pC4;
  1619. pC4.y=floor(OGL2Pos)*ps.y+0.5*ps.y;
  1620. pC4.x=pos.x;
  1621. if((intres==0.5<1.5)||vgascan) pC4.y=floor(pC4.y*OrgSize.y)*OrgSize.w+0.5*OrgSize.w;
  1622. if( interb&&no_scanlines>0.025)pC4.y=pC4.y+smoothstep(0.40-0.5*no_scanlines,0.60+0.5*no_scanlines,f)*AdvSize.w;
  1623. float3 color1=texCD(CGHD_S03,pC4).rgb;
  1624. float3 solor1=texCD(CGHD_S03,pC4).aaa;
  1625. if( interb&&no_scanlines<0.05||hscans&&vgascan||hscans)color1=v_resample(pos,AdvSize);
  1626. color1=pow(color1,scangamma/gamma_in);
  1627. pC4+=dy;
  1628. if((intres==0.5<1.5)||vgascan) pC4.y=floor((pos.y+0.33*dy.y)*OrgSize.y)*OrgSize.w+0.5*OrgSize.w;
  1629. float3 color2=texCD(CGHD_S03,pC4).rgb;
  1630. float3 solor2=texCD(CGHD_S03,pC4).aaa;
  1631. color2=pow(color2,scangamma/gamma_in);
  1632. float3 ctmp=color1;float w3=1.0;float3 color=color1;
  1633. float3 one=1.0;
  1634. if( hscans){color2=color1;solor2=solor1;}
  1635. if(!interb|| hscans)
  1636. {
  1637. float shape1=lerp(scanline1,scanline2, f);
  1638. float shape2=lerp(scanline1,scanline2,1.0-f);
  1639. float wt1=st0( f);
  1640. float wt2=st0(1.0-f);
  1641. float3 color0=color1*wt1+color2*wt2;
  1642. float3 solor0=solor1*wt1+solor2*wt2;
  1643. ctmp = color0/(wt1+wt2);
  1644. float3 stmp=max(solor0/(wt1+wt2),ctmp);
  1645. if(abs(rolling_scan)>0.005){color1=ctmp;color2=ctmp;solor1=stmp;solor2=stmp;}
  1646. float3 w1,w2;
  1647. float3 cref1=lerp(stmp,solor1,beam_size);float creff1=pow(max(max(cref1.r,cref1.g),cref1.b),scan_falloff);
  1648. float3 cref2=lerp(stmp,solor2,beam_size);float creff2=pow(max(max(cref2.r,cref2.g),cref2.b),scan_falloff);
  1649. if(tds>0.5){shape1=lerp(scanline2,shape1,creff1);shape2=lerp(scanline2,shape2,creff2);}
  1650. float scanpix=OrgSize.y/NewSize.y;
  1651. float f1=frac(f-rolling_scan*float(framecount)*scanpix);
  1652. float f2=1.0-f1;
  1653. float m1=max(max(color1.r,color1.g),color1.b)+eps;
  1654. float m2=max(max(color2.r,color2.g),color2.b)+eps;
  1655. cref1=color1/m1;
  1656. cref2=color2/m2;
  1657. if(gsl< 0.5)
  1658. {w1=sw0(f1,creff1,shape1,cref1);w2=sw0(f2,creff2,shape2,cref2);}else
  1659. if(gsl==1.0)
  1660. {w1=sw1(f1,creff1,shape1,cref1);w2=sw1(f2,creff2,shape2,cref2);}else
  1661. {w1=sw2(f1,creff1,shape1,cref1);w2=sw2(f2,creff2,shape2,cref2);}
  1662. float3 w3=w1+w2;
  1663. float wf1=max(max(w3.r,w3.g),w3.b);
  1664. if(wf1>1.0){wf1=1.0/wf1;w1*=wf1,w2*=wf1;}
  1665. if(abs(clp)>0.005)
  1666. {
  1667. sy=m1; one=(clp>0.0)?w1:1.0.xxx;
  1668. float sat=1.0001-min(min(cref1.r,cref1.g),cref1.b);
  1669. color1=lerp(color1,plant(pow(color1,0.70.xxx-0.325*sat),sy),pow(sat,0.3333)*one*abs(clp));
  1670. sy=m2; one=(clp>0.0)?w2:1.0.xxx;
  1671. sat=1.0001-min(min(cref2.r,cref2.g),cref2.b);
  1672. color2=lerp(color2,plant(pow(color2,0.70.xxx-0.325*sat),sy),pow(sat,0.3333)*one*abs(clp));
  1673. }
  1674. color=gc1(color1)*w1+gc1(color2)*w2;
  1675. color=min(color,1.0);
  1676. }
  1677. if( interb)
  1678. {
  1679. color=gc1(color1);
  1680. }
  1681. float colmx=max( max(ctmp.r,ctmp.g),ctmp.b);
  1682. color=pow(color,gamma_in/scangamma);
  1683. return float4(color,colmx);
  1684. }
  1685.  
  1686. float4 ChromaticPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1687. {
  1688. float gamma_in=1.0/texCD(CGHD_S02,float2(0.25,0.25)).a;
  1689. float intera=texCD(CGHD_S02,float2(0.75,0.25)).a;
  1690. bool interb=((intera<0.35||no_scanlines>0.025)&&(hiscan<0.5));
  1691. float2 lexcoord=fuxcoord.xy;
  1692. if(IOS> 0.0&& !interb)
  1693. {
  1694. float2 ofactor= NewSize.xy/OrgSize.xy;
  1695. float2 ifactor=(IOS<2.5)? floor(ofactor):ceil(ofactor);
  1696. float2 diff=ofactor/ifactor;
  1697. float scan=diff.y;
  1698. lexcoord=overscan(lexcoord,scan,scan);
  1699. if(IOS==1.0||IOS==3.0) lexcoord=float2(fuxcoord.x,lexcoord.y);
  1700. }
  1701. lexcoord=overscan(lexcoord,(OrgSize.x-overscanx)/OrgSize.x,(OrgSize.y-overscany)/OrgSize.y);
  1702. float2 pos0= warp(fuxcoord);
  1703. float2 pos1= fuxcoord;
  1704. float2 pos = warp(lexcoord);
  1705. float3 color=texCD(CGHD_S08,pos1).rgb;
  1706. float3 Bloom=texCD(CGHD_S07,pos ).rgb;
  1707. float3 Glow =texCD(CGHD_S05,pos ).rgb;
  1708. if((abs(deconrx)+abs(deconry)+abs(decongx)+abs(decongy)+abs(deconbx)+abs(deconby))>0.2) bring_pixel(color,Bloom,Glow,pos1,pos);
  1709. float cm=igc(max(max(color.r,color.g),color.b));
  1710. float mx1=texCD(CGHD_S08,pos1 ).a;
  1711. float colmx=max(mx1,cm);
  1712. float w3=min((max((cm-0.0005)*1.0005,0.0)+0.0001)/(colmx+0.0005),1.0);if(interb)w3=1.0;
  1713. float2 dx=float2(0.001,0.0);
  1714. float mx0=texCD(CGHD_S08,pos1-dx).a;
  1715. float mx2=texCD(CGHD_S08,pos1+dx).a;
  1716. float mxg=max(max(mx0,mx1),max(mx2,cm));
  1717. float mx=pow(mxg,1.40/gamma_in);
  1718. float cx=pow(colmx,1.40/gamma_in);
  1719. dx=float2(OrgSize.z,0.0)*0.25;
  1720. mx0=texCD(CGHD_S08,pos1-dx).a;
  1721. mx2=texCD(CGHD_S08,pos1+dx).a;
  1722. float mb=(1.0-min(abs(mx0-mx2)/(0.5+mx1),1.0));
  1723. float3 orig1=color;
  1724. float3 one=1.0;
  1725. float3 cmask=one;
  1726. float3 dmask=one;
  1727. float3 emask=one;
  1728. float mwidths[15]={0.0,2.0,3.0,3.0,6.0,6.0,2.4,3.5,2.4,3.25,3.5,4.5,4.25,7.5,6.25};
  1729. float mwidth=mwidths[int(shadow_msk)];
  1730. float mask_compensate=frac(mwidth);
  1731. if(shadow_msk> 0.5)
  1732. {
  1733. float2 maskcoord= fracoord.xy;
  1734. float2 scoord=maskcoord;
  1735. mwidth=floor(mwidth)*masksize;
  1736. float swidth=mwidth;
  1737. bool zoomed=(abs(mask_zoom)>0.75);
  1738. float mscale=1.0;
  1739. float2 maskcoord0=maskcoord;
  1740. maskcoord.y=floor(maskcoord.y/masksize);
  1741. float mwidth0=max(mwidth+mask_zoom,2.0);
  1742. if( mshift> 0.25)
  1743. {
  1744. float stagg_lvl=1.0; if(frac(mshift)>0.25)stagg_lvl=2.0;
  1745. float next_line=float(floor(mod(maskcoord.y,2.0*stagg_lvl))<stagg_lvl);
  1746. maskcoord0.x=maskcoord0.x+next_line*0.5*mwidth0;
  1747. }
  1748. maskcoord=maskcoord0/masksize;
  1749. if(!zoomed)cmask*=crt_mask(floor(maskcoord),mx,mb);else
  1750. {
  1751. mscale=mwidth0/mwidth;
  1752. float clerp= frac(maskcoord.x/mscale); if( zoom_mask>0.025 )clerp=clamp((1.0+zoom_mask)*clerp-0.5*zoom_mask,0.0,1.0);
  1753. float coord=floor(maskcoord.x/mscale); if(shadow_msk==13.0&&mask_zoom==-2.0)coord=ceil(maskcoord.x/mscale);
  1754. cmask*=lerp(crt_mask(float2(coord,maskcoord.y),mx,mb),crt_mask(float2(coord+1.0,maskcoord.y),mx,mb),clerp);
  1755. }
  1756. if(slotwidth>0.5)swidth=slotwidth;float smask=1.0;
  1757. float sm_offset=0.0;bool bsm_offset=(shadow_msk==1.0||shadow_msk==3.0||shadow_msk==6.0||shadow_msk==7.0||shadow_msk==9.0||shadow_msk==12.0);
  1758. if( zoomed)
  1759. {
  1760. if(mask_layout<0.5&&bsm_offset)sm_offset=1.0;else
  1761. if(bsm_offset)sm_offset=-1.0;
  1762. }
  1763. swidth=round(swidth*mscale);
  1764. smask =slt_mask(scoord+float2(sm_offset,0.0),mx,swidth);
  1765. smask =clamp(smask+lerp(smask_mit,0.0,w3*pow(colmx,0.3)),0.0,1.0);
  1766. emask =cmask;
  1767. cmask*=smask;
  1768. dmask =cmask;
  1769. if(abs(mask_bloom)>0.025)
  1770. {
  1771. float maxbl=max( max(max(Bloom.r,Bloom.g),Bloom.b),mxg);
  1772. maxbl=maxbl*max(lerp(1.0,2-colmx,bloom_dist),0.0);
  1773. if(mask_bloom>0.025) cmask= max(min(cmask +maxbl*mask_bloom,1),cmask); else
  1774. cmask=max(lerp(cmask,cmask*(1.0-0.5*maxbl)+plant(pow( Bloom,0.35.xxx),maxbl),-mask_bloom),cmask);
  1775. }
  1776. color=pow(color,mask_gamma/gamma_in);
  1777. color=color*cmask;
  1778. color=min(color,1.0);
  1779. color=pow(color,gamma_in/mask_gamma);
  1780. cmask=min(cmask,1.0);
  1781. dmask=min(dmask,1.0);
  1782. float mm=max(-2.75*cx*(cx-1.0)-lerp(0.075,0.165,cx),0.0);color=max(color,orig1*maskmid*mm);
  1783. }
  1784. float dark_compensate=lerp(max(clamp(lerp(mcut,maskstr,mx),0.0,1.0)-1.0+ mask_compensate,0.0)+1.0,1.0,mx); if(shadow_msk< 0.5) dark_compensate=1.0;
  1785. float bb=lerp(brightboost1,brightboost2,mx)* dark_compensate; color*=bb;
  1786. float3 Ref=texCD(CGHD_S02,pos).rgb;
  1787. float maxb=texCD(CGHD_S07,pos).a;
  1788. float3 bcmask=lerp(one,dmask,b_mask);
  1789. float3 hcmask=lerp(one,dmask,h_mask);
  1790. float3 Bloomy=Bloom;
  1791. if(abs(bloom)>0.025)
  1792. {
  1793. if(bloom<-0.01)Bloomy=plant(Bloom,maxb);
  1794. Bloomy= min(Bloomy*(orig1+color),max(0.5*(colmx+orig1-color),0.001*Bloomy));
  1795. Bloomy=0.5*(Bloomy+lerp(Bloomy,lerp(colmx*orig1,Bloomy,0.5),1.0-color));
  1796. Bloomy= bcmask*Bloomy*max(lerp(1.0,2.0-colmx,bloom_dist),0);
  1797. color=pow(pow(color,mask_gamma/gamma_in)+abs(bloom)*pow( Bloomy,mask_gamma/gamma_in),gamma_in/mask_gamma);
  1798. }
  1799. if(halation> 0.01)
  1800. {
  1801. Bloom= 0.5*(Bloom+Bloom*Bloom);float mbl=max(max(Bloom.r,Bloom.g),Bloom.b);float mxh=0.5*(colmx+colmx*colmx);
  1802. mbl=lerp(lerp(mxh,lerp( mxh,mbl,mbl),colmx),mbl,mb);
  1803. Bloom=plant(Bloom,lerp(sqrt(mbl*mxh),max((mbl-0.15*(1.0-colmx)),0.4*mxh),pow(colmx,0.25)))*lerp(0.425,1.0,colmx);
  1804. Bloom=(3.0-colmx-color)*plant(0.325+orig1/w3,0.5*(1.0+w3))*hcmask*Bloom;
  1805. color=pow(pow(color,mask_gamma/gamma_in)+ halation *pow( Bloom ,mask_gamma/gamma_in),gamma_in/mask_gamma);
  1806. }else
  1807. if(halation<-0.01)
  1808. {
  1809. float mbl=max(max(Bloom.r,Bloom.g),Bloom.b);
  1810. Bloom=plant(Bloom+Ref+orig1+Bloom*Bloom*Bloom,min(mbl*mbl,0.75));
  1811. color=color+2.0*lerp(1.0,w3,0.5*colmx)*hcmask*Bloom*(-halation);
  1812. }
  1813. color=min(color,1.0);
  1814. color=gc2(color,w3 );
  1815. if(smoothmask>0.125){float w4=pow(w3,0.425+0.3*smoothmask);w4=max(w4-0.175*colmx*smoothmask,0.2);color=lerp(min(color/w4,plant(orig1,1.0+0.175*colmx*smoothmask))*w4,color,w4);}
  1816. if(m_glow<0.5)Glow=lerp(Glow,0.25*color,colmx);else
  1817. {
  1818. float3 orig2=plant(orig1+0.001*Ref,1.0); maxb=max(max(Glow.r,Glow.g),Glow.b);
  1819. Bloom=plant(Glow,1.0);Ref=abs(orig2-Bloom);
  1820. mx0=max(max(orig2.r,orig2.g),orig2.b)-min(min(orig2.r,orig2.g),orig2.b);
  1821. mx2=max(max(Bloom.r,Bloom.g),Bloom.b)-min(min(Bloom.r,Bloom.g),Bloom.b);
  1822. Bloom=lerp(maxb*min(Bloom,orig2),lerp(lerp(Glow,max(max(Ref.r,Ref.g),Ref.b)*Glow,max(mx,mx0)),lerp(color,Glow,mx2),max(mx0,mx2)*Ref),min(sqrt((1.10-mx0)*(0.10+mx2)),1.0));
  1823. if(m_glow>1.5)Glow=lerp(0.5*Glow*Glow,Bloom,Bloom);
  1824. Glow=lerp(m_glow_low*Glow,m_glow_high*Bloom,pow(colmx,m_glow_dist/gamma_in));
  1825. }
  1826. if(m_glow<0.5)
  1827. {
  1828. if(glow >=0.0)color=color+0.5*Glow*glow;else color=color+abs(glow)*min(emask*emask,1.0)*Glow;}else
  1829. {
  1830. float3 fmask=clamp(lerp(one,dmask,m_glow_mask),0.0,1.0);
  1831. color=color+abs(glow)*fmask*Glow;
  1832. }
  1833. float vig=vignette(pos);
  1834. color=min(color,1.0);
  1835. if(edgemask>0.05)
  1836. {
  1837. mx0=texCD(CGHD_S08,pos1-dx).a;mx0=texCD(CGHD_S08,pos1-dx*(1.0-0.75*sqrt(mx0))).a;
  1838. mx2=texCD(CGHD_S08,pos1+dx).a;mx2=texCD(CGHD_S08,pos1+dx*(1.0-0.75*sqrt(mx2))).a;
  1839. float mx3=texCD(CGHD_S08,pos1-4.0*dx).a;
  1840. float mx4=texCD(CGHD_S08,pos1+4.0*dx).a;
  1841. mx4=max(pow(abs(mx3-mx4),0.55-0.40*cx),min(max(mx3,mx4)/min(0.1+cx,1.0),1.0));
  1842. mb=(1.0-abs(pow(mx0,1.0-0.65*mx2)-pow(mx2,1.0-0.65*mx0)));
  1843. mb=mx4*edgemask*(1.0001-mb*mb);float3 temp=lerp(color,orig1,mb);
  1844. color=max(temp+lerp(3.5*mb*lerp(1.625*temp,temp,cx),0.0.xxx,pow(color,0.75.xxx -0.5*colmx)),color);
  1845. }
  1846. color=color* lerp(1.0,lerp(0.5*(1.0+w3),w3,mx),pr_scan);
  1847. color=min(color,max(orig1,color)*lerp(one,dmask,mclip));
  1848. color=pow(color,1.0/gamma_o);
  1849. float q=0.6*sqrt(max(max(color.r,color.g),color.b))+0.4;
  1850. if(abs(addnoised)>0.01)
  1851. {
  1852. float3 noise0=noise(float3(floor(NewSize.xy*fuxcoord/noiseresd),float(framecount)));
  1853. if(noisetype<0.5)color=lerp(color,noise0,0.25*abs(addnoised)*q);else
  1854. color=min(color* lerp(1.0,1.5*noise0.x,0.5*abs(addnoised)),1.0);
  1855. }
  1856. colmx=max(max(orig1.r,orig1.g),orig1.b);
  1857. color=color+bmask*lerp(emask,0.125*(1.0-colmx)*color,min(20.0*colmx,1.0));
  1858. return float4(color*vig*humbars(lerp(pos.y,pos.x,bardir))*post_br*corner(pos0),1.0);
  1859. }
  1860.  
  1861. float4 RatioSizePS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target
  1862. {
  1863. const bool margins=float(texcoord.x>=coord_w&&texcoord.x<=coord_e&&texcoord.y>=coord_n&&texcoord.y<=coord_s);
  1864. const float2 boxcoord=((texcoord-correct)*OptSize.xy+0)/BoxSize;
  1865. const float4 boxcolor=tex2D(CGHD_S09,boxcoord);
  1866. return float4(margins*boxcolor.rgb,boxcolor.a);
  1867. }
  1868.  
  1869. technique CRT_Guest
  1870. {
  1871. pass StockPass
  1872. {
  1873. VertexShader=CropProcessVS;
  1874. PixelShader=StockPassPS;
  1875. RenderTarget=CGHD_T01;
  1876. PrimitiveTopology=TRIANGLESTRIP;
  1877. VertexCount=4;
  1878. }
  1879. pass Linearize
  1880. {
  1881. VertexShader=PostProcessVS;
  1882. PixelShader=LinearizePS;
  1883. RenderTarget=CGHD_T02;
  1884. }
  1885. pass CRT_Pass1
  1886. {
  1887. VertexShader=PostProcessVS;
  1888. PixelShader=HD_Pass1_PS;
  1889. RenderTarget=CGHD_T03;
  1890. }
  1891. pass GaussianX
  1892. {
  1893. VertexShader=PostProcessVS;
  1894. PixelShader=HGaussianPS;
  1895. RenderTarget=CGHD_T04;
  1896. }
  1897. pass GaussianY
  1898. {
  1899. VertexShader=PostProcessVS;
  1900. PixelShader=VGaussianPS;
  1901. RenderTarget=CGHD_T05;
  1902. }
  1903. pass BloomHorz
  1904. {
  1905. VertexShader=PostProcessVS;
  1906. PixelShader=BloomHorzPS;
  1907. RenderTarget=CGHD_T06;
  1908. }
  1909. pass BloomVert
  1910. {
  1911. VertexShader=PostProcessVS;
  1912. PixelShader=BloomVertPS;
  1913. RenderTarget=CGHD_T07;
  1914. }
  1915. pass CRT_Pass2
  1916. {
  1917. VertexShader=PostProcessVS;
  1918. PixelShader=HD_Pass2_PS;
  1919. RenderTarget=CGHD_T08;
  1920. }
  1921. pass Chromatic
  1922. {
  1923. VertexShader=PostProcessVS;
  1924. PixelShader=ChromaticPS;
  1925. RenderTarget=CGHD_T09;
  1926. }
  1927. pass RatioSize
  1928. {
  1929. VertexShader=PostProcessVS;
  1930. PixelShader=RatioSizePS;
  1931. }
  1932. }
Advertisement
Add Comment
Please, Sign In to add comment