SHOW:
|
|
- or go back to the newest paste.
| 1 | /* | |
| 2 | ||
| 3 | CRT - Guest - NTSC | |
| 4 | ||
| 5 | Copyright (C) 2018-2026 guest(r) | |
| 6 | ||
| 7 | Sega MS Blue Lift and Sega MD Pallete Fix fixes inspired by Azurfel | |
| 8 | ||
| 9 | contrast_sigmoid_inv function Copyright (C) 2020-2023 Dogway (Jose Linares) | |
| 10 | ||
| 11 | Incorporates many good ideas and suggestions from Dr. Venom. | |
| 12 | ||
| 13 | I would also like give thanks to many Libretro forums members for continuous feedback, suggestions and using the shader. | |
| 14 | ||
| 15 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License | |
| 16 | as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. | |
| 17 | ||
| 18 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; | |
| 19 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
| 20 | See the GNU General Public License for more details. | |
| 21 | ||
| 22 | You should have received a copy of the GNU General Public License along with this program; if not, | |
| 23 | write to the Free Software Foundation, Inc, 59 Temple Place - STE 330, Boston, MA 02111-1307, USA. | |
| 24 | ||
| 25 | Ported to ReShade by DevilSingh with some help from guest(r) | |
| 26 | ||
| 27 | */ | |
| 28 | ||
| 29 | // ============================================================================ | |
| 30 | // crt-black_crush-koko (ReShade port by Jobima) | |
| 31 | // ============================================================================ | |
| 32 | ||
| 33 | ///////////////////////////// GPL LICENSE NOTICE ///////////////////////////// | |
| 34 | // | |
| 35 | // crt-black_crush-koko | |
| 36 | // Copyright (C) 2024 Antonio Orefice <[email protected]> | |
| 37 | // | |
| 38 | // This program is free software; you can redistribute it and/or modify it | |
| 39 | // under the terms of the GNU General Public License as published by the Free | |
| 40 | // Software Foundation; either version 3 of the License, or any later version. | |
| 41 | // | |
| 42 | //////////////////////////////////////////////////////////////////////////////// | |
| 43 | ||
| 44 | uniform float bth < | |
| 45 | ui_category = "Afterglow Settings"; | |
| 46 | ui_type = "drag"; | |
| 47 | ui_min = 1.0; | |
| 48 | ui_max = 125.0; | |
| 49 | ui_step = 1.0; | |
| 50 | ui_label = "Afterglow Effect Threshold"; | |
| 51 | > = 10.0; | |
| 52 | ||
| 53 | uniform float PR < | |
| 54 | ui_category = "Afterglow Settings"; | |
| 55 | ui_type = "drag"; | |
| 56 | ui_min = 0.0; | |
| 57 | ui_max = 0.5; | |
| 58 | ui_step = 0.01; | |
| 59 | ui_label = "Persistence Red"; | |
| 60 | > = 0.32; | |
| 61 | ||
| 62 | uniform float PG < | |
| 63 | ui_category = "Afterglow Settings"; | |
| 64 | ui_type = "drag"; | |
| 65 | ui_min = 0.0; | |
| 66 | ui_max = 0.5; | |
| 67 | ui_step = 0.01; | |
| 68 | ui_label = "Persistence Green"; | |
| 69 | > = 0.32; | |
| 70 | ||
| 71 | uniform float PB < | |
| 72 | ui_category = "Afterglow Settings"; | |
| 73 | ui_type = "drag"; | |
| 74 | ui_min = 0.0; | |
| 75 | ui_max = 0.5; | |
| 76 | ui_step = 0.01; | |
| 77 | ui_label = "Persistence Blue"; | |
| 78 | > = 0.32; | |
| 79 | ||
| 80 | uniform float AS < | |
| 81 | ui_category = "Afterglow Settings"; | |
| 82 | ui_type = "drag"; | |
| 83 | ui_min = 0.0; | |
| 84 | ui_max = 0.6; | |
| 85 | ui_step = 0.01; | |
| 86 | ui_label = "Afterglow Strength"; | |
| 87 | > = 0.1; | |
| 88 | ||
| 89 | uniform float ST < | |
| 90 | ui_category = "Afterglow Settings"; | |
| 91 | ui_type = "drag"; | |
| 92 | ui_min = 0.0; | |
| 93 | ui_max = 1.0; | |
| 94 | ui_step = 0.01; | |
| 95 | ui_label = "Afterglow saturation"; | |
| 96 | > = 0.5; | |
| 97 | ||
| 98 | uniform float CS < | |
| 99 | ui_category = "Color Tweaks"; | |
| 100 | ui_type = "drag"; | |
| 101 | ui_min = 0.0; | |
| 102 | ui_max = 5.0; | |
| 103 | ui_step = 1.0; | |
| 104 | ui_label = "Display Gamut: sRGB | Modern | DCI | Adobe | Rec. 2020 | P3"; | |
| 105 | > = 0.0; | |
| 106 | ||
| 107 | uniform float CP < | |
| 108 | ui_category = "Color Tweaks"; | |
| 109 | ui_type = "drag"; | |
| 110 | ui_min = -1.0; | |
| 111 | ui_max = 5.0; | |
| 112 | ui_step = 1.0; | |
| 113 | ui_label = "CRT Profile: EBU | P22 | SMPTE-C | Philips | Trinitron"; | |
| 114 | > = 0.0; | |
| 115 | ||
| 116 | uniform float TNTC < | |
| 117 | ui_category = "Color Tweaks"; | |
| 118 | ui_type = "drag"; | |
| 119 | ui_min = 0.0; | |
| 120 | ui_max = 4.0; | |
| 121 | ui_step = 1.0; | |
| 122 | ui_label = "LUT Colors: NTSC-J | Trinitron | Nec MultiSync | NTSC 1953"; | |
| 123 | > = 0.0; | |
| 124 | ||
| 125 | uniform float LUTLOW < | |
| 126 | ui_category = "Color Tweaks"; | |
| 127 | ui_type = "drag"; | |
| 128 | ui_min = 0.0; | |
| 129 | ui_max = 50.0; | |
| 130 | ui_step = 1.0; | |
| 131 | ui_label = "Fix LUT Dark Range"; | |
| 132 | > = 5.0; | |
| 133 | ||
| 134 | uniform float LUTBR < | |
| 135 | ui_category = "Color Tweaks"; | |
| 136 | ui_type = "drag"; | |
| 137 | ui_min = 0.0; | |
| 138 | ui_max = 1.0; | |
| 139 | ui_step = 0.01; | |
| 140 | ui_label = "Fix LUT Brightness"; | |
| 141 | > = 1.0; | |
| 142 | ||
| 143 | uniform float WP < | |
| 144 | ui_category = "Color Tweaks"; | |
| 145 | ui_type = "drag"; | |
| 146 | ui_min = -100.0; | |
| 147 | ui_max = 100.0; | |
| 148 | ui_step = 5.0; | |
| 149 | ui_label = "Color Temperature %"; | |
| 150 | > = 0.0; | |
| 151 | ||
| 152 | uniform float wp_saturation < | |
| 153 | ui_category = "Color Tweaks"; | |
| 154 | ui_type = "drag"; | |
| 155 | ui_min = 0.0; | |
| 156 | ui_max = 2.0; | |
| 157 | ui_step = 0.05; | |
| 158 | ui_label = "Saturation Adjustment"; | |
| 159 | > = 0.95; | |
| 160 | ||
| 161 | uniform float pre_bb < | |
| 162 | ui_category = "Color Tweaks"; | |
| 163 | ui_type = "drag"; | |
| 164 | ui_min = 0.0; | |
| 165 | ui_max = 2.0; | |
| 166 | ui_step = 0.01; | |
| 167 | ui_label = "Brightness Adjustment"; | |
| 168 | > = 1.0; | |
| 169 | ||
| 170 | uniform float contra < | |
| 171 | ui_category = "Color Tweaks"; | |
| 172 | ui_type = "drag"; | |
| 173 | ui_min = -2.0; | |
| 174 | ui_max = 2.0; | |
| 175 | ui_step = 0.05; | |
| 176 | ui_label = "Contrast Adjustment"; | |
| 177 | > = 0.2; | |
| 178 | ||
| 179 | uniform float pre_gc < | |
| 180 | ui_category = "Color Tweaks"; | |
| 181 | ui_type = "drag"; | |
| 182 | ui_min = 0.5; | |
| 183 | ui_max = 1.75; | |
| 184 | ui_step = 0.025; | |
| 185 | ui_label = "Gamma Correct Adjustment"; | |
| 186 | > = 1.025; | |
| 187 | ||
| 188 | uniform float sega_fix < | |
| 189 | ui_category = "Color Tweaks"; | |
| 190 | ui_type = "drag"; | |
| 191 | ui_min = 0.0; | |
| 192 | ui_max = 1.0; | |
| 193 | ui_step = 1.0; | |
| 194 | ui_label = "Sega Brightness Fix"; | |
| 195 | > = 0.0; | |
| 196 | ||
| 197 | uniform float segams < | |
| 198 | ui_category = "Color Tweaks"; | |
| 199 | ui_type = "drag"; | |
| 200 | ui_min = 0.0; | |
| 201 | ui_max = 1.0; | |
| 202 | ui_step = 1.0; | |
| 203 | ui_label = "Sega MS Blue Lift"; | |
| 204 | > = 0.0; | |
| 205 | ||
| 206 | uniform float segapal < | |
| 207 | ui_category = "Color Tweaks"; | |
| 208 | ui_type = "drag"; | |
| 209 | ui_min = 0.0; | |
| 210 | ui_max = 1.0; | |
| 211 | ui_step = 1.0; | |
| 212 | ui_label = "Sega MD Pallete Fix"; | |
| 213 | > = 0.0; | |
| 214 | ||
| 215 | uniform float BP < | |
| 216 | ui_category = "Color Tweaks"; | |
| 217 | ui_type = "drag"; | |
| 218 | ui_min = -100.0; | |
| 219 | ui_max = 0.0; | |
| 220 | ui_step = 1.0; | |
| 221 | ui_label = "Lower Black Level"; | |
| 222 | > = 0.0; | |
| 223 | ||
| 224 | uniform float BP1 < | |
| 225 | ui_category = "Color Tweaks"; | |
| 226 | ui_type = "drag"; | |
| 227 | ui_min = 0.0; | |
| 228 | ui_max = 25.0; | |
| 229 | ui_step = 1.0; | |
| 230 | ui_label = "Raise Black Level"; | |
| 231 | > = 0.0; | |
| 232 | ||
| 233 | uniform float vigstr < | |
| 234 | ui_category = "Color Tweaks"; | |
| 235 | ui_type = "drag"; | |
| 236 | ui_min = 0.0; | |
| 237 | ui_max = 2.0; | |
| 238 | ui_step = 0.05; | |
| 239 | ui_label = "Vignette Strength"; | |
| 240 | > = 0.0; | |
| 241 | ||
| 242 | uniform float vigdef < | |
| 243 | ui_category = "Color Tweaks"; | |
| 244 | ui_type = "drag"; | |
| 245 | ui_min = 0.5; | |
| 246 | ui_max = 3.0; | |
| 247 | ui_step = 0.1; | |
| 248 | ui_label = "Vignette Size"; | |
| 249 | > = 1.0; | |
| 250 | ||
| 251 | uniform float interr < | |
| 252 | ui_category = "Interlacing Options"; | |
| 253 | ui_type = "drag"; | |
| 254 | ui_min = 0.0; | |
| 255 | ui_max = 800.0; | |
| 256 | ui_step = 25.0; | |
| 257 | ui_label = "Interlace Trigger Resolution"; | |
| 258 | > = 400.0; | |
| 259 | ||
| 260 | uniform float interm < | |
| 261 | ui_category = "Interlacing Options"; | |
| 262 | ui_type = "drag"; | |
| 263 | ui_min = 0.0; | |
| 264 | ui_max = 6.0; | |
| 265 | ui_step = 1.0; | |
| 266 | ui_label = "Interlace Mode: 0:OFF | 1-3,6:Normal | 4-5:Interpolation"; | |
| 267 | > = 4.0; | |
| 268 | ||
| 269 | uniform float iscanb < | |
| 270 | ui_category = "Interlacing Options"; | |
| 271 | ui_type = "drag"; | |
| 272 | ui_min = 0.0; | |
| 273 | ui_max = 1.0; | |
| 274 | ui_step = 0.05; | |
| 275 | ui_label = "Interlacing Scanline Effect ('Laced Brightness)";
| |
| 276 | > = 0.2; | |
| 277 | ||
| 278 | uniform float intres < | |
| 279 | ui_category = "Resolution/Scaling Options"; | |
| 280 | ui_type = "drag"; | |
| 281 | ui_min = 0.0; | |
| 282 | ui_max = 10.0; | |
| 283 | ui_step = 0.5; | |
| 284 | ui_label = "Internal Resolution Y: 0.5...y-dowsample divider"; | |
| 285 | > = 0.0; | |
| 286 | ||
| 287 | uniform float downsample_levelx < | |
| 288 | ui_category = "Resolution/Scaling Options"; | |
| 289 | ui_type = "drag"; | |
| 290 | ui_min = 0.0; | |
| 291 | ui_max = 2.0; | |
| 292 | ui_step = 0.05; | |
| 293 | ui_label = "Downsampling-X (High-res content, pre-scalers)"; | |
| 294 | > = 0.0; | |
| 295 | ||
| 296 | uniform float downsample_levely < | |
| 297 | ui_category = "Resolution/Scaling Options"; | |
| 298 | ui_type = "drag"; | |
| 299 | ui_min = 0.0; | |
| 300 | ui_max = 2.0; | |
| 301 | ui_step = 0.05; | |
| 302 | ui_label = "Downsampling-Y (High-res content, pre-scalers)"; | |
| 303 | > = 0.0; | |
| 304 | ||
| 305 | uniform float iscans < | |
| 306 | ui_category = "Resolution/Scaling Options"; | |
| 307 | ui_type = "drag"; | |
| 308 | ui_min = 0.0; | |
| 309 | ui_max = 1.0; | |
| 310 | ui_step = 0.05; | |
| 311 | ui_label = "Interlacing (Scanline) Saturation"; | |
| 312 | > = 0.25; | |
| 313 | ||
| 314 | uniform float hiscan < | |
| 315 | ui_category = "Resolution/Scaling Options"; | |
| 316 | ui_type = "drag"; | |
| 317 | ui_min = 0.0; | |
| 318 | ui_max = 1.0; | |
| 319 | ui_step = 1.0; | |
| 320 | ui_label = "High Resolution Scanlines (prepend a scaler...)"; | |
| 321 | > = 0.0; | |
| 322 | ||
| 323 | uniform float filter_res < | |
| 324 | ui_category = "Resolution/Scaling Options"; | |
| 325 | ui_type = "drag"; | |
| 326 | ui_min = 0.5; | |
| 327 | ui_max = 8.0; | |
| 328 | ui_step = 0.1; | |
| 329 | ui_label = "Horizontal Filtering Resolution"; | |
| 330 | > = 1.0; | |
| 331 | ||
| 332 | uniform float speedup < | |
| 333 | ui_category = "Resolution/Scaling Options"; | |
| 334 | ui_type = "drag"; | |
| 335 | ui_min = 1.0; | |
| 336 | ui_max = 4.0; | |
| 337 | ui_step = 1.0; | |
| 338 | ui_label = "Speedup w. higher Internal Res."; | |
| 339 | > = 1.0; | |
| 340 | ||
| 341 | uniform float cust_artifacting < | |
| 342 | ui_category = "NTSC Settings"; | |
| 343 | ui_type = "drag"; | |
| 344 | ui_min = 0.0; | |
| 345 | ui_max = 5.0; | |
| 346 | ui_step = 0.1; | |
| 347 | ui_label = "NTSC Artifacting Value"; | |
| 348 | > = 0.2; | |
| 349 | ||
| 350 | uniform float cust_fringing < | |
| 351 | ui_category = "NTSC Settings"; | |
| 352 | ui_type = "drag"; | |
| 353 | ui_min = 0.0; | |
| 354 | ui_max = 5.0; | |
| 355 | ui_step = 0.1; | |
| 356 | ui_label = "NTSC Fringing Value"; | |
| 357 | > = 0.1; | |
| 358 | ||
| 359 | uniform float ntsc_fields < | |
| 360 | ui_category = "NTSC Settings"; | |
| 361 | ui_type = "drag"; | |
| 362 | ui_min = -1.0; | |
| 363 | ui_max = 1.0; | |
| 364 | ui_step = 1.0; | |
| 365 | ui_label = "NTSC Merge Fields: Auto | No | Yes"; | |
| 366 | > = -1.0; | |
| 367 | ||
| 368 | uniform float ntsc_phase < | |
| 369 | ui_category = "NTSC Settings"; | |
| 370 | ui_type = "drag"; | |
| 371 | ui_min = 1.0; | |
| 372 | ui_max = 5.0; | |
| 373 | ui_step = 1.0; | |
| 374 | ui_label = "NTSC Phase: Auto | 2 Phase | 3 Phase | Mixed | PCE"; | |
| 375 | > = 1.0; | |
| 376 | ||
| 377 | uniform float nscale < | |
| 378 | ui_category = "NTSC Settings"; | |
| 379 | ui_type = "drag"; | |
| 380 | ui_min = 0.2; | |
| 381 | ui_max = 5.0; | |
| 382 | ui_step = 0.05; | |
| 383 | ui_label = "NTSC Filter (Resolution) Scaling"; | |
| 384 | > = 1.25; | |
| 385 | ||
| 386 | uniform float ntsc_dith < | |
| 387 | ui_category = "NTSC Settings"; | |
| 388 | ui_type = "drag"; | |
| 389 | ui_min = 0.0; | |
| 390 | ui_max = 1.5; | |
| 391 | ui_step = 0.01; | |
| 392 | ui_label = "NTSC Resolution: De-dithering Booster"; | |
| 393 | > = 0.25; | |
| 394 | ||
| 395 | uniform float ntsc_sat < | |
| 396 | ui_category = "NTSC Settings"; | |
| 397 | ui_type = "drag"; | |
| 398 | ui_min = 0.0; | |
| 399 | ui_max = 2.0; | |
| 400 | ui_step = 0.01; | |
| 401 | ui_label = "NTSC Color Saturation"; | |
| 402 | > = 1.07; | |
| 403 | ||
| 404 | uniform float ntsc_brt < | |
| 405 | ui_category = "NTSC Settings"; | |
| 406 | ui_type = "drag"; | |
| 407 | ui_min = 0.0; | |
| 408 | ui_max = 1.5; | |
| 409 | ui_step = 0.01; | |
| 410 | ui_label = "NTSC Brightness"; | |
| 411 | > = 1.0; | |
| 412 | ||
| 413 | uniform float ntsc_gamma < | |
| 414 | ui_category = "NTSC Settings"; | |
| 415 | ui_type = "drag"; | |
| 416 | ui_min = 0.25; | |
| 417 | ui_max = 2.5; | |
| 418 | ui_step = 0.025; | |
| 419 | ui_label = "NTSC Filtering Gamma Correction"; | |
| 420 | > = 1.125; | |
| 421 | ||
| 422 | uniform float ntsc_rainbow < | |
| 423 | ui_category = "NTSC Settings"; | |
| 424 | ui_type = "drag"; | |
| 425 | ui_min = 0.0; | |
| 426 | ui_max = 3.0; | |
| 427 | ui_step = 1.0; | |
| 428 | ui_label = "NTSC Coloring/Rainbow Effect (2-phase)"; | |
| 429 | > = 2.0; | |
| 430 | ||
| 431 | uniform float ntsc_taps < | |
| 432 | ui_category = "NTSC Settings"; | |
| 433 | ui_type = "drag"; | |
| 434 | ui_min = 6.0; | |
| 435 | ui_max = 48.0; | |
| 436 | ui_step = 1.0; | |
| 437 | ui_label = "NTSC # of Taps (Filter Width)"; | |
| 438 | > = 16.0; | |
| 439 | ||
| 440 | uniform float ntsc_charp1 < | |
| 441 | ui_category = "NTSC Settings"; | |
| 442 | ui_type = "drag"; | |
| 443 | ui_min = 0.0; | |
| 444 | ui_max = 10.0; | |
| 445 | ui_step = 0.5; | |
| 446 | ui_label = "NTSC Preserve 'Edge' Colors (2-phase)"; | |
| 447 | > = 5.0; | |
| 448 | ||
| 449 | uniform float ntsc_charp2 < | |
| 450 | ui_category = "NTSC Settings"; | |
| 451 | ui_type = "drag"; | |
| 452 | ui_min = 0.0; | |
| 453 | ui_max = 10.0; | |
| 454 | ui_step = 0.5; | |
| 455 | ui_label = "NTSC Preserve 'Edge' Colors (3-phase)"; | |
| 456 | > = 3.0; | |
| 457 | ||
| 458 | uniform float ntsc_cscale1 < | |
| 459 | ui_category = "NTSC Settings"; | |
| 460 | ui_type = "drag"; | |
| 461 | ui_min = 0.5; | |
| 462 | ui_max = 4.00; | |
| 463 | ui_step = 0.05; | |
| 464 | ui_label = "NTSC Chroma Scaling/Bleeding (2-phase)"; | |
| 465 | > = 1.5; | |
| 466 | ||
| 467 | uniform float ntsc_cscale2 < | |
| 468 | ui_category = "NTSC Settings"; | |
| 469 | ui_type = "drag"; | |
| 470 | ui_min = 0.2; | |
| 471 | ui_max = 2.25; | |
| 472 | ui_step = 0.05; | |
| 473 | ui_label = "NTSC Chroma Scaling/Bleeding (3-phase)"; | |
| 474 | > = 1.0; | |
| 475 | ||
| 476 | uniform float ntsc_ring < | |
| 477 | ui_category = "NTSC Settings"; | |
| 478 | ui_type = "drag"; | |
| 479 | ui_min = 0.0; | |
| 480 | ui_max = 1.0; | |
| 481 | ui_step = 0.1; | |
| 482 | ui_label = "NTSC Anti-Ringing"; | |
| 483 | > = 0.9; | |
| 484 | ||
| 485 | uniform float ntsc_shrp < | |
| 486 | ui_category = "NTSC Settings"; | |
| 487 | ui_type = "drag"; | |
| 488 | ui_min = -10.0; | |
| 489 | ui_max = 10.0; | |
| 490 | ui_step = 0.5; | |
| 491 | ui_label = "NTSC Sharpness (Adaptive)"; | |
| 492 | > = -2.5; | |
| 493 | ||
| 494 | uniform float ntsc_fonts < | |
| 495 | ui_category = "NTSC Settings"; | |
| 496 | ui_type = "drag"; | |
| 497 | ui_min = 0.25; | |
| 498 | ui_max = 0.75; | |
| 499 | ui_step = 0.01; | |
| 500 | ui_label = "NTSC Preserve Fonts (0.25 = OFF)"; | |
| 501 | > = 0.45; | |
| 502 | ||
| 503 | uniform float ntsc_shpe < | |
| 504 | ui_category = "NTSC Settings"; | |
| 505 | ui_type = "drag"; | |
| 506 | ui_min = 0.5; | |
| 507 | ui_max = 1.0; | |
| 508 | ui_step = 0.025; | |
| 509 | ui_label = "NTSC Sharpness Shape"; | |
| 510 | > = 0.5; | |
| 511 | ||
| 512 | uniform float RFNOISE < | |
| 513 | ui_category = "RF Noise Options"; | |
| 514 | ui_type = "drag"; | |
| 515 | ui_min = 0.0; | |
| 516 | ui_max = 1.0; | |
| 517 | ui_step = 0.01; | |
| 518 | ui_label = "NTSC RF Noise Frequency"; | |
| 519 | > = 0.30; | |
| 520 | ||
| 521 | uniform float RFNOISE1 < | |
| 522 | ui_category = "RF Noise Options"; | |
| 523 | ui_type = "drag"; | |
| 524 | ui_min = 0.0; | |
| 525 | ui_max = 0.7; | |
| 526 | ui_step = 0.01; | |
| 527 | ui_label = "NTSC RF Noise Luma+"; | |
| 528 | > = 0.01; | |
| 529 | ||
| 530 | uniform float RFNOISE2 < | |
| 531 | ui_category = "RF Noise Options"; | |
| 532 | ui_type = "drag"; | |
| 533 | ui_min = 0.0; | |
| 534 | ui_max = 0.7; | |
| 535 | ui_step = 0.01; | |
| 536 | ui_label = "NTSC RF Noise Chroma+"; | |
| 537 | > = 0.01; | |
| 538 | ||
| 539 | uniform float CSHARPEN < | |
| 540 | ui_category = "FSharpen"; | |
| 541 | ui_type = "drag"; | |
| 542 | ui_min = 0.0; | |
| 543 | ui_max = 5.0; | |
| 544 | ui_step = 0.1; | |
| 545 | ui_label = "FSharpen - Sharpen Strength"; | |
| 546 | > = 0.5; | |
| 547 | ||
| 548 | uniform float CCONTR < | |
| 549 | ui_category = "FSharpen"; | |
| 550 | ui_type = "drag"; | |
| 551 | ui_min = 0.0; | |
| 552 | ui_max = 0.25; | |
| 553 | ui_step = 0.01; | |
| 554 | ui_label = "FSharpen - Sharpen (+ Deb) Contrast"; | |
| 555 | > = 0.05; | |
| 556 | ||
| 557 | uniform float CDETAILS < | |
| 558 | ui_category = "FSharpen"; | |
| 559 | ui_type = "drag"; | |
| 560 | ui_min = 0.0; | |
| 561 | ui_max = 1.0; | |
| 562 | ui_step = 0.05; | |
| 563 | ui_label = "FSharpen - Details sharpened"; | |
| 564 | > = 0.25; | |
| 565 | ||
| 566 | uniform float NDEBLUR < | |
| 567 | ui_category = "FSharpen"; | |
| 568 | ui_type = "drag"; | |
| 569 | ui_min = 1.0; | |
| 570 | ui_max = 8.0; | |
| 571 | ui_step = 0.25; | |
| 572 | ui_label = "FSharpen - Deblur Strength"; | |
| 573 | > = 1.5; | |
| 574 | ||
| 575 | uniform float DSMART < | |
| 576 | ui_category = "FSharpen"; | |
| 577 | ui_type = "drag"; | |
| 578 | ui_min = 0.0; | |
| 579 | ui_max = 1.0; | |
| 580 | ui_step = 1.0; | |
| 581 | ui_label = "FSharpen - Smart 'Dithering' Deblur"; | |
| 582 | > = 1.0; | |
| 583 | ||
| 584 | uniform float DREDGE < | |
| 585 | ui_category = "FSharpen"; | |
| 586 | ui_type = "drag"; | |
| 587 | ui_min = 0.7; | |
| 588 | ui_max = 1.0; | |
| 589 | ui_step = 0.01; | |
| 590 | ui_label = "FSharpen - Deblur Edges Falloff"; | |
| 591 | > = 0.92; | |
| 592 | ||
| 593 | uniform float DSHARP < | |
| 594 | ui_category = "FSharpen"; | |
| 595 | ui_type = "drag"; | |
| 596 | ui_min = 0.0; | |
| 597 | ui_max = 4.0; | |
| 598 | ui_step = 0.2; | |
| 599 | ui_label = "FSharpen - Deblur Extra Sharpen"; | |
| 600 | > = 1.0; | |
| 601 | ||
| 602 | uniform float ADPT_BLK_RANGE < | |
| 603 | ui_category = "crt-black_crush-koko"; | |
| 604 | ui_type = "slider"; | |
| 605 | ui_label = "CRT Black Crush (<0: Darker gamma, >0: Black Crush)"; | |
| 606 | ui_min = -2.0; | |
| 607 | ui_max = 2.0; | |
| 608 | ui_step = 0.1; | |
| 609 | > = 0.05; | |
| 610 | ||
| 611 | uniform float lsmooth < | |
| 612 | ui_category = "Raster Bloom Options"; | |
| 613 | ui_type = "drag"; | |
| 614 | ui_min = 0.5; | |
| 615 | ui_max = 1.0; | |
| 616 | ui_step = 0.01; | |
| 617 | ui_label = "Raster Bloom Effect Smoothing"; | |
| 618 | > = 0.75; | |
| 619 | ||
| 620 | uniform float lsdev < | |
| 621 | ui_category = "Raster Bloom Options"; | |
| 622 | ui_type = "drag"; | |
| 623 | ui_min = -0.25; | |
| 624 | ui_max = 0.25; | |
| 625 | ui_step = 0.01; | |
| 626 | ui_label = "Raster Bloom Smoothing Bright Deviation"; | |
| 627 | > = 0.05; | |
| 628 | ||
| 629 | uniform float OS < | |
| 630 | ui_category = "Raster Bloom Options"; | |
| 631 | ui_type = "drag"; | |
| 632 | ui_min = 0.0; | |
| 633 | ui_max = 2.0; | |
| 634 | ui_step = 1.0; | |
| 635 | ui_label = "R. Bloom Overscan Mode"; | |
| 636 | > = 1.0; | |
| 637 | ||
| 638 | uniform float blm_2 < | |
| 639 | ui_category = "Raster Bloom Options"; | |
| 640 | ui_type = "drag"; | |
| 641 | ui_min = 0.0; | |
| 642 | ui_max = 20.0; | |
| 643 | ui_step = 1.0; | |
| 644 | ui_label = "Raster bloom %"; | |
| 645 | > = 1.0; | |
| 646 | ||
| 647 | uniform float gamma_i < | |
| 648 | ui_category = "Gamma Options"; | |
| 649 | ui_type = "drag"; | |
| 650 | ui_min = 1.0; | |
| 651 | ui_max = 5.0; | |
| 652 | ui_step = 0.05; | |
| 653 | ui_label = "Gamma Input"; | |
| 654 | > = 2.20; | |
| 655 | ||
| 656 | uniform float gamma_o < | |
| 657 | ui_category = "Gamma Options"; | |
| 658 | ui_type = "drag"; | |
| 659 | ui_min = 1.0; | |
| 660 | ui_max = 5.0; | |
| 661 | ui_step = 0.05; | |
| 662 | ui_label = "Gamma out"; | |
| 663 | > = 2.20; | |
| 664 | ||
| 665 | uniform float HSHARPNESS < | |
| 666 | ui_category = "Filtering Options"; | |
| 667 | ui_type = "drag"; | |
| 668 | ui_min = 1.0; | |
| 669 | ui_max = 8.0; | |
| 670 | ui_step = 0.05; | |
| 671 | ui_label = "Horizontal Filter Range"; | |
| 672 | > = 1.55; | |
| 673 | ||
| 674 | uniform float LIGMA_H < | |
| 675 | ui_category = "Filtering Options"; | |
| 676 | ui_type = "drag"; | |
| 677 | ui_min = 0.15; | |
| 678 | ui_max = 1.0; | |
| 679 | ui_step = 0.01; | |
| 680 | ui_label = "Horizontal Blur Sigma"; | |
| 681 | > = 0.55; | |
| 682 | ||
| 683 | uniform float S_SHARP < | |
| 684 | ui_category = "Filtering Options"; | |
| 685 | ui_type = "drag"; | |
| 686 | ui_min = 0.0; | |
| 687 | ui_max = 3.0; | |
| 688 | ui_step = 0.05; | |
| 689 | ui_label = "Substractive Sharpness"; | |
| 690 | > = 0.4; | |
| 691 | ||
| 692 | uniform float MAXS < | |
| 693 | ui_category = "Filtering Options"; | |
| 694 | ui_type = "drag"; | |
| 695 | ui_min = 0.0; | |
| 696 | ui_max = 0.3; | |
| 697 | ui_step = 0.01; | |
| 698 | ui_label = "Maximum Sharpness"; | |
| 699 | > = 0.05; | |
| 700 | ||
| 701 | uniform float SSRNG < | |
| 702 | ui_category = "Filtering Options"; | |
| 703 | ui_type = "drag"; | |
| 704 | ui_min = 0.0; | |
| 705 | ui_max = 4.0; | |
| 706 | ui_step = 0.05; | |
| 707 | ui_label = "Substractive Sharpness Ringing"; | |
| 708 | > = 0.15; | |
| 709 | ||
| 710 | uniform float spike < | |
| 711 | ui_category = "Filtering Options"; | |
| 712 | ui_type = "drag"; | |
| 713 | ui_min = 0.0; | |
| 714 | ui_max = 2.0; | |
| 715 | ui_step = 0.1; | |
| 716 | ui_label = "Scanline Spike Removal"; | |
| 717 | > = 0.9; | |
| 718 | ||
| 719 | uniform float m_glow < | |
| 720 | ui_category = "Magic Glow Settings"; | |
| 721 | ui_type = "drag"; | |
| 722 | ui_min = 0.0; | |
| 723 | ui_max = 2.0; | |
| 724 | ui_step = 1.0; | |
| 725 | ui_label = "Ordinary Glow | Magic Glow"; | |
| 726 | > = 2.0; | |
| 727 | ||
| 728 | uniform float m_glow_cutoff < | |
| 729 | ui_category = "Magic Glow Settings"; | |
| 730 | ui_type = "drag"; | |
| 731 | ui_min = 0.0; | |
| 732 | ui_max = 0.4; | |
| 733 | ui_step = 0.01; | |
| 734 | ui_label = "Magic Glow Cutoff"; | |
| 735 | > = 0.12; | |
| 736 | ||
| 737 | uniform float m_glow_low < | |
| 738 | ui_category = "Magic Glow Settings"; | |
| 739 | ui_type = "drag"; | |
| 740 | ui_min = 0.0; | |
| 741 | ui_max = 7.0; | |
| 742 | ui_step = 0.05; | |
| 743 | ui_label = "Magic Glow Low Strength"; | |
| 744 | > = 5.00; | |
| 745 | ||
| 746 | uniform float m_glow_high < | |
| 747 | ui_category = "Magic Glow Settings"; | |
| 748 | ui_type = "drag"; | |
| 749 | ui_min = 0.0; | |
| 750 | ui_max = 7.0; | |
| 751 | ui_step = 0.1; | |
| 752 | ui_label = "Magic Glow High Strength"; | |
| 753 | > = 5.0; | |
| 754 | ||
| 755 | uniform float m_glow_dist < | |
| 756 | ui_category = "Magic Glow Settings"; | |
| 757 | ui_type = "drag"; | |
| 758 | ui_min = 0.2; | |
| 759 | ui_max = 4.0; | |
| 760 | ui_step = 0.05; | |
| 761 | ui_label = "Magic Glow Distribution"; | |
| 762 | > = 0.7; | |
| 763 | ||
| 764 | uniform float m_glow_mask < | |
| 765 | ui_category = "Magic Glow Settings"; | |
| 766 | ui_type = "drag"; | |
| 767 | ui_min = 0.0; | |
| 768 | ui_max = 2.0; | |
| 769 | ui_step = 0.025; | |
| 770 | ui_label = "Magic Glow Mask Strength"; | |
| 771 | > = 0.6; | |
| 772 | ||
| 773 | uniform float FINE_GAUSS < | |
| 774 | ui_category = "Magic Glow Settings"; | |
| 775 | ui_type = "drag"; | |
| 776 | ui_min = -1.0; | |
| 777 | ui_max = 5.0; | |
| 778 | ui_step = 1.0; | |
| 779 | ui_label = "Fine Glow/M.Glow Sampling"; | |
| 780 | > = 5.0; | |
| 781 | ||
| 782 | uniform float SIZEH < | |
| 783 | ui_category = "Glow Pass Settings"; | |
| 784 | ui_type = "drag"; | |
| 785 | ui_min = 1.0; | |
| 786 | ui_max = 50.0; | |
| 787 | ui_step = 1.0; | |
| 788 | ui_label = "Horizontal Glow Radius"; | |
| 789 | > = 6.0; | |
| 790 | ||
| 791 | uniform float SIGMA_H < | |
| 792 | ui_category = "Glow Pass Settings"; | |
| 793 | ui_type = "drag"; | |
| 794 | ui_min = 0.2; | |
| 795 | ui_max = 15.0; | |
| 796 | ui_step = 0.05; | |
| 797 | ui_label = "Horizontal Glow Sigma"; | |
| 798 | > = 1.2; | |
| 799 | ||
| 800 | uniform float SIZEV < | |
| 801 | ui_category = "Glow Pass Settings"; | |
| 802 | ui_type = "drag"; | |
| 803 | ui_min = 1.0; | |
| 804 | ui_max = 50.0; | |
| 805 | ui_step = 1.0; | |
| 806 | ui_label = "Vertical Glow Radius"; | |
| 807 | > = 6.0; | |
| 808 | ||
| 809 | uniform float SIGMA_V < | |
| 810 | ui_category = "Glow Pass Settings"; | |
| 811 | ui_type = "drag"; | |
| 812 | ui_min = 0.2; | |
| 813 | ui_max = 15.0; | |
| 814 | ui_step = 0.05; | |
| 815 | ui_label = "Vertical Glow Sigma"; | |
| 816 | > = 1.2; | |
| 817 | ||
| 818 | uniform float FINE_BLOOM < | |
| 819 | ui_category = "Bloom/Halation (Glow) Pass Settings"; | |
| 820 | ui_type = "drag"; | |
| 821 | ui_min = -1.0; | |
| 822 | ui_max = 5.0; | |
| 823 | ui_step = 1.0; | |
| 824 | ui_label = "Fine Bloom/Halation Sampling"; | |
| 825 | > = 3.0; | |
| 826 | ||
| 827 | uniform float SIZEX < | |
| 828 | ui_category = "Bloom/Halation (Glow) Pass Settings"; | |
| 829 | ui_type = "drag"; | |
| 830 | ui_min = 1.0; | |
| 831 | ui_max = 50.0; | |
| 832 | ui_step = 1.0; | |
| 833 | ui_label = "Horizontal Bloom/Halation Radius"; | |
| 834 | > = 3.0; | |
| 835 | ||
| 836 | uniform float SIGMA_X < | |
| 837 | ui_category = "Bloom/Halation (Glow) Pass Settings"; | |
| 838 | ui_type = "drag"; | |
| 839 | ui_min = 0.25; | |
| 840 | ui_max = 3.0; | |
| 841 | ui_step = 0.01; | |
| 842 | ui_label = "Horizontal Bloom/Halation Sigma"; | |
| 843 | > = 0.75; | |
| 844 | ||
| 845 | uniform float SIZEY < | |
| 846 | ui_category = "Bloom/Halation (Glow) Pass Settings"; | |
| 847 | ui_type = "drag"; | |
| 848 | ui_min = 1.0; | |
| 849 | ui_max = 50.0; | |
| 850 | ui_step = 1.0; | |
| 851 | ui_label = "Vertical Bloom/Halation Radius"; | |
| 852 | > = 3.0; | |
| 853 | ||
| 854 | uniform float SIGMA_Y < | |
| 855 | ui_category = "Bloom/Halation (Glow) Pass Settings"; | |
| 856 | ui_type = "drag"; | |
| 857 | ui_min = 0.25; | |
| 858 | ui_max = 15.0; | |
| 859 | ui_step = 0.025; | |
| 860 | ui_label = "Vertical Bloom/Halation Sigma"; | |
| 861 | > = 0.60; | |
| 862 | ||
| 863 | uniform float glow < | |
| 864 | ui_category = "Brightness Settings"; | |
| 865 | ui_type = "drag"; | |
| 866 | ui_min = -2.0; | |
| 867 | ui_max = 2.0; | |
| 868 | ui_step = 0.01; | |
| 869 | ui_label = "(Magic) Glow Strength"; | |
| 870 | > = 0.10; | |
| 871 | ||
| 872 | uniform float blm_1 < | |
| 873 | ui_category = "Brightness Settings"; | |
| 874 | ui_type = "drag"; | |
| 875 | ui_min = -2.0; | |
| 876 | ui_max = 2.0; | |
| 877 | ui_step = 0.05; | |
| 878 | ui_label = "Bloom Strength"; | |
| 879 | > = 0.10; | |
| 880 | ||
| 881 | uniform float mask_bloom < | |
| 882 | ui_category = "Brightness Settings"; | |
| 883 | ui_type = "drag"; | |
| 884 | ui_min = -2.0; | |
| 885 | ui_max = 2.0; | |
| 886 | ui_step = 0.05; | |
| 887 | ui_label = "Mask Bloom"; | |
| 888 | > = 0.5; | |
| 889 | ||
| 890 | uniform float bloom_dist < | |
| 891 | ui_category = "Brightness Settings"; | |
| 892 | ui_type = "drag"; | |
| 893 | ui_min = -2.0; | |
| 894 | ui_max = 3.0; | |
| 895 | ui_step = 0.05; | |
| 896 | ui_label = "Bloom Distribution"; | |
| 897 | > = 0.05; | |
| 898 | ||
| 899 | uniform float halation < | |
| 900 | ui_category = "Brightness Settings"; | |
| 901 | ui_type = "drag"; | |
| 902 | ui_min = -2.0; | |
| 903 | ui_max = 2.0; | |
| 904 | ui_step = 0.025; | |
| 905 | ui_label = "Halation Strength"; | |
| 906 | > = -0.1; | |
| 907 | ||
| 908 | uniform float b_mask < | |
| 909 | ui_category = "Brightness Settings"; | |
| 910 | ui_type = "drag"; | |
| 911 | ui_min = -1.0; | |
| 912 | ui_max = 1.0; | |
| 913 | ui_step = 0.025; | |
| 914 | ui_label = "Bloom Mask Strength"; | |
| 915 | > = -0.1; | |
| 916 | ||
| 917 | uniform float h_mask < | |
| 918 | ui_category = "Brightness Settings"; | |
| 919 | ui_type = "drag"; | |
| 920 | ui_min = -1.0; | |
| 921 | ui_max = 1.0; | |
| 922 | ui_step = 0.025; | |
| 923 | ui_label = "Halation Mask Strength"; | |
| 924 | > = -0.75; | |
| 925 | ||
| 926 | uniform float gamma_c < | |
| 927 | ui_category = "Brightness Settings"; | |
| 928 | ui_type = "drag"; | |
| 929 | ui_min = 0.5; | |
| 930 | ui_max = 2.0; | |
| 931 | ui_step = 0.025; | |
| 932 | ui_label = "Gamma correct"; | |
| 933 | > = 1.025; | |
| 934 | ||
| 935 | uniform float gamma_d < | |
| 936 | ui_category = "Brightness Settings"; | |
| 937 | ui_type = "drag"; | |
| 938 | ui_min = 1.0; | |
| 939 | ui_max = 2.0; | |
| 940 | ui_step = 0.025; | |
| 941 | ui_label = "Complementary Gamma Correct"; | |
| 942 | > = 1.15; | |
| 943 | ||
| 944 | uniform float brightboost1 < | |
| 945 | ui_category = "Brightness Settings"; | |
| 946 | ui_type = "drag"; | |
| 947 | ui_min = 0.25; | |
| 948 | ui_max = 10.0; | |
| 949 | ui_step = 0.05; | |
| 950 | ui_label = "Bright Boost Dark Pixels"; | |
| 951 | > = 1.4; | |
| 952 | ||
| 953 | uniform float brightboost2 < | |
| 954 | ui_category = "Brightness Settings"; | |
| 955 | ui_type = "drag"; | |
| 956 | ui_min = 0.25; | |
| 957 | ui_max = 3.0; | |
| 958 | ui_step = 0.025; | |
| 959 | ui_label = "Bright Boost Bright Pixels"; | |
| 960 | > = 1.1; | |
| 961 | ||
| 962 | uniform float clp < | |
| 963 | ui_category = "Brightness Settings"; | |
| 964 | ui_type = "drag"; | |
| 965 | ui_min = -1.0; | |
| 966 | ui_max = 1.0; | |
| 967 | ui_step = 0.05; | |
| 968 | ui_label = "Clip Saturated Color Beams"; | |
| 969 | > = 0.25; | |
| 970 | ||
| 971 | uniform float bloomsamp < | |
| 972 | ui_category = "Brightness Settings"; | |
| 973 | ui_type = "drag"; | |
| 974 | ui_min = 0.0; | |
| 975 | ui_max = 2.0; | |
| 976 | ui_step = 1.0; | |
| 977 | ui_label = "Bloom Pixel Sampling"; | |
| 978 | > = 2.0; | |
| 979 | ||
| 980 | uniform float gsl < | |
| 981 | ui_category = "Scanline Options"; | |
| 982 | ui_type = "drag"; | |
| 983 | ui_min = -1.0; | |
| 984 | ui_max = 2.0; | |
| 985 | ui_step = 1.0; | |
| 986 | ui_label = "Scanline Type"; | |
| 987 | > = 2.0; | |
| 988 | ||
| 989 | uniform float scanline1 < | |
| 990 | ui_category = "Scanline Options"; | |
| 991 | ui_type = "drag"; | |
| 992 | ui_min = -20.0; | |
| 993 | ui_max = 40.0; | |
| 994 | ui_step = 0.5; | |
| 995 | ui_label = "Scanline Beam Shape Center"; | |
| 996 | > = 8.0; | |
| 997 | ||
| 998 | uniform float scanline2 < | |
| 999 | ui_category = "Scanline Options"; | |
| 1000 | ui_type = "drag"; | |
| 1001 | ui_min = 0.0; | |
| 1002 | ui_max = 70.0; | |
| 1003 | ui_step = 1.0; | |
| 1004 | ui_label = "Scanline Beam Shape Edges"; | |
| 1005 | > = 4.0; | |
| 1006 | ||
| 1007 | uniform float beam_min < | |
| 1008 | ui_category = "Scanline Options"; | |
| 1009 | ui_type = "drag"; | |
| 1010 | ui_min = 0.25; | |
| 1011 | ui_max = 10.0; | |
| 1012 | ui_step = 0.05; | |
| 1013 | ui_label = "Scanline Shape Dark Pixels"; | |
| 1014 | > = 3.0; | |
| 1015 | ||
| 1016 | uniform float beam_max < | |
| 1017 | ui_category = "Scanline Options"; | |
| 1018 | ui_type = "drag"; | |
| 1019 | ui_min = 0.2; | |
| 1020 | ui_max = 3.5; | |
| 1021 | ui_step = 0.025; | |
| 1022 | ui_label = "Scanline Shape Bright Pixels"; | |
| 1023 | > = 1.0; | |
| 1024 | ||
| 1025 | uniform float tds < | |
| 1026 | ui_category = "Scanline Options"; | |
| 1027 | ui_type = "drag"; | |
| 1028 | ui_min = 0.0; | |
| 1029 | ui_max = 1.0; | |
| 1030 | ui_step = 1.0; | |
| 1031 | ui_label = "Thinner Dark Scanlines"; | |
| 1032 | > = 0.0; | |
| 1033 | ||
| 1034 | uniform float beam_size < | |
| 1035 | ui_category = "Scanline Options"; | |
| 1036 | ui_type = "drag"; | |
| 1037 | ui_min = 0.0; | |
| 1038 | ui_max = 1.0; | |
| 1039 | ui_step = 0.05; | |
| 1040 | ui_label = "Increased Bright Scanline Beam"; | |
| 1041 | > = 0.5; | |
| 1042 | ||
| 1043 | uniform float scans < | |
| 1044 | ui_category = "Scanline Options"; | |
| 1045 | ui_type = "drag"; | |
| 1046 | ui_min = 0.0; | |
| 1047 | ui_max = 6.0; | |
| 1048 | ui_step = 0.1; | |
| 1049 | ui_label = "Scanline Saturation / Mask Falloff"; | |
| 1050 | > = 0.7; | |
| 1051 | ||
| 1052 | uniform float scan_falloff < | |
| 1053 | ui_category = "Scanline Options"; | |
| 1054 | ui_type = "drag"; | |
| 1055 | ui_min = 0.1; | |
| 1056 | ui_max = 2.0; | |
| 1057 | ui_step = 0.025; | |
| 1058 | ui_label = "Scanline Falloff"; | |
| 1059 | > = 0.2; | |
| 1060 | ||
| 1061 | uniform float ssharp < | |
| 1062 | ui_category = "Scanline Options"; | |
| 1063 | ui_type = "drag"; | |
| 1064 | ui_min = 0.0; | |
| 1065 | ui_max = 0.5; | |
| 1066 | ui_step = 0.01; | |
| 1067 | ui_label = "Smart Sharpen Scanlines"; | |
| 1068 | > = 0.01; | |
| 1069 | ||
| 1070 | uniform float scangamma < | |
| 1071 | ui_category = "Scanline Options"; | |
| 1072 | ui_type = "drag"; | |
| 1073 | ui_min = 0.5; | |
| 1074 | ui_max = 5.0; | |
| 1075 | ui_step = 0.05; | |
| 1076 | ui_label = "Scanline Gamma"; | |
| 1077 | > = 2.4; | |
| 1078 | ||
| 1079 | uniform float rolling_scan < | |
| 1080 | ui_category = "Scanline Options"; | |
| 1081 | ui_type = "drag"; | |
| 1082 | ui_min = -1.0; | |
| 1083 | ui_max = 1.0; | |
| 1084 | ui_step = 0.01; | |
| 1085 | ui_label = "Rolling Scanlines"; | |
| 1086 | > = 0.0; | |
| 1087 | ||
| 1088 | uniform float no_scanlines < | |
| 1089 | ui_category = "Scanline Options"; | |
| 1090 | ui_type = "drag"; | |
| 1091 | ui_min = 0.0; | |
| 1092 | ui_max = 1.5; | |
| 1093 | ui_step = 0.05; | |
| 1094 | ui_label = "No-scanline Mode"; | |
| 1095 | > = 0.0; | |
| 1096 | ||
| 1097 | uniform float IOS < | |
| 1098 | ui_category = "Screen Options"; | |
| 1099 | ui_type = "drag"; | |
| 1100 | ui_min = 0.0; | |
| 1101 | ui_max = 4.0; | |
| 1102 | ui_step = 1.0; | |
| 1103 | ui_label = "Integer Scaling: Odd:Y | Even:'X'+Y"; | |
| 1104 | > = 0.0; | |
| 1105 | ||
| 1106 | uniform float warpx < | |
| 1107 | ui_category = "Screen Options"; | |
| 1108 | ui_type = "drag"; | |
| 1109 | ui_min = 0.0; | |
| 1110 | ui_max = 0.25; | |
| 1111 | ui_step = 0.01; | |
| 1112 | ui_label = "Curvature X (Default 0.03)"; | |
| 1113 | > = 0.0; | |
| 1114 | ||
| 1115 | uniform float warpy < | |
| 1116 | ui_category = "Screen Options"; | |
| 1117 | ui_type = "drag"; | |
| 1118 | ui_min = 0.0; | |
| 1119 | ui_max = 0.25; | |
| 1120 | ui_step = 0.01; | |
| 1121 | ui_label = "Curvature Y (Default 0.04)"; | |
| 1122 | > = 0.0; | |
| 1123 | ||
| 1124 | uniform float c_shape < | |
| 1125 | ui_category = "Screen Options"; | |
| 1126 | ui_type = "drag"; | |
| 1127 | ui_min = 0.05; | |
| 1128 | ui_max = 0.6; | |
| 1129 | ui_step = 0.05; | |
| 1130 | ui_label = "Curvature Shape"; | |
| 1131 | > = 0.25; | |
| 1132 | ||
| 1133 | uniform float cbulge < | |
| 1134 | ui_category = "Screen Options"; | |
| 1135 | ui_type = "drag"; | |
| 1136 | ui_min = 0.0; | |
| 1137 | ui_max = 1.0; | |
| 1138 | ui_step = 0.05; | |
| 1139 | ui_label = "Curvature 3D Effect"; | |
| 1140 | > = 0.25; | |
| 1141 | ||
| 1142 | uniform float overscanx < | |
| 1143 | ui_category = "Screen Options"; | |
| 1144 | ui_type = "drag"; | |
| 1145 | ui_min = -200.0; | |
| 1146 | ui_max = 200.0; | |
| 1147 | ui_step = 1.0; | |
| 1148 | ui_label = "Overscan X original Pixels"; | |
| 1149 | > = 0.0; | |
| 1150 | ||
| 1151 | uniform float overscany < | |
| 1152 | ui_category = "Screen Options"; | |
| 1153 | ui_type = "drag"; | |
| 1154 | ui_min = -200.0; | |
| 1155 | ui_max = 200.0; | |
| 1156 | ui_step = 1.0; | |
| 1157 | ui_label = "Overscan Y original Pixels"; | |
| 1158 | > = 0.0; | |
| 1159 | ||
| 1160 | uniform float VShift < | |
| 1161 | ui_category = "Screen Options"; | |
| 1162 | ui_type = "drag"; | |
| 1163 | ui_min = -200.0; | |
| 1164 | ui_max = 200.0; | |
| 1165 | ui_step = 1.0; | |
| 1166 | ui_label = "Vertical shift Y original pixels"; | |
| 1167 | > = 0.0; | |
| 1168 | ||
| 1169 | uniform float csize < | |
| 1170 | ui_category = "Screen Options"; | |
| 1171 | ui_type = "drag"; | |
| 1172 | ui_min = 0.0; | |
| 1173 | ui_max = 0.35; | |
| 1174 | ui_step = 0.01; | |
| 1175 | ui_label = "Corner Size"; | |
| 1176 | > = 0.0; | |
| 1177 | ||
| 1178 | uniform float bsize < | |
| 1179 | ui_category = "Screen Options"; | |
| 1180 | ui_type = "drag"; | |
| 1181 | ui_min = 0.0; | |
| 1182 | ui_max = 2.0; | |
| 1183 | ui_step = 0.01; | |
| 1184 | ui_label = "Border Size"; | |
| 1185 | > = 0.0; | |
| 1186 | ||
| 1187 | uniform float sborder < | |
| 1188 | ui_category = "Screen Options"; | |
| 1189 | ui_type = "drag"; | |
| 1190 | ui_min = 0.25; | |
| 1191 | ui_max = 2.0; | |
| 1192 | ui_step = 0.05; | |
| 1193 | ui_label = "Border Intensity"; | |
| 1194 | > = 0.75; | |
| 1195 | ||
| 1196 | uniform float barspeed < | |
| 1197 | ui_category = "Screen Options"; | |
| 1198 | ui_type = "drag"; | |
| 1199 | ui_min = 5.0; | |
| 1200 | ui_max = 200.0; | |
| 1201 | ui_step = 1.0; | |
| 1202 | ui_label = "Hum Bar Speed"; | |
| 1203 | > = 50.0; | |
| 1204 | ||
| 1205 | uniform float barintensity < | |
| 1206 | ui_category = "Screen Options"; | |
| 1207 | ui_type = "drag"; | |
| 1208 | ui_min = -1.0; | |
| 1209 | ui_max = 1.0; | |
| 1210 | ui_step = 0.01; | |
| 1211 | ui_label = "Hum Bar Intensity"; | |
| 1212 | > = 0.0; | |
| 1213 | ||
| 1214 | uniform float bardir < | |
| 1215 | ui_category = "Screen Options"; | |
| 1216 | ui_type = "drag"; | |
| 1217 | ui_min = 0.0; | |
| 1218 | ui_max = 1.0; | |
| 1219 | ui_step = 1.0; | |
| 1220 | ui_label = "Hum Bar Direction"; | |
| 1221 | > = 0.0; | |
| 1222 | ||
| 1223 | uniform float shadow_msk < | |
| 1224 | ui_category = "CRT Mask Options"; | |
| 1225 | ui_type = "drag"; | |
| 1226 | ui_min = -1.0; | |
| 1227 | ui_max = 14.0; | |
| 1228 | ui_step = 1.0; | |
| 1229 | ui_label = "CRT Mask: 0:CGWG | 1-4:Lottes | 5-14:'Trinitron'"; | |
| 1230 | > = 6.0; | |
| 1231 | ||
| 1232 | uniform float maskstr < | |
| 1233 | ui_category = "CRT Mask Options"; | |
| 1234 | ui_type = "drag"; | |
| 1235 | ui_min = -0.5; | |
| 1236 | ui_max = 1.0; | |
| 1237 | ui_step = 0.025; | |
| 1238 | ui_label = "Mask Strength (0, 5-14)"; | |
| 1239 | > = 0.7; | |
| 1240 | ||
| 1241 | uniform float mcut < | |
| 1242 | ui_category = "CRT Mask Options"; | |
| 1243 | ui_type = "drag"; | |
| 1244 | ui_min = 0.0; | |
| 1245 | ui_max = 2.0; | |
| 1246 | ui_step = 0.05; | |
| 1247 | ui_label = "Mask 5-14 Low Strength"; | |
| 1248 | > = 1.05; | |
| 1249 | ||
| 1250 | uniform float maskboost < | |
| 1251 | ui_category = "CRT Mask Options"; | |
| 1252 | ui_type = "drag"; | |
| 1253 | ui_min = 1.0; | |
| 1254 | ui_max = 3.0; | |
| 1255 | ui_step = 0.05; | |
| 1256 | ui_label = "CRT Mask Boost"; | |
| 1257 | > = 2.0; | |
| 1258 | ||
| 1259 | uniform float masksize < | |
| 1260 | ui_category = "CRT Mask Options"; | |
| 1261 | ui_type = "drag"; | |
| 1262 | ui_min = 1.0; | |
| 1263 | ui_max = 4.0; | |
| 1264 | ui_step = 1.0; | |
| 1265 | ui_label = "CRT Mask Size"; | |
| 1266 | > = 1.0; | |
| 1267 | ||
| 1268 | uniform float mask_zoom < | |
| 1269 | ui_category = "CRT Mask Options"; | |
| 1270 | ui_type = "drag"; | |
| 1271 | ui_min = -10.0; | |
| 1272 | ui_max = 6.0; | |
| 1273 | ui_step = 1.0; | |
| 1274 | ui_label = "CRT Mask Zoom (+ mask width)"; | |
| 1275 | > = 0.0; | |
| 1276 | ||
| 1277 | uniform float zoom_mask < | |
| 1278 | ui_category = "CRT Mask Options"; | |
| 1279 | ui_type = "drag"; | |
| 1280 | ui_min = 0.0; | |
| 1281 | ui_max = 1.0; | |
| 1282 | ui_step = 0.05; | |
| 1283 | ui_label = "CRT Mask Zoom Sharpen (needs Mask Zoom)"; | |
| 1284 | > = 0.0; | |
| 1285 | ||
| 1286 | uniform float mshift < | |
| 1287 | ui_category = "CRT Mask Options"; | |
| 1288 | ui_type = "drag"; | |
| 1289 | ui_min = 0.0; | |
| 1290 | ui_max = 1.0; | |
| 1291 | ui_step = 0.5; | |
| 1292 | ui_label = "(Transform to) Shadow Mask"; | |
| 1293 | > = 0.5; | |
| 1294 | ||
| 1295 | uniform float mask_layout < | |
| 1296 | ui_category = "CRT Mask Options"; | |
| 1297 | ui_type = "drag"; | |
| 1298 | ui_min = 0.0; | |
| 1299 | ui_max = 1.0; | |
| 1300 | ui_step = 1.0; | |
| 1301 | ui_label = "Mask Layout Sequence: RGB or BGR (check LCD panel)"; | |
| 1302 | > = 0.0; | |
| 1303 | ||
| 1304 | uniform float laysh < | |
| 1305 | ui_category = "CRT Mask Options"; | |
| 1306 | ui_type = "drag"; | |
| 1307 | ui_min = -1.0; | |
| 1308 | ui_max = 1.0; | |
| 1309 | ui_step = 1.0; | |
| 1310 | ui_label = "Mask Layout Shift: GBR, RGB, BRG | GRB, RBG, BGR"; | |
| 1311 | > = 0.0; | |
| 1312 | ||
| 1313 | uniform float mask_drk < | |
| 1314 | ui_category = "CRT Mask Options"; | |
| 1315 | ui_type = "drag"; | |
| 1316 | ui_min = 0.0; | |
| 1317 | ui_max = 2.0; | |
| 1318 | ui_step = 0.05; | |
| 1319 | ui_label = "Lottes maskDark"; | |
| 1320 | > = 0.5; | |
| 1321 | ||
| 1322 | uniform float mask_lgt < | |
| 1323 | ui_category = "CRT Mask Options"; | |
| 1324 | ui_type = "drag"; | |
| 1325 | ui_min = 0.0; | |
| 1326 | ui_max = 2.0; | |
| 1327 | ui_step = 0.05; | |
| 1328 | ui_label = "Lottes maskBright"; | |
| 1329 | > = 1.5; | |
| 1330 | ||
| 1331 | uniform float mask_gamma < | |
| 1332 | ui_category = "CRT Mask Options"; | |
| 1333 | ui_type = "drag"; | |
| 1334 | ui_min = 1.0; | |
| 1335 | ui_max = 5.0; | |
| 1336 | ui_step = 0.05; | |
| 1337 | ui_label = "Mask gamma"; | |
| 1338 | > = 2.4; | |
| 1339 | ||
| 1340 | uniform float slotmask1 < | |
| 1341 | ui_category = "CRT Mask Options"; | |
| 1342 | ui_type = "drag"; | |
| 1343 | ui_min = 0.0; | |
| 1344 | ui_max = 1.0; | |
| 1345 | ui_step = 0.05; | |
| 1346 | ui_label = "Slot Mask Strength Bright Pixels"; | |
| 1347 | > = 0.1; | |
| 1348 | ||
| 1349 | uniform float slotmask2 < | |
| 1350 | ui_category = "CRT Mask Options"; | |
| 1351 | ui_type = "drag"; | |
| 1352 | ui_min = 0.0; | |
| 1353 | ui_max = 1.0; | |
| 1354 | ui_step = 0.05; | |
| 1355 | ui_label = "Slot Mask Strength Dark Pixels"; | |
| 1356 | > = 0.2; | |
| 1357 | ||
| 1358 | uniform float slotwidth < | |
| 1359 | ui_category = "CRT Mask Options"; | |
| 1360 | ui_type = "drag"; | |
| 1361 | ui_min = 0.0; | |
| 1362 | ui_max = 16.0; | |
| 1363 | ui_step = 1.0; | |
| 1364 | ui_label = "Slot Mask Width (0:Auto)"; | |
| 1365 | > = 0.0; | |
| 1366 | ||
| 1367 | uniform float double_slot < | |
| 1368 | ui_category = "CRT Mask Options"; | |
| 1369 | ui_type = "drag"; | |
| 1370 | ui_min = 1.0; | |
| 1371 | ui_max = 4.0; | |
| 1372 | ui_step = 1.0; | |
| 1373 | ui_label = "Slot Mask Height: 2x1 or 4x1..."; | |
| 1374 | > = 2.0; | |
| 1375 | ||
| 1376 | uniform float slotms < | |
| 1377 | ui_category = "CRT Mask Options"; | |
| 1378 | ui_type = "drag"; | |
| 1379 | ui_min = 1.0; | |
| 1380 | ui_max = 4.0; | |
| 1381 | ui_step = 1.0; | |
| 1382 | ui_label = "Slot Mask Thickness"; | |
| 1383 | > = 1.0; | |
| 1384 | ||
| 1385 | uniform float smoothmask < | |
| 1386 | ui_category = "CRT Mask Options"; | |
| 1387 | ui_type = "drag"; | |
| 1388 | ui_min = 0.0; | |
| 1389 | ui_max = 2.0; | |
| 1390 | ui_step = 0.25; | |
| 1391 | ui_label = "Smooth Masks in bright scanlines"; | |
| 1392 | > = 0.25; | |
| 1393 | ||
| 1394 | uniform float smask_mit < | |
| 1395 | ui_category = "CRT Mask Options"; | |
| 1396 | ui_type = "drag"; | |
| 1397 | ui_min = 0.0; | |
| 1398 | ui_max = 1.0; | |
| 1399 | ui_step = 0.05; | |
| 1400 | ui_label = "Mitigate Slot Mask Interaction"; | |
| 1401 | > = 0.5; | |
| 1402 | ||
| 1403 | uniform float bmask < | |
| 1404 | ui_category = "CRT Mask Options"; | |
| 1405 | ui_type = "drag"; | |
| 1406 | ui_min = 0.0; | |
| 1407 | ui_max = 0.25; | |
| 1408 | ui_step = 0.01; | |
| 1409 | ui_label = "Base (black) Mask Strength"; | |
| 1410 | > = 0.001; | |
| 1411 | ||
| 1412 | uniform float mclip < | |
| 1413 | ui_category = "CRT Mask Options"; | |
| 1414 | ui_type = "drag"; | |
| 1415 | ui_min = 0.0; | |
| 1416 | ui_max = 1.0; | |
| 1417 | ui_step = 0.025; | |
| 1418 | ui_label = "Preserve Mask Strength"; | |
| 1419 | > = 0.05; | |
| 1420 | ||
| 1421 | uniform float pr_scan < | |
| 1422 | ui_category = "CRT Mask Options"; | |
| 1423 | ui_type = "drag"; | |
| 1424 | ui_min = 0.0; | |
| 1425 | ui_max = 1.0; | |
| 1426 | ui_step = 0.025; | |
| 1427 | ui_label = "Preserve Scanline Properties"; | |
| 1428 | > = 0.125; | |
| 1429 | ||
| 1430 | uniform float edgemask < | |
| 1431 | ui_category = "CRT Mask Options"; | |
| 1432 | ui_type = "drag"; | |
| 1433 | ui_min = 0.0; | |
| 1434 | ui_max = 1.0; | |
| 1435 | ui_step = 0.1; | |
| 1436 | ui_label = "Mitigate Mask on Edges"; | |
| 1437 | > = 0.5; | |
| 1438 | ||
| 1439 | uniform float dctypex < | |
| 1440 | ui_category = "Deconvergence Options"; | |
| 1441 | ui_type = "drag"; | |
| 1442 | ui_min = 0.0; | |
| 1443 | ui_max = 0.75; | |
| 1444 | ui_step = 0.05; | |
| 1445 | ui_label = "Deconvergence Type X: 0:static | Other:dynamic"; | |
| 1446 | > = 0.15; | |
| 1447 | ||
| 1448 | uniform float dctypey < | |
| 1449 | ui_category = "Deconvergence Options"; | |
| 1450 | ui_type = "drag"; | |
| 1451 | ui_min = 0.0; | |
| 1452 | ui_max = 0.75; | |
| 1453 | ui_step = 0.05; | |
| 1454 | ui_label = "Deconvergence Type Y: 0:Static | Other:Dynamic"; | |
| 1455 | > = 0.15; | |
| 1456 | ||
| 1457 | uniform float deconrx < | |
| 1458 | ui_category = "Deconvergence Options"; | |
| 1459 | ui_type = "drag"; | |
| 1460 | ui_min = -15.0; | |
| 1461 | ui_max = 15.0; | |
| 1462 | ui_step = 0.25; | |
| 1463 | ui_label = "Horizontal Deconvergence Red Range"; | |
| 1464 | > = 1.0; | |
| 1465 | ||
| 1466 | uniform float decongx < | |
| 1467 | ui_category = "Deconvergence Options"; | |
| 1468 | ui_type = "drag"; | |
| 1469 | ui_min = -15.0; | |
| 1470 | ui_max = 15.0; | |
| 1471 | ui_step = 0.25; | |
| 1472 | ui_label = "Horizontal Deconvergence Green Range"; | |
| 1473 | > = 0.0; | |
| 1474 | ||
| 1475 | uniform float deconbx < | |
| 1476 | ui_category = "Deconvergence Options"; | |
| 1477 | ui_type = "drag"; | |
| 1478 | ui_min = -15.0; | |
| 1479 | ui_max = 15.0; | |
| 1480 | ui_step = 0.25; | |
| 1481 | ui_label = "Horizontal Deconvergence Blue Range"; | |
| 1482 | > = -0.75; | |
| 1483 | ||
| 1484 | uniform float deconry < | |
| 1485 | ui_category = "Deconvergence Options"; | |
| 1486 | ui_type = "drag"; | |
| 1487 | ui_min = -15.0; | |
| 1488 | ui_max = 15.0; | |
| 1489 | ui_step = 0.25; | |
| 1490 | ui_label = "Vertical Deconvergence Red Range"; | |
| 1491 | > = 0.5; | |
| 1492 | ||
| 1493 | uniform float decongy < | |
| 1494 | ui_category = "Deconvergence Options"; | |
| 1495 | ui_type = "drag"; | |
| 1496 | ui_min = -15.0; | |
| 1497 | ui_max = 15.0; | |
| 1498 | ui_step = 0.25; | |
| 1499 | ui_label = "Vertical Deconvergence Green Range"; | |
| 1500 | > = -0.25; | |
| 1501 | ||
| 1502 | uniform float deconby < | |
| 1503 | ui_category = "Deconvergence Options"; | |
| 1504 | ui_type = "drag"; | |
| 1505 | ui_min = -15.0; | |
| 1506 | ui_max = 15.0; | |
| 1507 | ui_step = 0.25; | |
| 1508 | ui_label = "Vertical Deconvergence Blue Range"; | |
| 1509 | > = 0.0; | |
| 1510 | ||
| 1511 | uniform float decons < | |
| 1512 | ui_category = "Deconvergence Options"; | |
| 1513 | ui_type = "drag"; | |
| 1514 | ui_min = 0.0; | |
| 1515 | ui_max = 3.0; | |
| 1516 | ui_step = 0.1; | |
| 1517 | ui_label = "Deconvergence Strength"; | |
| 1518 | > = 1.2; | |
| 1519 | ||
| 1520 | uniform float addnoised < | |
| 1521 | ui_category = "Noise Options"; | |
| 1522 | ui_type = "drag"; | |
| 1523 | ui_min = -1.0; | |
| 1524 | ui_max = 1.0; | |
| 1525 | ui_step = 0.02; | |
| 1526 | ui_label = "Add Noise"; | |
| 1527 | > = 0.02; | |
| 1528 | ||
| 1529 | uniform float noiseresd < | |
| 1530 | ui_category = "Noise Options"; | |
| 1531 | ui_type = "drag"; | |
| 1532 | ui_min = 1.0; | |
| 1533 | ui_max = 10.0; | |
| 1534 | ui_step = 1.0; | |
| 1535 | ui_label = "Noise Resolution"; | |
| 1536 | > = 2.0; | |
| 1537 | ||
| 1538 | uniform float noisetype < | |
| 1539 | ui_category = "Noise Options"; | |
| 1540 | ui_type = "drag"; | |
| 1541 | ui_min = 0.0; | |
| 1542 | ui_max = 1.0; | |
| 1543 | ui_step = 1.0; | |
| 1544 | ui_label = "Noise Type: Colored | Luma"; | |
| 1545 | > = 0.0; | |
| 1546 | ||
| 1547 | uniform float post_br < | |
| 1548 | ui_category = "Post Effects"; | |
| 1549 | ui_type = "drag"; | |
| 1550 | ui_min = 0.25; | |
| 1551 | ui_max = 5.0; | |
| 1552 | ui_step = 0.01; | |
| 1553 | ui_label = "Post Brightness"; | |
| 1554 | > = 1.03; | |
| 1555 | ||
| 1556 | uniform float oimage < | |
| 1557 | ui_category = "Post Effects"; | |
| 1558 | ui_type = "drag"; | |
| 1559 | ui_min = 0.0; | |
| 1560 | ui_max = 1.0; | |
| 1561 | ui_step = 0.25; | |
| 1562 | ui_label = "Show Original Image"; | |
| 1563 | > = 0.0; | |
| 1564 | ||
| 1565 | #include "ReShade.fxh" | |
| 1566 | ||
| 1567 | #define TexSize float2(Resolution_X,Resolution_Y) | |
| 1568 | #define IptSize float2(800.00000000,600.00000000) | |
| 1569 | #define BoxSize float2(AspectSize_X,AspectSize_Y) | |
| 1570 | #define OptSize float4(BUFFER_SCREEN_SIZE,1.0/BUFFER_SCREEN_SIZE) | |
| 1571 | #define OrgSize float4(TexSize,1.0/TexSize) | |
| 1572 | #define SrcSize float4(IptSize,1.0/IptSize) | |
| 1573 | #define NewSize float4(BoxSize,1.0/BoxSize) | |
| 1574 | #define fuxcoord (texcoord*1.00001) | |
| 1575 | #define scans 1.5*scans | |
| 1576 | #define eps 1e-8 | |
| 1577 | #define wts float((bloomsamp < 0.5) ? -10.0 : -12.5) | |
| 1578 | #define pii 3.14159265 | |
| 1579 | #define fracoord (fuxcoord*NewSize.xy) | |
| 1580 | #define texCD(c,d) tex2Dlod(c,float4(d,0,0)) | |
| 1581 | #define LumSize float4(2.0*TexSize.x,1.0*TexSize.y,1.0/(2.0*TexSize.x),1.0/(1.0*TexSize.y)) | |
| 1582 | #define rgb_m float3x3(0.2989,0.5870,0.1140,0.5959,-0.2744,-0.3216,0.2115,-0.5229,0.3114) | |
| 1583 | #define yiq_m float3x3(1.0000,0.9560,0.6210,1.0000,-0.2720,-0.6474,1.0000,-1.1060,1.7046) | |
| 1584 | #define fetch_offset1(dx) texCD(JoNTSC_S03,tex_c+dx).xyz+texCD(JoNTSC_S03,tex_c-dx).xyz | |
| 1585 | #define fetch_offset2(dx) float3(texCD(JoNTSC_S03,tex_c+dx.xz).x+texCD(JoNTSC_S03,tex_c-dx.xz).x,texCD(JoNTSC_S03,tex_c+dx.yz).yz+texCD(JoNTSC_S03,tex_c-dx.yz).yz) | |
| 1586 | ||
| 1587 | #ifndef Resolution_X | |
| 1588 | #define Resolution_X 854 | |
| 1589 | #endif | |
| 1590 | ||
| 1591 | #ifndef Resolution_Y | |
| 1592 | #define Resolution_Y 480 | |
| 1593 | #endif | |
| 1594 | ||
| 1595 | #ifndef AspectSize_X | |
| 1596 | #define AspectSize_X BUFFER_SCREEN_SIZE.x | |
| 1597 | #endif | |
| 1598 | ||
| 1599 | #ifndef AspectSize_Y | |
| 1600 | #define AspectSize_Y BUFFER_SCREEN_SIZE.y | |
| 1601 | #endif | |
| 1602 | ||
| 1603 | #ifndef OriginalFPS | |
| 1604 | #define OriginalFPS 60 | |
| 1605 | #endif | |
| 1606 | ||
| 1607 | #define JoNTSC_S00 ReShade::BackBuffer | |
| 1608 | ||
| 1609 | texture JoNTSC_T0S{Width=1.0*Resolution_X;Height=Resolution_Y;Format=RGBA16F;};
| |
| 1610 | sampler JoNTSC_S0S{Texture=JoNTSC_T0S;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=POINT ;MinFilter=POINT ;MipFilter=POINT ;};
| |
| 1611 | ||
| 1612 | texture JoNTSC_T01{Width=1.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1613 | sampler JoNTSC_S01{Texture=JoNTSC_T01;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1614 | ||
| 1615 | texture JoNTSC_T02{Width=1.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1616 | sampler JoNTSC_S02{Texture=JoNTSC_T02;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1617 | ||
| 1618 | texture JoNTSC_T0I{Width=1.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1619 | sampler JoNTSC_S0I{Texture=JoNTSC_T0I;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1620 | ||
| 1621 | texture JoNTSC_T03{Width=4.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1622 | sampler JoNTSC_S03{Texture=JoNTSC_T03;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=POINT ;MinFilter=POINT ;MipFilter=POINT ;};
| |
| 1623 | ||
| 1624 | texture JoNTSC_T04{Width=2.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1625 | sampler JoNTSC_S04{Texture=JoNTSC_T04;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1626 | ||
| 1627 | texture JoNTSC_T05{Width=2.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1628 | sampler JoNTSC_S05{Texture=JoNTSC_T05;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1629 | ||
| 1630 | texture JoNTSC_T06{Width=2.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1631 | sampler JoNTSC_S06{Texture=JoNTSC_T06;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1632 | ||
| 1633 | texture JBCrsh_T01{Width=2.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1634 | sampler JBCrsh_S01{Texture=JBCrsh_T01;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=POINT ;MinFilter=POINT ;MipFilter=POINT ;};
| |
| 1635 | ||
| 1636 | texture JBCrsh_T02{Width=2.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1637 | sampler JBCrsh_S02{Texture=JBCrsh_T02;AddressU=REPEAT;AddressV=REPEAT;AddressW=REPEAT;MagFilter=POINT ;MinFilter=POINT ;MipFilter=POINT ;};
| |
| 1638 | ||
| 1639 | texture JoNTSC_T07{Width=2.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1640 | sampler JoNTSC_S07{Texture=JoNTSC_T07;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1641 | ||
| 1642 | texture JoNTSC_T08{Width=2.0*Resolution_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1643 | sampler JoNTSC_S08{Texture=JoNTSC_T08;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1644 | ||
| 1645 | texture JoNTSC_T09{Width=1.0*AspectSize_X;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1646 | sampler JoNTSC_S09{Texture=JoNTSC_T09;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1647 | ||
| 1648 | texture JoNTSC_T10{Width=1.0*800.00000000;Height=Resolution_Y ;Format=RGBA16F;};
| |
| 1649 | sampler JoNTSC_S10{Texture=JoNTSC_T10;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1650 | ||
| 1651 | texture JoNTSC_T11{Width=1.0*800.00000000;Height=600.00000000 ;Format=RGBA16F;};
| |
| 1652 | sampler JoNTSC_S11{Texture=JoNTSC_T11;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1653 | ||
| 1654 | texture JoNTSC_T12{Width=1.0*800.00000000;Height=600.00000000 ;Format=RGBA16F;};
| |
| 1655 | sampler JoNTSC_S12{Texture=JoNTSC_T12;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1656 | ||
| 1657 | texture JoNTSC_T13{Width=1.0*800.00000000;Height=600.00000000 ;Format=RGBA16F;};
| |
| 1658 | sampler JoNTSC_S13{Texture=JoNTSC_T13;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1659 | ||
| 1660 | texture JoNTSC_T14{Width=1.0*AspectSize_X;Height=AspectSize_Y ;Format=RGBA16F;};
| |
| 1661 | sampler JoNTSC_S14{Texture=JoNTSC_T14;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1662 | ||
| 1663 | texture JoNTSC_T15{Width=1.0*AspectSize_X;Height=AspectSize_Y ;Format=RGBA16F;};
| |
| 1664 | sampler JoNTSC_S15{Texture=JoNTSC_T15;AddressU=BORDER;AddressV=BORDER;AddressW=BORDER;MagFilter=LINEAR;MinFilter=LINEAR;MipFilter=LINEAR;};
| |
| 1665 | ||
| 1666 | texture JoNTSC_001<source="CRT-LUT-1.png";>{Width=1024;Height=32;};
| |
| 1667 | sampler JoNTSC_L01{Texture=JoNTSC_001;};
| |
| 1668 | ||
| 1669 | texture JoNTSC_002<source="CRT-LUT-2.png";>{Width=1024;Height=32;};
| |
| 1670 | sampler JoNTSC_L02{Texture=JoNTSC_002;};
| |
| 1671 | ||
| 1672 | texture JoNTSC_003<source="CRT-LUT-3.png";>{Width=1024;Height=32;};
| |
| 1673 | sampler JoNTSC_L03{Texture=JoNTSC_003;};
| |
| 1674 | ||
| 1675 | texture JoNTSC_004<source="CRT-LUT-4.png";>{Width=1024;Height=32;};
| |
| 1676 | sampler JoNTSC_L04{Texture=JoNTSC_004;};
| |
| 1677 | ||
| 1678 | uniform int framecount<source="framecount";>; | |
| 1679 | ||
| 1680 | float3 fix_lut(float3 lut,float3 ref) | |
| 1681 | {
| |
| 1682 | float r=length(ref); | |
| 1683 | float l=length(lut); | |
| 1684 | float m=max(max(ref.r,ref.g),ref.b); | |
| 1685 | ref=normalize(lut+0.0000001)*lerp(r,l,pow(m,1.25)); | |
| 1686 | return lerp(lut,ref,LUTBR); | |
| 1687 | } | |
| 1688 | ||
| 1689 | float vignette(float2 pos) | |
| 1690 | {
| |
| 1691 | float2 b=vigdef*float2(1.0,OrgSize.x/OrgSize.y)*0.125; | |
| 1692 | pos=clamp(pos,0.0,1.0); | |
| 1693 | pos=abs(2.0*(pos-0.5)); | |
| 1694 | float2 res=lerp(0.0.xx,1.0.xx,smoothstep(1.0.xx,1.0.xx-b,sqrt(pos))); | |
| 1695 | res=pow(res,0.70.xx); | |
| 1696 | return max(lerp(1.0,sqrt(res.x*res.y),vigstr),0.0); | |
| 1697 | } | |
| 1698 | ||
| 1699 | float contrast(float x) | |
| 1700 | {
| |
| 1701 | return max(lerp(x,smoothstep(0,1.0,x),contra),0.0); | |
| 1702 | } | |
| 1703 | ||
| 1704 | float3 pgc(float3 c) | |
| 1705 | {
| |
| 1706 | float mc = max(max(c.r,c.g),c.b); | |
| 1707 | float mg = pow(mc, 1.0/pre_gc); | |
| 1708 | return c * mg/(mc + 1e-8); | |
| 1709 | } | |
| 1710 | ||
| 1711 | float contrast_sigmoid_inv(float imgColor, float cont, float pivot) | |
| 1712 | {
| |
| 1713 | cont = cont - 1.0; cont = cont*cont*cont; | |
| 1714 | float knee = 1.0 / (1.0 + exp (cont * pivot)); | |
| 1715 | float shldr = 1.0 / (1.0 + exp (cont * (pivot - 1.0))); | |
| 1716 | imgColor = pivot - log(1.0 / (imgColor * (shldr - knee) + knee) - 1.0) / cont; | |
| 1717 | return imgColor; | |
| 1718 | } | |
| 1719 | ||
| 1720 | float dist(float3 A,float3 B) | |
| 1721 | {
| |
| 1722 | float r=0.5*(A.r+B.r); | |
| 1723 | float3 d=A-B; | |
| 1724 | float3 c=float3(2.+r,4.,3.-r); | |
| 1725 | return sqrt(dot(c*d,d))/3.; | |
| 1726 | } | |
| 1727 | ||
| 1728 | float3 plant(float3 tar,float r) | |
| 1729 | {
| |
| 1730 | float t=max(max(tar.r,tar.g),tar.b)+0.00001; | |
| 1731 | return tar*r/t; | |
| 1732 | } | |
| 1733 | ||
| 1734 | float3 fetch_pixel(float2 coord) | |
| 1735 | {
| |
| 1736 | float2 dx=float2(LumSize.z,0.0)*downsample_levelx; | |
| 1737 | float2 dy=float2(0.0,LumSize.w)*downsample_levely; | |
| 1738 | float2 d1=dx+dy; | |
| 1739 | float2 d2=dx-dy; | |
| 1740 | float sum=15.0; | |
| 1741 | float3 result= | |
| 1742 | 3.0*texCD(JBCrsh_S02,coord ).rgb+2.0*texCD(JBCrsh_S02,coord+dx).rgb+2.0*texCD(JBCrsh_S02,coord-dx).rgb+ | |
| 1743 | 2.0*texCD(JBCrsh_S02,coord+dy).rgb+2.0*texCD(JBCrsh_S02,coord-dy).rgb+ texCD(JBCrsh_S02,coord+d1).rgb+ | |
| 1744 | texCD(JBCrsh_S02,coord-d1).rgb+ texCD(JBCrsh_S02,coord+d2).rgb+ texCD(JBCrsh_S02,coord-d2).rgb; | |
| 1745 | return result/sum; | |
| 1746 | } | |
| 1747 | ||
| 1748 | float gauss_h(float x) | |
| 1749 | {
| |
| 1750 | float sigma=1.0/(2.0*SIGMA_H*SIGMA_H); | |
| 1751 | return exp(-x*x*sigma); | |
| 1752 | } | |
| 1753 | ||
| 1754 | float gauss_v(float x) | |
| 1755 | {
| |
| 1756 | float sigma=1.0/(2.0*SIGMA_V*SIGMA_V); | |
| 1757 | return exp(-x*x*sigma); | |
| 1758 | } | |
| 1759 | ||
| 1760 | float bloom_h(float x) | |
| 1761 | {
| |
| 1762 | float SIGMA_X2 = SIGMA_X * SIZEX / 3.0; | |
| 1763 | float sigma=1.0/(2.0*SIGMA_X2*SIGMA_X2); | |
| 1764 | return exp(-x*x*sigma); | |
| 1765 | } | |
| 1766 | ||
| 1767 | float bloom_v(float x) | |
| 1768 | {
| |
| 1769 | float SIGMA_Y2 = SIGMA_Y * SIZEY / 3.0; | |
| 1770 | float sigma=1.0/(2.0*SIGMA_Y2*SIGMA_Y2); | |
| 1771 | return exp(-x*x*sigma); | |
| 1772 | } | |
| 1773 | ||
| 1774 | float crthd_h(float x,float y) | |
| 1775 | {
| |
| 1776 | return exp(-x*x*y); | |
| 1777 | } | |
| 1778 | ||
| 1779 | float mod(float x,float y) | |
| 1780 | {
| |
| 1781 | return x-y* floor(x/y); | |
| 1782 | } | |
| 1783 | ||
| 1784 | float st0(float x) | |
| 1785 | {
| |
| 1786 | return exp2(wts*x*x); | |
| 1787 | } | |
| 1788 | ||
| 1789 | float3 sw0(float x,float color,float scanline,float3 c) | |
| 1790 | {
| |
| 1791 | float3 xe=lerp(1.0.xxx+scans,1.0.xxx,c); | |
| 1792 | float tmp=lerp(beam_min,beam_max,color); | |
| 1793 | float ex=x*tmp; | |
| 1794 | ex=(gsl>-0.5)?ex*ex:lerp(ex*ex,ex*ex*ex,0.4); | |
| 1795 | return exp2(-scanline*ex*xe); | |
| 1796 | } | |
| 1797 | ||
| 1798 | float3 sw1(float x,float color,float scanline,float3 c) | |
| 1799 | {
| |
| 1800 | float3 xe=lerp(1.0.xxx+scans,1.0.xxx,c); | |
| 1801 | x=lerp(x,beam_min*x,max(x-0.4*color,0.0)); | |
| 1802 | float tmp=lerp(1.2*beam_min,beam_max,color); | |
| 1803 | float ex=x*tmp; | |
| 1804 | return exp2(-scanline*ex*ex*xe); | |
| 1805 | } | |
| 1806 | ||
| 1807 | float3 sw2(float x,float color,float scanline,float3 c) | |
| 1808 | {
| |
| 1809 | float3 xe=lerp(1.0.xxx+scans,1.0.xxx,c); | |
| 1810 | float tmp=lerp((2.5-0.5*color)*beam_min,beam_max,color); | |
| 1811 | tmp=lerp(beam_max,tmp,pow(x,color+0.3)); | |
| 1812 | float ex=x*tmp; | |
| 1813 | return exp2(-scanline*ex*ex*xe); | |
| 1814 | } | |
| 1815 | ||
| 1816 | float2 overscan(float2 pos,float dx,float dy) | |
| 1817 | {
| |
| 1818 | pos=pos*2.0-1.0; | |
| 1819 | pos*=float2(dx,dy); | |
| 1820 | return pos*0.5+0.5; | |
| 1821 | } | |
| 1822 | ||
| 1823 | float2 warp(float2 pos) | |
| 1824 | {
| |
| 1825 | pos=pos*2.0-1.0; | |
| 1826 | pos=lerp(pos,sign(pos)*pow(abs(pos),1.0+min(15.0*float2(warpy,warpx)*cbulge.xx,cbulge.xx)),0.075+0.125*(abs(pos)+pos*pos)); | |
| 1827 | 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); | |
| 1828 | return pos*0.5+0.5; | |
| 1829 | } | |
| 1830 | ||
| 1831 | float3 gc1(float3 c) | |
| 1832 | {
| |
| 1833 | float mc=max(max(c.r,c.g),c.b); | |
| 1834 | float mg=pow(mc,1.0/gamma_c); | |
| 1835 | return c*mg/(mc+eps); | |
| 1836 | } | |
| 1837 | ||
| 1838 | float3 rgb2yiq(float3 r) | |
| 1839 | {
| |
| 1840 | return mul(rgb_m, r); | |
| 1841 | } | |
| 1842 | ||
| 1843 | float3 yiq2rgb(float3 y) | |
| 1844 | {
| |
| 1845 | return mul(yiq_m, y); | |
| 1846 | } | |
| 1847 | ||
| 1848 | float get_luma(float3 c) | |
| 1849 | {
| |
| 1850 | - | return dot(c,float3(0.299,0.587,0.114)); |
| 1850 | + | return dot(c,float3(0.2989, 0.5870, 0.1140)); |
| 1851 | } | |
| 1852 | ||
| 1853 | float swoothstep(float e0,float e1,float x) | |
| 1854 | {
| |
| 1855 | return clamp((x-e0)/(e1-e0),0.0,1.0); | |
| 1856 | } | |
| 1857 | ||
| 1858 | float3 crt_mask(float2 pos,float mx,float mb) | |
| 1859 | {
| |
| 1860 | float3 mask=mask_drk; | |
| 1861 | float3 one=1.0; | |
| 1862 | if(shadow_msk== 0.0) | |
| 1863 | {
| |
| 1864 | float mc=1.0-max(maskstr,0.0); | |
| 1865 | pos.x=frac(pos.x*0.5); | |
| 1866 | if(pos.x<0.49) | |
| 1867 | {
| |
| 1868 | mask.r=1.0;mask.g= mc;mask.b=1.0; | |
| 1869 | }else | |
| 1870 | {
| |
| 1871 | mask.r= mc;mask.g=1.0;mask.b= mc; | |
| 1872 | } | |
| 1873 | }else | |
| 1874 | if(shadow_msk== 1.0) | |
| 1875 | {
| |
| 1876 | float lane=mask_lgt; | |
| 1877 | float odd=0.0; | |
| 1878 | if(frac(pos.x/6.0)<0.49)odd=1.0; | |
| 1879 | if(frac((pos.y+odd)/2.0)<0.49)lane=mask_drk; | |
| 1880 | pos.x=floor(mod(pos.x,3.0)); | |
| 1881 | if(pos.x<0.5)mask.r=mask_lgt;else | |
| 1882 | if(pos.x<1.5)mask.g=mask_lgt;else | |
| 1883 | mask.b= mask_lgt; | |
| 1884 | mask*=lane; | |
| 1885 | }else | |
| 1886 | if(shadow_msk== 2.0) | |
| 1887 | {
| |
| 1888 | pos.x=floor(mod(pos.x,3.0)); | |
| 1889 | if(pos.x<0.5)mask.r=mask_lgt;else | |
| 1890 | if(pos.x<1.5)mask.g=mask_lgt;else | |
| 1891 | mask.b= mask_lgt; | |
| 1892 | }else | |
| 1893 | if(shadow_msk== 3.0) | |
| 1894 | {
| |
| 1895 | pos.x+=pos.y*3.0; | |
| 1896 | pos.x=frac(pos.x/6.0); | |
| 1897 | if(pos.x<0.3)mask.r=mask_lgt;else | |
| 1898 | if(pos.x<0.6)mask.g=mask_lgt;else | |
| 1899 | mask.b= mask_lgt; | |
| 1900 | }else | |
| 1901 | if(shadow_msk== 4.0) | |
| 1902 | {
| |
| 1903 | pos.xy=floor(pos.xy*float2(1.0,0.5)); | |
| 1904 | pos.x+=pos.y*3.0; | |
| 1905 | pos.x=frac(pos.x/6.0); | |
| 1906 | if(pos.x<0.3)mask.r=mask_lgt;else | |
| 1907 | if(pos.x<0.6)mask.g=mask_lgt;else | |
| 1908 | mask.b= mask_lgt; | |
| 1909 | }else | |
| 1910 | if(shadow_msk== 5.0) | |
| 1911 | {
| |
| 1912 | mask=0.0; | |
| 1913 | pos.x=frac(pos.x/2.0); | |
| 1914 | if(pos.x<0.49) | |
| 1915 | {
| |
| 1916 | mask.r=1.0; | |
| 1917 | mask.b=1.0; | |
| 1918 | }else | |
| 1919 | mask.g=1.0; | |
| 1920 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1921 | }else | |
| 1922 | if(shadow_msk== 6.0) | |
| 1923 | {
| |
| 1924 | mask=0.0; | |
| 1925 | pos.x=floor(mod(pos.x,3.0)); | |
| 1926 | if(pos.x<0.5)mask.r=1.0;else | |
| 1927 | if(pos.x<1.5)mask.g=1.0;else | |
| 1928 | mask.b=1.0; | |
| 1929 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1930 | }else | |
| 1931 | if(shadow_msk== 7.0) | |
| 1932 | {
| |
| 1933 | mask=0.0; | |
| 1934 | pos.x=frac(pos.x/2.0); | |
| 1935 | if(pos.x<0.49) | |
| 1936 | {
| |
| 1937 | mask=0.0.xxx; | |
| 1938 | }else | |
| 1939 | mask=1.0.xxx; | |
| 1940 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1941 | }else | |
| 1942 | if(shadow_msk== 8.0) | |
| 1943 | {
| |
| 1944 | mask=0.0; | |
| 1945 | pos.x=frac(pos.x/3.0); | |
| 1946 | if(pos.x<0.3)mask=0.0.xxx;else | |
| 1947 | if(pos.x<0.6)mask=1.0.xxx;else | |
| 1948 | mask=1.0.xxx; | |
| 1949 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1950 | }else | |
| 1951 | if(shadow_msk== 9.0) | |
| 1952 | {
| |
| 1953 | mask=0.0; | |
| 1954 | pos.x=frac(pos.x/3.0); | |
| 1955 | if(pos.x<0.3)mask =0.0.xxx;else | |
| 1956 | if(pos.x<0.6)mask.rb=1.0.xx ;else | |
| 1957 | mask.g=1.0; | |
| 1958 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1959 | }else | |
| 1960 | if(shadow_msk==10.0) | |
| 1961 | {
| |
| 1962 | mask=0.0; | |
| 1963 | pos.x=frac(pos.x*0.25); | |
| 1964 | if(pos.x<0.2)mask =0.0.xxx;else | |
| 1965 | if(pos.x<0.4)mask.r=1.0 ;else | |
| 1966 | if(pos.x<0.7)mask.g=1.0 ;else | |
| 1967 | mask.b=1.0; | |
| 1968 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1969 | }else | |
| 1970 | if(shadow_msk==11.0) | |
| 1971 | {
| |
| 1972 | mask=0.0; | |
| 1973 | pos.x=frac(pos.x*0.25); | |
| 1974 | if(pos.x<0.2)mask.r =1.0 ;else | |
| 1975 | if(pos.x<0.4)mask.rg=1.0.xx;else | |
| 1976 | if(pos.x<0.7)mask.gb=1.0.xx;else | |
| 1977 | mask.b=1.0;mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1978 | }else | |
| 1979 | if(shadow_msk==12.0) | |
| 1980 | {
| |
| 1981 | mask=0.0; | |
| 1982 | pos.x=floor(mod(pos.x,7.0)); | |
| 1983 | if(pos.x<0.5)mask =0.0.xxx;else | |
| 1984 | if(pos.x<2.5)mask.r=1.0 ;else | |
| 1985 | if(pos.x<4.5)mask.g=1.0 ;else | |
| 1986 | mask.b=1.0; | |
| 1987 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 1988 | }else | |
| 1989 | if(shadow_msk==13.0) | |
| 1990 | {
| |
| 1991 | mask=0.0; | |
| 1992 | pos.x=floor(mod(pos.x,6.0)); | |
| 1993 | if(pos.x<0.5)mask =0.0.xxx;else | |
| 1994 | if(pos.x<1.5)mask.r =1.0 ;else | |
| 1995 | if(pos.x<2.5)mask.rg =1.0.xx ;else | |
| 1996 | if(pos.x<3.5)mask.rgb=1.0.xxx;else | |
| 1997 | if(pos.x<4.5)mask.gb =1.0.xx ;else | |
| 1998 | mask.b=1.0; | |
| 1999 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 2000 | }else | |
| 2001 | {
| |
| 2002 | mask=0.0; | |
| 2003 | pos.x=floor(mod(pos.x,5.0)); | |
| 2004 | if(pos.x<0.5)mask =0.0.xxx;else | |
| 2005 | if(pos.x<1.5)mask.r =1.0 ;else | |
| 2006 | if(pos.x<2.5)mask.rg =1.0.xx ;else | |
| 2007 | if(pos.x<3.5)mask.gb =1.0.xx ;else | |
| 2008 | mask.b=1.0; | |
| 2009 | mask=clamp(lerp(lerp(one,mask,mcut),lerp(one,mask,maskstr),mx),0.0,1.0); | |
| 2010 | } | |
| 2011 | if(mask_layout>0.5)mask=mask.rbg; | |
| 2012 | float maskmin=min(min(mask.r,mask.g),mask.b); | |
| 2013 | return (mask-maskmin)*(1.0+(maskboost-1.0)*mb)+maskmin; | |
| 2014 | } | |
| 2015 | ||
| 2016 | float slt_mask(float2 pos,float m,float swidth) | |
| 2017 | {
| |
| 2018 | if ((slotmask1+slotmask2)==0.0)return 1.0;else | |
| 2019 | {
| |
| 2020 | pos.y=floor(pos.y/slotms); | |
| 2021 | float mlen=swidth*2.0; | |
| 2022 | float px=floor( mod(pos.x, 0.99999*mlen)); | |
| 2023 | float py=floor(frac(pos.y/(2.0*double_slot))*2.0*double_slot); | |
| 2024 | float slot_dark=lerp(1.0-slotmask2,1.0-slotmask1,m); | |
| 2025 | float slot=1.0; | |
| 2026 | if(py==0.0&&px<swidth) slot=slot_dark;else | |
| 2027 | if(py==double_slot&&px>=swidth) slot=slot_dark; | |
| 2028 | return slot; | |
| 2029 | } | |
| 2030 | } | |
| 2031 | ||
| 2032 | float humbars(float pos) | |
| 2033 | {
| |
| 2034 | if (barintensity==0.0)return 1.0;else | |
| 2035 | {
| |
| 2036 | pos=(barintensity>=0.0)?pos:(1.0-pos); | |
| 2037 | pos=frac(pos+ mod(float(framecount),barspeed)/(barspeed-1.0)); | |
| 2038 | pos=(barintensity< 0.0)?pos:(1.0-pos); | |
| 2039 | return (1.0-barintensity)+barintensity*pos; | |
| 2040 | } | |
| 2041 | } | |
| 2042 | ||
| 2043 | float corner(float2 pos) | |
| 2044 | {
| |
| 2045 | pos=abs(2.0*(pos-0.50)); | |
| 2046 | float2 aspect=float2(1.0,NewSize.x/NewSize.y); | |
| 2047 | float b=bsize*0.05+0.0005;pos.y=pos.y+b*(aspect.y-1.0); | |
| 2048 | float2 crn=max(csize.xx,2.0*b+0.0015); | |
| 2049 | float2 crp=max(pos-(1.0-crn*aspect),0.0)/aspect;float cd=sqrt(dot(crp,crp)); | |
| 2050 | pos=max(pos,1.0-crn+cd); | |
| 2051 | float res=lerp(1.0,0.0,smoothstep(1.0-b,1.0,sqrt(max(pos.x,pos.y)))); | |
| 2052 | return pow(res,sborder); | |
| 2053 | } | |
| 2054 | ||
| 2055 | float3 declip(float3 c,float b) | |
| 2056 | {
| |
| 2057 | float m=max(max(c.r,c.g),c.b); | |
| 2058 | if(m>b)c=c*b/m; | |
| 2059 | return c; | |
| 2060 | } | |
| 2061 | ||
| 2062 | float igc(float mc) | |
| 2063 | {
| |
| 2064 | return pow(mc,gamma_c); | |
| 2065 | } | |
| 2066 | ||
| 2067 | float3 gc2(float3 c,float w3) | |
| 2068 | {
| |
| 2069 | float mc=max(max(c.r,c.g),c.b); | |
| 2070 | float p=1.0/(1.0+(gamma_d-1.0)* lerp(0.375,1.0,w3)); | |
| 2071 | float mg=pow(mc, p ); | |
| 2072 | return c*mg/(mc+eps); | |
| 2073 | } | |
| 2074 | ||
| 2075 | float3 noise(float3 v) | |
| 2076 | {
| |
| 2077 | if(addnoised<0.0)v.z=-addnoised;else v.z= mod(v.z,6001.0)/1753.0; | |
| 2078 | v =frac(v)+frac(v*1e4)+frac(v*1e-4); | |
| 2079 | v+=float3(0.12345,0.6789,0.314159); | |
| 2080 | v =frac(v*dot(v,v)*123.456); | |
| 2081 | v =frac(v*dot(v,v)*123.456); | |
| 2082 | v =frac(v*dot(v,v)*123.456); | |
| 2083 | v =frac(v*dot(v,v)*123.456); | |
| 2084 | return v; | |
| 2085 | } | |
| 2086 | ||
| 2087 | float smothstep (float e0, float e1, float x) | |
| 2088 | {
| |
| 2089 | return clamp((x - e0) / (e1 - e0), 0.0, 1.0); | |
| 2090 | } | |
| 2091 | ||
| 2092 | float2 psrnd(float2 TexCoord, float FrameCount) {
| |
| 2093 | float3 p = float3(TexCoord * 16758.5453, FrameCount); | |
| 2094 | float x = frac(sin(dot(p, float3(12.9898, 78.233, 3.183))) * 43758.5453); | |
| 2095 | float y = frac(sin(dot(p, float3(25.9796, 14.113, 11.271))) * 96321.9124); | |
| 2096 | return float2(x, y); | |
| 2097 | } | |
| 2098 | ||
| 2099 | float3 NoiseNP3(float2 TexCoord, float FrameCount) {
| |
| 2100 | float RFNOISE0 = RFNOISE*RFNOISE + 0.00001; | |
| 2101 | TexCoord = psrnd(TexCoord, FrameCount); | |
| 2102 | float3 p = float3(TexCoord * 758.5453, FrameCount); | |
| 2103 | float res1 = frac(sin(dot(p, float3(12.989835, 78.23341, 0.16453))) * 43758.54531); | |
| 2104 | float res2 = frac(sin(dot(p, float3(39.34679, 11.13523, 83.15573))) * 39459.32423); | |
| 2105 | float res3 = frac(sin(dot(p, float3(73.15691, 52.23504, 9.15197))) * 60493.84731); | |
| 2106 | float lns = float(abs(res1-0.5) < 0.2*RFNOISE0); | |
| 2107 | float cny = float(abs(res2-0.5) < 0.5*RFNOISE0); | |
| 2108 | float cnz = float(abs(res3-0.5) < 0.5*RFNOISE0); | |
| 2109 | lns = lns*smothstep(0.5-0.2*RFNOISE0, 0.5+0.2*RFNOISE0, res1) * 0.66 - 0.33*lns; | |
| 2110 | cny = cny*smothstep(0.5-0.5*RFNOISE0, 0.5+0.5*RFNOISE0, res2) - 0.5*cny; | |
| 2111 | cnz = cnz*smothstep(0.5-0.5*RFNOISE0, 0.5+0.5*RFNOISE0, res3) - 0.5*cnz; | |
| 2112 | return float3(lns, cny, cnz); | |
| 2113 | } | |
| 2114 | ||
| 2115 | void bring_pixel(inout float3 c,inout float3 b,inout float3 g,float2 coord,float2 boord) | |
| 2116 | {
| |
| 2117 | float stepx=NewSize.z; | |
| 2118 | float stepy=NewSize.w; | |
| 2119 | float2 dx=float2(stepx,0.0); | |
| 2120 | float2 dy=float2(0.0,stepy); | |
| 2121 | float posx= 2.0*coord.x-1.0; | |
| 2122 | float posy= 2.0*coord.y-1.0; | |
| 2123 | if(dctypex>0.025) | |
| 2124 | {
| |
| 2125 | posx= sign(posx)*pow(abs(posx),1.05-dctypex); | |
| 2126 | dx=posx*dx; | |
| 2127 | } | |
| 2128 | if(dctypey>0.025) | |
| 2129 | {
| |
| 2130 | posy= sign(posy)*pow(abs(posy),1.05-dctypey); | |
| 2131 | dy=posy*dy; | |
| 2132 | } | |
| 2133 | float2 rc=deconrx*dx+deconry*dy; | |
| 2134 | float2 gc=decongx*dx+decongy*dy; | |
| 2135 | float2 bc=deconbx*dx+deconby*dy; | |
| 2136 | float r1=texCD(JoNTSC_S14,coord+rc).r; | |
| 2137 | float g1=texCD(JoNTSC_S14,coord+gc).g; | |
| 2138 | float b1=texCD(JoNTSC_S14,coord+bc).b; | |
| 2139 | float ds=decons; | |
| 2140 | float3 d=float3(r1,g1,b1); | |
| 2141 | c=clamp(lerp(c,d,ds),0.0,1.0); | |
| 2142 | r1=texCD(JoNTSC_S13,boord+rc).r; | |
| 2143 | g1=texCD(JoNTSC_S13,boord+gc).g; | |
| 2144 | b1=texCD(JoNTSC_S13,boord+bc).b; | |
| 2145 | d=float3(r1,g1,b1); | |
| 2146 | b=g=lerp(b,d,min(ds,1.0)); | |
| 2147 | r1=texCD(JoNTSC_S11,boord+rc).r; | |
| 2148 | g1=texCD(JoNTSC_S11,boord+gc).g; | |
| 2149 | b1=texCD(JoNTSC_S11,boord+bc).b; | |
| 2150 | d=float3(r1,g1,b1); | |
| 2151 | g=lerp(g,d,min(ds,1.0)); | |
| 2152 | } | |
| 2153 | ||
| 2154 | float3 scale_to_range(float3 x, float dmin, float dmax) | |
| 2155 | {
| |
| 2156 | return ( (dmax - dmin) * x ) + dmin; //Scales 0..1 range to a..b range | |
| 2157 | } | |
| 2158 | ||
| 2159 | ||
| 2160 | float3 adaptive_black(float3 c, float lum_in, float range, bool dark_crush) | |
| 2161 | {
| |
| 2162 | if (dark_crush) | |
| 2163 | {
| |
| 2164 | // Black crush | |
| 2165 | return clamp(scale_to_range(c, -lum_in * range,1.0), 0.0,1.0); | |
| 2166 | } | |
| 2167 | else | |
| 2168 | {
| |
| 2169 | // Increase gamma | |
| 2170 | float ga = 1.0 + lum_in * 2.0 * range; | |
| 2171 | return pow(c, float3(ga,ga,ga)); | |
| 2172 | } | |
| 2173 | } | |
| 2174 | ||
| 2175 | float get_fps() | |
| 2176 | {
| |
| 2177 | // Direct port (frametime uniforms not available) | |
| 2178 | return OriginalFPS; | |
| 2179 | } | |
| 2180 | ||
| 2181 | static const float2 expanse=BoxSize/ (2*OptSize.xy); | |
| 2182 | static const float2 capital=0.0/OptSize.xy+0.5; | |
| 2183 | static const float coord_w=capital.x-expanse.x; | |
| 2184 | static const float coord_e=capital.x+expanse.x; | |
| 2185 | static const float coord_n=capital.y-expanse.y; | |
| 2186 | static const float coord_s=capital.y+expanse.y; | |
| 2187 | static const float2 correct=float2(coord_w,coord_n); | |
| 2188 | ||
| 2189 | void CropProcessVS(in uint id:SV_VertexID,out float4 position:SV_Position,out float2 texcoord:TEXCOORD) | |
| 2190 | {
| |
| 2191 | #if __RENDERER__ <= 0x09300 | |
| 2192 | texcoord.x=(id==1||id==3)?coord_e:coord_w; | |
| 2193 | texcoord.y=(id>1)?coord_s:coord_n; | |
| 2194 | position.x=(id==1||id==3)? 1:-1; | |
| 2195 | position.y=(id>1)?-1: 1; | |
| 2196 | position.zw=1; | |
| 2197 | #else | |
| 2198 | texcoord.x=(id&1)?coord_e:coord_w; | |
| 2199 | texcoord.y=(id&2)?coord_s:coord_n; | |
| 2200 | position.x=(id&1)? 1:-1; | |
| 2201 | position.y=(id&2)?-1: 1; | |
| 2202 | position.zw=1; | |
| 2203 | #endif | |
| 2204 | } | |
| 2205 | ||
| 2206 | float4 StockPassPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2207 | {
| |
| 2208 | return texCD(JoNTSC_S00,texcoord); | |
| 2209 | } | |
| 2210 | ||
| 2211 | float4 AfterglowPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2212 | {
| |
| 2213 | float2 dx=float2(OrgSize.z,0.0); | |
| 2214 | float2 dy=float2(0.0,OrgSize.w); | |
| 2215 | float w=1.0; | |
| 2216 | float3 color0=texCD(JoNTSC_S0S,texcoord ).rgb; | |
| 2217 | float3 color1=texCD(JoNTSC_S0S,texcoord-dx).rgb; | |
| 2218 | float3 color2=texCD(JoNTSC_S0S,texcoord+dx).rgb; | |
| 2219 | float3 color3=texCD(JoNTSC_S0S,texcoord-dy).rgb; | |
| 2220 | float3 color4=texCD(JoNTSC_S0S,texcoord+dy).rgb; | |
| 2221 | float3 cr=(2.5*color0+color1+color2+color3+color4)/6.5; | |
| 2222 | float3 a=texCD(JoNTSC_S01,texcoord).rgb; | |
| 2223 | float b = bth/255.0; | |
| 2224 | float c = max(max(color0.r,color0.g),color0.b); | |
| 2225 | w = smoothstep(b, 2.0*b, c); | |
| 2226 | float3 result=lerp(max(lerp(cr,a,0.49+float3(PR,PG,PB))-0.5/255.0,0.0),cr,w); | |
| 2227 | return float4(result,w); | |
| 2228 | } | |
| 2229 | ||
| 2230 | float4 PreShaderPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2231 | {
| |
| 2232 | const float3x3 File0=float3x3(0.412391, 0.212639,0.019331, 0.357584,0.715169, 0.119195, 0.180481,0.072192,0.950532); | |
| 2233 | const float3x3 File1=float3x3(0.430554, 0.222004,0.020182, 0.341550,0.706655, 0.129553, 0.178352,0.071341,0.939322); | |
| 2234 | const float3x3 File2=float3x3(0.396686, 0.210299,0.006131, 0.372504,0.713766, 0.115356, 0.181266,0.075936,0.967571); | |
| 2235 | const float3x3 File3=float3x3(0.393521, 0.212376,0.018739, 0.365258,0.701060, 0.111934, 0.191677,0.086564,0.958385); | |
| 2236 | const float3x3 File4=float3x3(0.392258, 0.209410,0.016061, 0.351135,0.725680, 0.093636, 0.166603,0.064910,0.850324); | |
| 2237 | const float3x3 File5=float3x3(0.377923, 0.195679,0.010514, 0.317366,0.722319, 0.097826, 0.207738,0.082002,1.076960); | |
| 2238 | const float3x3 ToRGB=float3x3(3.240970,-0.969244,0.055630,-1.537383,1.875968,-0.203977,-0.498611,0.041555,1.056972); | |
| 2239 | const float3x3 ToMDN=float3x3(2.791723,-0.894766,0.041678,-1.173165,1.815586,-0.130886,-0.440973,0.032000,1.002034); | |
| 2240 | const float3x3 ToDCI=float3x3(2.973422,-0.867605,0.045031,-1.110433,1.843757,-0.095697,-0.480247,0.024743,1.201215); | |
| 2241 | const float3x3 ToADB=float3x3(2.041588,-0.969244,0.013444,-0.565007,1.875968,-0.118360,-0.344731,0.041555,1.015175); | |
| 2242 | const float3x3 ToREC=float3x3(1.716651,-0.666684,0.017640,-0.355671,1.616481,-0.042771,-0.253366,0.015769,0.942103); | |
| 2243 | const float3x3 ToP3=float3x3(2.493509,-0.829473,0.0358512,-0.931388,1.762630,-0.0761839,-0.402712,0.023624,0.9570296); | |
| 2244 | const float3x3 D65_to_D55=float3x3(0.4850339153,0.2500956126,0.0227359648,0.3488957224,0.6977914447,0.1162985741,0.1302823568,0.0521129427,0.6861537456); | |
| 2245 | const float3x3 D65_to_D93=float3x3(0.3412754080,0.1759701322,0.0159972847,0.3646170520,0.7292341040,0.1215390173,0.2369894093,0.0947957637,1.2481442225); | |
| 2246 | float4 imgColor=texCD(JoNTSC_S0S,texcoord); | |
| 2247 | float4 aftrglow=texCD(JoNTSC_S01,texcoord); | |
| 2248 | float w=1.0-aftrglow.w; | |
| 2249 | float l=length(aftrglow.rgb); | |
| 2250 | aftrglow.rgb=AS*w*normalize(pow(aftrglow.rgb+0.01,ST))*l; | |
| 2251 | float bp=w*BP1/255.0; | |
| 2252 | if(sega_fix>0.5) imgColor.rgb=imgColor.rgb*(255.0/239.0); | |
| 2253 | if(segams>0.5) { imgColor.b=(abs(imgColor.b - 0.375) < 0.125) ? 0.4078431372549019607843137254902 : imgColor.b; }
| |
| 2254 | imgColor.rgb=min(imgColor.rgb,1.0); | |
| 2255 | if (segapal > 0.5) {
| |
| 2256 | imgColor.r = contrast_sigmoid_inv(imgColor.r,2.578419881,0.520674); | |
| 2257 | imgColor.g = contrast_sigmoid_inv(imgColor.g,2.578419881,0.520674); | |
| 2258 | imgColor.b = contrast_sigmoid_inv(imgColor.b,2.578419881,0.520674); } | |
| 2259 | ||
| 2260 | imgColor.rgb = min(imgColor.rgb, 1.0); | |
| 2261 | float3 color=imgColor.rgb; | |
| 2262 | if(int(TNTC)==0) {color.rgb=imgColor.rgb;}else
| |
| 2263 | {
| |
| 2264 | float lutlow=LUTLOW/255.0;float invs=1.0/32.0; | |
| 2265 | float3 lut_ref=imgColor.rgb+lutlow*(1.0-pow(imgColor.rgb,0.333.xxx)); | |
| 2266 | float lutb=lut_ref.b*(1.0-0.5*invs); | |
| 2267 | lut_ref.rg=lut_ref.rg*(1.0-invs)+0.5*invs; | |
| 2268 | float tile1=ceil(lutb*(32.0-1.0)); | |
| 2269 | float tile0=max(tile1-1.0,0.0); | |
| 2270 | float f=frac(lutb*(32.0-1.0));if(f==0.0)f=1.0; | |
| 2271 | float2 coord1=float2(tile0+lut_ref.r,lut_ref.g)*float2(invs,1.0); | |
| 2272 | float2 coord2=float2(tile1+lut_ref.r,lut_ref.g)*float2(invs,1.0); | |
| 2273 | float4 color1,color2,res; | |
| 2274 | if(int(TNTC)==1) | |
| 2275 | {
| |
| 2276 | color1=texCD(JoNTSC_L01,coord1); | |
| 2277 | color2=texCD(JoNTSC_L01,coord2); | |
| 2278 | res=lerp(color1,color2,f); | |
| 2279 | }else | |
| 2280 | if(int(TNTC)==2) | |
| 2281 | {
| |
| 2282 | color1=texCD(JoNTSC_L02,coord1); | |
| 2283 | color2=texCD(JoNTSC_L02,coord2); | |
| 2284 | res=lerp(color1,color2,f); | |
| 2285 | }else | |
| 2286 | if(int(TNTC)==3) | |
| 2287 | {
| |
| 2288 | color1=texCD(JoNTSC_L03,coord1); | |
| 2289 | color2=texCD(JoNTSC_L03,coord2); | |
| 2290 | res=lerp(color1,color2,f); | |
| 2291 | }else | |
| 2292 | if(int(TNTC)==4) | |
| 2293 | {
| |
| 2294 | color1=texCD(JoNTSC_L04,coord1); | |
| 2295 | color2=texCD(JoNTSC_L04,coord2); | |
| 2296 | res=lerp(color1,color2,f); | |
| 2297 | } | |
| 2298 | res.rgb=fix_lut(res.rgb,imgColor.rgb); | |
| 2299 | color=lerp(imgColor.rgb,res.rgb,min(TNTC,1.0)); | |
| 2300 | } | |
| 2301 | float3 c=clamp(color,0.0,1.0); | |
| 2302 | float3x3 m_o; | |
| 2303 | float p; | |
| 2304 | if(CS==0.0){p=2.2;m_o=ToRGB;}else
| |
| 2305 | if(CS==1.0){p=2.2;m_o=ToMDN;}else
| |
| 2306 | if(CS==2.0){p=2.6;m_o=ToDCI;}else
| |
| 2307 | if(CS==3.0){p=2.2;m_o=ToADB;}else
| |
| 2308 | if(CS==4.0){p=2.4;m_o=ToREC;}
| |
| 2309 | if(CS==5.0){p=2.2;m_o=ToP3; }
| |
| 2310 | color=pow(c,p); | |
| 2311 | float3x3 m_i; | |
| 2312 | if(CP==0.0){m_i=File0;}else
| |
| 2313 | if(CP==1.0){m_i=File1;}else
| |
| 2314 | if(CP==2.0){m_i=File2;}else
| |
| 2315 | if(CP==3.0){m_i=File3;}else
| |
| 2316 | if(CP==4.0){m_i=File4;}else
| |
| 2317 | if(CP==5.0){m_i=File5;}
| |
| 2318 | color=mul(color,m_i); | |
| 2319 | color=mul(color,m_o); | |
| 2320 | color=clamp(color,0.0,1.0); | |
| 2321 | color=pow(color,1.0/p); | |
| 2322 | if(CP==-1.0)color=c; | |
| 2323 | float3 solor1=plant(pow(color,wp_saturation),max(max(color.r,color.g),color.b)); | |
| 2324 | float luma=dot(color,float3(0.299,0.587,0.114)); | |
| 2325 | float3 solor2=lerp(luma,color,wp_saturation); | |
| 2326 | color=(wp_saturation>1.0)?solor1:solor2; | |
| 2327 | color=plant(color,contrast(max(max(color.r,color.g),color.b))); | |
| 2328 | p=2.2; | |
| 2329 | color=clamp(color,0.0,1.0); | |
| 2330 | color=pow(color,p); | |
| 2331 | float3 warmer=mul(color,D65_to_D55); | |
| 2332 | warmer=mul(warmer,ToRGB); | |
| 2333 | float3 cooler=mul(color,D65_to_D93); | |
| 2334 | cooler=mul(cooler,ToRGB); | |
| 2335 | float m=abs(WP)/100.0; | |
| 2336 | float3 comp=(WP<0.0)?cooler:warmer; | |
| 2337 | color=lerp(color,comp,m); | |
| 2338 | color=pow(max(color,0.0),1.0/p); | |
| 2339 | color=pgc(color); | |
| 2340 | float bp1 = min(BP, 0.0); | |
| 2341 | color = max(color + bp1/255.0, 0.0) / (1.0 + bp1/255.0*step(-bp1/255.0, max(max(color.r,color.g),color.b))); | |
| 2342 | color = color + aftrglow.rgb + bp; | |
| 2343 | color=min(color*pre_bb,1.0); | |
| 2344 | return float4(color,vignette(texcoord)); | |
| 2345 | } | |
| 2346 | ||
| 2347 | float4 InterlacePS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2348 | {
| |
| 2349 | float3 c1=texCD(JoNTSC_S02,fuxcoord).rgb; | |
| 2350 | float3 c2=texCD(JoNTSC_S02,fuxcoord+float2(0.0,OrgSize.w)).rgb; | |
| 2351 | if((downsample_levelx+downsample_levely)>0.025) | |
| 2352 | {
| |
| 2353 | c1=fetch_pixel(fuxcoord); | |
| 2354 | c2=fetch_pixel(fuxcoord+float2(0.0,OrgSize.w)); | |
| 2355 | } | |
| 2356 | float3 c=c1; | |
| 2357 | float intera=1.0; | |
| 2358 | float m1=max(max(c1.r,c1.g),c1.b); | |
| 2359 | float m2=max(max(c2.r,c2.g),c2.b); | |
| 2360 | float3 df=abs(c1-c2); | |
| 2361 | float d=max(max(df.r,df.g),df.b); | |
| 2362 | if(interm==2.0) d=lerp(0.1*d,10.0*d,step(m1/(m2+0.0001),m2/(m1+0.0001))); | |
| 2363 | float r=m1; | |
| 2364 | float yres_div=1.0;if(intres>1.25)yres_div=intres; | |
| 2365 | bool hscans=(hiscan>0.5); | |
| 2366 | if(interr<=OrgSize.y/yres_div&&interm>0.5&&intres!=1.0&&intres!=0.5||hscans) | |
| 2367 | {
| |
| 2368 | intera=0.25; | |
| 2369 | float liine_no=floor( mod(OrgSize.y*fuxcoord.y,2.0)); | |
| 2370 | float frame_no=floor( mod(float(framecount),2.0)); | |
| 2371 | float ii=abs(liine_no-frame_no); | |
| 2372 | if(interm< 3.5 || interm > 5.5) | |
| 2373 | {
| |
| 2374 | if (interm == 6.0) c = lerp(c2, c1, ii); else | |
| 2375 | {
| |
| 2376 | c2=plant(lerp(c2,c2*c2,iscans),max(max(c2.r,c2.g),c2.b)); | |
| 2377 | r=max(m1*ii,(1.0-iscanb)*min(m1,m2)); | |
| 2378 | 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); | |
| 2379 | if(interm==3.0) c=(1.0-0.5*iscanb)*lerp(c2,c1,ii); | |
| 2380 | } | |
| 2381 | } | |
| 2382 | 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);
| |
| 2383 | } | |
| 2384 | if(interm==5.0){c=lerp(c2,c1,0.5);c=plant(lerp(c,c*c,0.5*iscans),max(max(c.r,c.g),c.b))*(1.0-0.5*iscanb);
| |
| 2385 | } | |
| 2386 | if(hscans)c=c1; | |
| 2387 | } | |
| 2388 | return float4(c,intera); | |
| 2389 | } | |
| 2390 | ||
| 2391 | float4 Signal_1_PS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2392 | {
| |
| 2393 | float2 vtexcoord=texcoord*float2(speedup, 1.0); | |
| 2394 | float NOrgSize = OrgSize.x / max(round(OrgSize.x / 300.0), 1.0); | |
| 2395 | float phase = (ntsc_phase < 1.5) ? ((NOrgSize > 300.0 || (OrgSize.x > 400.0 && OrgSize.y > 250.0)) ? 2.0 : 3.0) : ((ntsc_phase > 2.5) ? 3.0 : 2.0); | |
| 2396 | if(ntsc_phase==4.0)phase=3.0; else if (ntsc_phase == 5.0) phase = 2.0; | |
| 2397 | float ntsc_sizex = (phase == 2.0) ? 320.0 : 256.0; | |
| 2398 | float ntsc_sizey = OrgSize.y / max(round(OrgSize.y / 220.0), 1.0); | |
| 2399 | float2 pix_no = vtexcoord * float2(ntsc_sizex,ntsc_sizey) * float2(4.0, 1.0); | |
| 2400 | pix_no.y = round(pix_no.y); | |
| 2401 | float CHROMA_MOD_FREQ=(phase == 2.0 && ntsc_phase != 5.0) ? (4.0 * pii / 15.0) : ((NOrgSize <= 300.0 || phase == 3.0) ? (pii / 3.0) : (pii/2.0)); | |
| 2402 | float ARTIFACT=cust_artifacting; | |
| 2403 | float FRINGING=cust_fringing; | |
| 2404 | float BRIGHTNESS=ntsc_brt; | |
| 2405 | float SATURATION=ntsc_sat; | |
| 2406 | float MERGE=0.0; | |
| 2407 | if(ntsc_fields== -1.0&&phase==3.0) MERGE=1.0;else | |
| 2408 | if(ntsc_fields== 0.0) MERGE=0.0;else | |
| 2409 | if(ntsc_fields== 1.0) MERGE=1.0; | |
| 2410 | float MIT = ntsc_taps; if (ntsc_charp1 > 0.25 && phase == 2.0) MIT = clamp(MIT, 8.0, min(ntsc_taps,14.0)); | |
| 2411 | MIT = smothstep(16.0, 8.0, MIT) * 0.325; | |
| 2412 | float3x3 mix_m = float3x3(BRIGHTNESS,FRINGING,FRINGING,ARTIFACT,2.0*SATURATION,0.0,ARTIFACT,0.0,2.0*SATURATION); | |
| 2413 | if (vtexcoord.x > 1.0) return 0.0.xxxx; else | |
| 2414 | {
| |
| 2415 | float3 col0=texCD(JoNTSC_S0I, vtexcoord).rgb; | |
| 2416 | float3 yiq1=rgb2yiq(col0); | |
| 2417 | yiq1.x=pow(yiq1.x,ntsc_gamma); float lum=yiq1.x; | |
| 2418 | float3 temp=yiq1; | |
| 2419 | float3 yiq2=yiq1; | |
| 2420 | float3 yiqs=yiq1; | |
| 2421 | float3 yiqz=yiq1; | |
| 2422 | ||
| 2423 | float res = nscale; | |
| 2424 | ||
| 2425 | if (ntsc_dith > 0.005) | |
| 2426 | {
| |
| 2427 | float2 TexD = (floor(vtexcoord * OrgSize.xy) + 0.5)*OrgSize.zw; | |
| 2428 | float2 xx = float2(OrgSize.z, 0.0); | |
| 2429 | ||
| 2430 | float ca = get_luma(texCD(JoNTSC_S0I, TexD - xx - xx).rgb); | |
| 2431 | float c0 = get_luma(texCD(JoNTSC_S0I, TexD - xx).rgb); | |
| 2432 | float c1 = get_luma(texCD(JoNTSC_S0I, TexD ).rgb); | |
| 2433 | float c2 = get_luma(texCD(JoNTSC_S0I, TexD + xx).rgb); | |
| 2434 | float cb = get_luma(texCD(JoNTSC_S0I, TexD + xx + xx).rgb); | |
| 2435 | ||
| 2436 | float line0 = smothstep(0.0075, 0.0, min(abs(c1-c0),abs(c2-c1))); | |
| 2437 | float line1 = max(smothstep(0.0075, 0.0, min(abs(ca-c0),abs(c2-cb))), line0); | |
| 2438 | float line2 = max(smothstep(0.0075, 0.0, min(abs(ca-c2),abs(c0-cb))), line1); | |
| 2439 | res /= 1.0 + (1.0-line2) * ntsc_dith; | |
| 2440 | } | |
| 2441 | ||
| 2442 | if(MERGE>0.5) | |
| 2443 | {
| |
| 2444 | float chroma_phase2=(phase<2.5)?pii*(mod(pix_no.y,2.0)+mod(float(framecount)+1,2.)):0.6667*pii*(mod(pix_no.y,3.0)+mod(float(framecount)+1,2.)); | |
| 2445 | float mod_phase2=chroma_phase2+pix_no.x*CHROMA_MOD_FREQ; | |
| 2446 | float i_mod2=cos( mod_phase2 ); | |
| 2447 | float q_mod2=sin( mod_phase2 ); | |
| 2448 | yiq2.yz*=float2(i_mod2,q_mod2); | |
| 2449 | yiq2=mul(mix_m,yiq2); | |
| 2450 | yiq2.yz*=float2(i_mod2,q_mod2); | |
| 2451 | yiq2.yz =lerp(yiq2.yz,temp.yz,MIT); | |
| 2452 | if(res>1.025) | |
| 2453 | {
| |
| 2454 | mod_phase2=chroma_phase2 +res *pix_no.x*CHROMA_MOD_FREQ; | |
| 2455 | i_mod2=cos(mod_phase2); | |
| 2456 | q_mod2=sin(mod_phase2); | |
| 2457 | yiqs.yz*=float2(i_mod2,q_mod2); | |
| 2458 | yiq2.x=dot(yiqs,mix_m[0]); | |
| 2459 | } | |
| 2460 | } | |
| 2461 | float chroma_phase1=(phase<2.5)?pii*(mod(pix_no.y,2.0)+mod(float(framecount) ,2.)):0.6667*pii*(mod(pix_no.y,3.0)+mod(float(framecount) ,2.)); | |
| 2462 | float mod_phase1=chroma_phase1+pix_no.x*CHROMA_MOD_FREQ; | |
| 2463 | float i_mod1=cos( mod_phase1 ); | |
| 2464 | float q_mod1=sin( mod_phase1 ); | |
| 2465 | yiq1.yz*=float2(i_mod1,q_mod1); | |
| 2466 | yiq1=mul(mix_m,yiq1); | |
| 2467 | yiq1.yz*=float2(i_mod1,q_mod1); | |
| 2468 | yiq1.yz =lerp(yiq1.yz,temp.yz,MIT); | |
| 2469 | if(res>1.025) | |
| 2470 | {
| |
| 2471 | mod_phase1=chroma_phase1 +res *pix_no.x*CHROMA_MOD_FREQ; | |
| 2472 | i_mod1=cos(mod_phase1); | |
| 2473 | q_mod1=sin(mod_phase1); | |
| 2474 | yiqz.yz*=float2(i_mod1,q_mod1); | |
| 2475 | yiq1.x=dot(yiqz,mix_m[0]); | |
| 2476 | } | |
| 2477 | if(ntsc_phase==4.0){yiq1.x=lum;yiq2.x=lum;}
| |
| 2478 | if(MERGE>0.5){if(ntsc_rainbow<0.5||phase>2.5)yiq1=0.5*(yiq1+yiq2); else yiq1.x=0.5*(yiq1.x+yiq2.x);}
| |
| 2479 | return float4(yiq1,lum); | |
| 2480 | } | |
| 2481 | } | |
| 2482 | ||
| 2483 | float4 Signal_2_PS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2484 | {
| |
| 2485 | float chroma_filter_2_phase[33]={
| |
| 2486 | 0.001384762, 0.001678312, 0.002021715, 0.002420562, 0.002880460, 0.003406879, 0.004004985, 0.004679445, 0.005434218, 0.006272332, 0.007195654, | |
| 2487 | 0.008204665, 0.009298238, 0.010473450, 0.011725413, 0.013047155, 0.014429548, 0.015861306, 0.017329037, 0.018817382, 0.020309220, 0.021785952, | |
| 2488 | 0.023227857, 0.024614500, 0.025925203, 0.027139546, 0.028237893, 0.029201910, 0.030015081, 0.030663170, 0.031134640, 0.031420995, 0.031517031}; | |
| 2489 | float chroma_filter_3_phase[33]={
| |
| 2490 | 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000, | |
| 2491 | 0.000000000, 0.000000000, 0.000000000, | |
| 2492 | -0.000118847,-0.000271306,-0.000502642,-0.000930833,-0.001451013, | |
| 2493 | -0.002064744,-0.002700432,-0.003241276,-0.003524948,-0.003350284, | |
| 2494 | -0.002491729,-0.000721149, 0.002164659, 0.006313635, 0.011789103, | |
| 2495 | 0.018545660, 0.026414396, 0.035100710, 0.044196567, 0.053207202, | |
| 2496 | 0.061590275, 0.068803602, 0.074356193, 0.077856564, 0.079052396}; | |
| 2497 | float luma_filter_2_phase[33]={
| |
| 2498 | -0.000174844,-0.000205844,-0.000149453,-0.000051693, 0.000000000,-0.000066171,-0.000245058,-0.000432928,-0.000472644,-0.000252236, 0.000198929, | |
| 2499 | 0.000687058, 0.000944112, 0.000803467, 0.000363199, 0.000013422, 0.000253402, 0.001339461, 0.002932972, 0.003983485, 0.003026683,-0.001102056, | |
| 2500 | -0.008373026,-0.016897700,-0.022914480,-0.021642347,-0.028863273, 0.027271957, 0.054921920, 0.098342579, 0.139044281, 0.168055832, 0.178571429}; | |
| 2501 | float luma_filter_3_phase[33]={
| |
| 2502 | 0.000000000, 0.000000000, 0.000000000, 0.000000000, 0.000000000, | |
| 2503 | 0.000000000, 0.000000000, 0.000000000, | |
| 2504 | -0.000012020,-0.000022146,-0.000013155,-0.000012020,-0.000049979, | |
| 2505 | -0.000113940,-0.000122150,-0.000005612, 0.000170516, 0.000237199, | |
| 2506 | 0.000169640, 0.000285688, 0.000984574, 0.002018683, 0.002002275, | |
| 2507 | -0.005909882,-0.012049081,-0.018222860,-0.022606931, 0.002460860, | |
| 2508 | 0.035868225, 0.084016453, 0.135563500, 0.175261268, 0.220176552}; | |
| 2509 | const int TAPS_2_phase=32; | |
| 2510 | const int TAPS_3_phase=24; | |
| 2511 | float2 tex_c=texcoord+float2(0.5/speedup*OrgSize.z/4.0,0.0); | |
| 2512 | if (tex_c.x * speedup > (1.00325)) discard; | |
| 2513 | float NOrgSize = OrgSize.x / round(OrgSize.x / 300.0); | |
| 2514 | float phase= ( ntsc_phase<1.5)?((NOrgSize>300.0)?2.0:3.0):((ntsc_phase>2.5)?3.0:2.0); | |
| 2515 | float res = nscale; | |
| 2516 | ||
| 2517 | if (ntsc_dith > 0.005) | |
| 2518 | {
| |
| 2519 | float2 TexD = (floor(tex_c * OrgSize.xy) + 0.5)*OrgSize.zw; | |
| 2520 | float2 xx = float2(OrgSize.z, 0.0); | |
| 2521 | ||
| 2522 | float ca = texCD(JoNTSC_S03, TexD - xx - xx).a; | |
| 2523 | float c0 = texCD(JoNTSC_S03, TexD - xx).a; | |
| 2524 | float c1 = texCD(JoNTSC_S03, TexD ).a; | |
| 2525 | float c2 = texCD(JoNTSC_S03, TexD + xx).a; | |
| 2526 | float cb = texCD(JoNTSC_S03, TexD + xx + xx).a; | |
| 2527 | ||
| 2528 | float line0 = smothstep(0.0075, 0.0, min(abs(c1-c0),abs(c2-c1))); | |
| 2529 | float line1 = max(smothstep(0.0075, 0.0, min(abs(ca-c0),abs(c2-cb))), line0); | |
| 2530 | float line2 = max(smothstep(0.0075, 0.0, min(abs(ca-c2),abs(c0-cb))), line1); | |
| 2531 | res /= 1.0 + (1.0-line2) * ntsc_dith; | |
| 2532 | } | |
| 2533 | ||
| 2534 | float ntsc_sizex = (phase == 2.0) ? 320.0 : 256.0; | |
| 2535 | float2 one_x = 0.25 / ntsc_sizex.xx; | |
| 2536 | one_x.x = one_x.x / res / speedup; | |
| 2537 | one_x.y = one_x.y / speedup; | |
| 2538 | ||
| 2539 | float3 signal = 0.0; | |
| 2540 | if(ntsc_phase>3.5){phase=3.0;luma_filter_3_phase=luma_filter_2_phase;}
| |
| 2541 | float offset=0.0;int i=0; float j =0.0; | |
| 2542 | float3 wsum =0.0.xxx; | |
| 2543 | float3 sums=wsum; | |
| 2544 | float3 tmps=wsum; | |
| 2545 | if(phase<2.5) | |
| 2546 | {
| |
| 2547 | float loop=max(ntsc_taps,8.0); | |
| 2548 | if(ntsc_charp1>0.25)loop=min(loop,14.0); | |
| 2549 | int loopstart=int(TAPS_2_phase-loop); | |
| 2550 | float loob=loop+1.0; | |
| 2551 | float ssub=loop-loop/ntsc_cscale1; | |
| 2552 | float taps=0.0; | |
| 2553 | float mit=1.0+0.04*pow(swoothstep(16.0,8.0,loop),0.5); | |
| 2554 | float2 dx=float2(one_x.x*mit,0.0); float2 xd=dx; | |
| 2555 | for(i=loopstart;i<32;i++) | |
| 2556 | {
| |
| 2557 | offset=float(i-loopstart); j=offset+1.0;xd= (offset-loop)*dx; | |
| 2558 | sums=fetch_offset1(xd); taps=max(j-ssub,0.0); | |
| 2559 | tmps=float3(luma_filter_2_phase[max(i,0)], taps.xx ); | |
| 2560 | wsum=wsum+tmps; | |
| 2561 | signal+=sums*tmps; | |
| 2562 | } | |
| 2563 | taps=loob-ssub; | |
| 2564 | tmps=float3(luma_filter_2_phase[TAPS_2_phase], taps.xx); | |
| 2565 | wsum=wsum+wsum+tmps; | |
| 2566 | signal+=texCD(JoNTSC_S03,tex_c).xyz*tmps; | |
| 2567 | signal =signal/wsum; | |
| 2568 | }else | |
| 2569 | {
| |
| 2570 | one_x.y=one_x.y/ntsc_cscale2; | |
| 2571 | float3 dx=float3(one_x.x,one_x.y,0.0); | |
| 2572 | float mit=1.0; | |
| 2573 | float loop=min(ntsc_taps,TAPS_3_phase); | |
| 2574 | if(ntsc_phase>3.5){loop=max(loop,8.0); mit=1.0+0.04*pow(swoothstep(16.0,8.0,loop),0.5);}
| |
| 2575 | float3 xd=dx; dx.x*=mit; | |
| 2576 | int loopstart=int(32.0-loop); | |
| 2577 | for(i=loopstart;i<32;i++) | |
| 2578 | {
| |
| 2579 | offset=float(i-loopstart); xd.xy=(offset-loop)*dx.xy; | |
| 2580 | sums=fetch_offset2(xd); | |
| 2581 | tmps=float3(luma_filter_3_phase[i], chroma_filter_3_phase[i].xx); | |
| 2582 | wsum=wsum+tmps; | |
| 2583 | signal+=sums*tmps; | |
| 2584 | } | |
| 2585 | tmps=float3(luma_filter_3_phase[TAPS_2_phase], chroma_filter_3_phase[TAPS_2_phase], chroma_filter_3_phase[TAPS_2_phase]); | |
| 2586 | wsum=wsum+wsum+tmps; | |
| 2587 | signal+=texCD(JoNTSC_S03,tex_c).xyz*tmps; | |
| 2588 | signal =signal/wsum; | |
| 2589 | } | |
| 2590 | signal.x=clamp( signal.x,0.0,1.0); | |
| 2591 | if(ntsc_ring>0.05) | |
| 2592 | {
| |
| 2593 | float2 dx=float2(OrgSize.z/min(res,1.0)/speedup,0.0); | |
| 2594 | float a=texCD(JoNTSC_S03,tex_c-2.0*dx).a; | |
| 2595 | float b=texCD(JoNTSC_S03,tex_c- dx).a; | |
| 2596 | float c=texCD(JoNTSC_S03,tex_c+2.0*dx).a; | |
| 2597 | float d=texCD(JoNTSC_S03,tex_c+ dx).a; | |
| 2598 | float e=texCD(JoNTSC_S03,tex_c ).a; | |
| 2599 | signal.x=lerp(signal.x,clamp(signal.x,min(min(min(a,b),min(c,d)),e),max(max(max(a,b),max(c,d)),e)),ntsc_ring); | |
| 2600 | } | |
| 2601 | float x=get_luma(texCD(JoNTSC_S02, tex_c*float2(speedup, 1.0)).rgb); | |
| 2602 | return float4(signal,x); | |
| 2603 | } | |
| 2604 | ||
| 2605 | float4 Signal_3_PS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2606 | {
| |
| 2607 | float2 vtex_c0=texcoord / float2(speedup, 1.0); | |
| 2608 | float2 vtex_c1=(floor(vtex_c0*OrgSize.xy)+0.5)*OrgSize.zw; | |
| 2609 | float2 vtex_c=texcoord+float2(0.5*OrgSize.z/4.0,0.0); | |
| 2610 | ||
| 2611 | float4 AdvSize= LumSize; | |
| 2612 | ||
| 2613 | if(speedup > 1.25 && ((OrgSize.y > 500.0 && AdvSize.y > 820.0) || AdvSize.y > 820.0)) | |
| 2614 | {
| |
| 2615 | float3 signal = texCD(JoNTSC_S04, vtex_c0).xyz; | |
| 2616 | signal.x = pow(signal.x, 1.0/ntsc_gamma); | |
| 2617 | return float4(clamp(yiq2rgb(signal), 0.0, 1.0), 1.0); | |
| 2618 | } | |
| 2619 | else | |
| 2620 | {
| |
| 2621 | ||
| 2622 | float2 dx=float2(0.0625*OrgSize.z / speedup,0.0); | |
| 2623 | float2 xx=float2(0.5000*OrgSize.z / speedup,0.0); | |
| 2624 | ||
| 2625 | float2 tcoorb=(floor(OrgSize.xy*vtex_c)+0.5)*OrgSize.zw; | |
| 2626 | float2 tcoord=vtex_c-2.0*dx; | |
| 2627 | float2 vTex=vtex_c; | |
| 2628 | if (speedup > 1.25) { tcoorb = vtex_c1; tcoord = vtex_c0; vTex = vtex_c0; }
| |
| 2629 | float3 ll1=texCD(JoNTSC_S04,tcoord+ xx).xyz; | |
| 2630 | float3 ll2=texCD(JoNTSC_S04,tcoord- xx).xyz; | |
| 2631 | float dy=0.0; | |
| 2632 | float2 yy = float2(0.0, OrgSize.w); | |
| 2633 | xx=float2(OrgSize.z/speedup,0.0); | |
| 2634 | float phase= (ntsc_phase<1.5)?((OrgSize.x>300.0)? 2.0:3.0):((ntsc_phase>2.5)?3.0:2.0); | |
| 2635 | if(ntsc_phase>3.5)phase=3.0; | |
| 2636 | float th=(phase<2.5)?0.025:0.0075;; | |
| 2637 | float ca=texCD(JoNTSC_S03,tcoorb-xx-xx).a; | |
| 2638 | float c0=texCD(JoNTSC_S03,tcoorb-xx ).a; | |
| 2639 | float c1=texCD(JoNTSC_S03,tcoorb ).a; | |
| 2640 | float c2=texCD(JoNTSC_S03,tcoorb+xx ).a; | |
| 2641 | float cb=texCD(JoNTSC_S03,tcoorb+xx+xx).a; | |
| 2642 | float line0= swoothstep(th,0.0,min(abs(c1-c0),abs(c2-c1))); | |
| 2643 | float line1=max(swoothstep(th,0.0,min(abs(ca-c0),abs(c2-cb))), line0 ); | |
| 2644 | float line2=max(swoothstep(th,0.0,min(abs(ca-c2),abs(c0-cb))), line1 ); | |
| 2645 | ||
| 2646 | float diffboost = 0.0; | |
| 2647 | ||
| 2648 | if (ntsc_fonts > 0.255) | |
| 2649 | {
| |
| 2650 | float b1 = texCD(JoNTSC_S03, tcoorb - yy).a; | |
| 2651 | float d1 = texCD(JoNTSC_S03, tcoorb + yy).a; | |
| 2652 | float d2 = texCD(JoNTSC_S03, tcoorb + xx + yy).a; | |
| 2653 | ||
| 2654 | float maxdif = float(0.5 * (abs(c0-c1) + abs(c1-c2)) > (1.0 - ntsc_fonts)) * float(abs(c2-c0) < 0.05); | |
| 2655 | float linecb = swoothstep(0.1, 0.0, max(abs(c1-b1), abs(c1-d1))); | |
| 2656 | linecb = linecb * float(abs(c1-b1) < 0.05 || abs(c2-d2) < 0.05); | |
| 2657 | ||
| 2658 | float xdif1 = 0.0; | |
| 2659 | float xdif2 = 0.0; | |
| 2660 | float th = 0.215; | |
| 2661 | ||
| 2662 | for (float i = 0.5; i < 10.5; i++) | |
| 2663 | {
| |
| 2664 | float j = i + 1.0; | |
| 2665 | ca = texCD(JoNTSC_S04, tcoord - i*xx).x; | |
| 2666 | c0 = texCD(JoNTSC_S04, tcoord - j*xx).x; | |
| 2667 | c2 = texCD(JoNTSC_S04, tcoord + i*xx).x; | |
| 2668 | cb = texCD(JoNTSC_S04, tcoord + j*xx).x; | |
| 2669 | xdif1 = max(abs(ca - c0) - th, xdif1); | |
| 2670 | xdif2 = max(abs(cb - c2) - th, xdif2); | |
| 2671 | } | |
| 2672 | ||
| 2673 | float linex = swoothstep(0.0, 0.125, min(xdif1, xdif2)); | |
| 2674 | diffboost = min(linex * linecb * maxdif, 0.625); | |
| 2675 | } | |
| 2676 | ||
| 2677 | float3 ref = texCD(JoNTSC_S04, tcoord).xyz; | |
| 2678 | float2 org = ref.yz; | |
| 2679 | if( ntsc_rainbow>0.5&&(phase<2.5 || ntsc_phase == 5.0)) | |
| 2680 | {
| |
| 2681 | float ybool1=1.0; | |
| 2682 | if((ntsc_rainbow<1.5)&&bool(line0))ybool1=0.0;else | |
| 2683 | if((ntsc_rainbow<2.5)&&bool(line2))ybool1=0.0; | |
| 2684 | ||
| 2685 | float liine_no=floor( mod(OrgSize.y*vtex_c.y,2.0)); | |
| 2686 | float frame_no=floor( mod(float(framecount),2.0)); | |
| 2687 | float ii=abs(liine_no-frame_no); | |
| 2688 | dy=ii*OrgSize.w*ybool1; | |
| 2689 | float2 ref1 = texCD(JoNTSC_S04, tcoord + float2(0.0, -dy)).yz; | |
| 2690 | ||
| 2691 | float2 ref2 = texCD(JoNTSC_S04, tcoord + float2(0.0, dy)).yz; | |
| 2692 | float2 rdf1 = abs(org - ref1); | |
| 2693 | float2 rdf2 = abs(org - ref2); | |
| 2694 | rdf1 = rdf1 / max(rdf1 + rdf2, 0.0000001); | |
| 2695 | ||
| 2696 | ref.yz = lerp(ref1, ref2, rdf1); | |
| 2697 | } | |
| 2698 | float lum1=min(texCD(JoNTSC_S03,vTex-dx).a, texCD(JoNTSC_S03,vTex+dx).a); | |
| 2699 | float lum2=ref.x ; | |
| 2700 | float3 ll3=abs(ll1-ll2); | |
| 2701 | float di=max(max(max(ll3.x,ll3.y),max(ll3.z,abs(ll1.x*ll1.x-ll2.x*ll2.x))),diffboost); | |
| 2702 | float df=pow(di,0.125); | |
| 2703 | float lc=swoothstep(0.20,0.10,abs(lum2-lum1))*df; | |
| 2704 | float tmp1=swoothstep(0.05-0.03*lc,0.425-0.375*lc,di); | |
| 2705 | float tmp2=pow((tmp1+0.1)/1.1,0.25); | |
| 2706 | float sweight=lerp(tmp1,tmp2,line0); | |
| 2707 | float zweight=lerp(tmp1,tmp2,line2); | |
| 2708 | float3 signal=ref; | |
| 2709 | float ntzc_shrp= abs(ntsc_shrp); | |
| 2710 | if(ntzc_shrp>0.25 || ntsc_fonts > 0.255) | |
| 2711 | {
| |
| 2712 | float mixer=zweight; | |
| 2713 | if(ntsc_shrp < -0.25)mixer=sweight; mixer*=max(0.1*ntzc_shrp, diffboost*1.25); | |
| 2714 | float lumix=lerp(lum2,lum1,mixer); | |
| 2715 | float lm1=lerp(lum2*lum2 ,lum1*lum1 ,mixer);lm1=sqrt(lm1); | |
| 2716 | float lm2=lerp(sqrt(lum2),sqrt(lum1),mixer);lm2=lm2* lm2 ; | |
| 2717 | float k1=abs(lumix-lm1)+0.00001; | |
| 2718 | float k2=abs(lumix-lm2)+0.00001; | |
| 2719 | signal.x=min((k2*lm1+k1*lm2)/(k1+k2),1.0); | |
| 2720 | signal.x=min(signal.x,max(ntsc_shpe*signal.x,lum2)); | |
| 2721 | } | |
| 2722 | if((ntsc_charp1+ntsc_charp2)>0.25) | |
| 2723 | {
| |
| 2724 | dx.x = 0.0625 * OrgSize.z; | |
| 2725 | float lcoord=OrgSize.x*(vtex_c.x+dx.x )-0.5; | |
| 2726 | float fpx=frac(lcoord); | |
| 2727 | lcoord =(floor(lcoord)+0.5)*OrgSize.z; | |
| 2728 | float mixer=sweight; | |
| 2729 | if(ntsc_shrp>0.25)mixer=zweight; | |
| 2730 | mixer =lerp(swoothstep(0.075,0.125,max(ll3.y,ll3.z)),swoothstep(0.015,0.0275,di),line2)*mixer; | |
| 2731 | mixer*=0.1*((phase<2.5)? ntsc_charp1:ntsc_charp2); | |
| 2732 | tcoord=float2(lcoord,tcoord.y); | |
| 2733 | float3 origin=rgb2yiq(lerp(texCD(JoNTSC_S02,tcoord).rgb,texCD(JoNTSC_S02,tcoord+16.0*dx).rgb,clamp(1.5*fpx-0.25,0.0,1.0))); | |
| 2734 | signal.yz=lerp(signal.yz,origin.yz,mixer); | |
| 2735 | } | |
| 2736 | ||
| 2737 | if ((RFNOISE1 + RFNOISE2) > 0.005) | |
| 2738 | {
| |
| 2739 | float3 ns = NoiseNP3(vtex_c, float(framecount)); | |
| 2740 | float Y = lerp(0.375, 1.0, pow(signal.x, 0.2)); | |
| 2741 | ||
| 2742 | signal.x = clamp(signal.x + RFNOISE1 * ns.x, 0.00, 1.00); | |
| 2743 | signal.y = clamp(signal.y + Y * RFNOISE2 * (0.325 + 1.325 * abs(signal.y)) * ns.y, -0.60, 0.60); | |
| 2744 | signal.z = clamp(signal.z + Y * RFNOISE2 * (0.325 + 1.325 * abs(signal.z)) * ns.z, -0.53, 0.53); | |
| 2745 | } | |
| 2746 | signal.x=pow(signal.x,1.0/ntsc_gamma); | |
| 2747 | signal=clamp(yiq2rgb(signal),0.0,1.0); | |
| 2748 | zweight = (phase == 2.0 || ntsc_phase > 3.5) ? zweight : 1.0; | |
| 2749 | return float4(signal,zweight); | |
| 2750 | } | |
| 2751 | } | |
| 2752 | ||
| 2753 | float4 SharpnessPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2754 | {
| |
| 2755 | float resmult = round(OrgSize.x / 300.0); | |
| 2756 | float2 g01=float2(-0.5*resmult*OrgSize.z,0.0); | |
| 2757 | float2 g21=float2( 0.5*resmult*OrgSize.z,0.0); | |
| 2758 | float3 c01=texCD(JoNTSC_S05,texcoord+g01).rgb; | |
| 2759 | float3 c21=texCD(JoNTSC_S05,texcoord+g21).rgb; | |
| 2760 | float3 c11=texCD(JoNTSC_S05,texcoord ).rgb; | |
| 2761 | float3 b11=0.5*(c01+c21); | |
| 2762 | float contrazt=max(max(c11.r,c11.g),c11.b); | |
| 2763 | contrazt=lerp(2.0*CCONTR,CCONTR,contrazt); | |
| 2764 | float3 nim=min(min(c01,c21),c11);float3 mn1=min(nim,c11*(1.0-contrazt)); | |
| 2765 | float3 xam=max(max(c01,c21),c11);float3 mx1=max(xam,c11*(1.0+contrazt)); | |
| 2766 | float3 di0=pow(mx1-mn1+0.00001,0.75); | |
| 2767 | float3 sharpen=lerp(CSHARPEN*CDETAILS,CSHARPEN,di0); | |
| 2768 | float3 res=clamp(lerp(c11,b11,-sharpen),mn1,mx1); | |
| 2769 | if(NDEBLUR>1.125) | |
| 2770 | {
| |
| 2771 | float2 toxcoord=(floor(OrgSize.xy*texcoord)+0.5)*OrgSize.zw; | |
| 2772 | float l01=get_luma(texCD(JoNTSC_S02,texcoord+2.0*g01).rgb); | |
| 2773 | float l21=get_luma(texCD(JoNTSC_S02,texcoord+2.0*g21).rgb); | |
| 2774 | float l11=get_luma(texCD(JoNTSC_S02,toxcoord ).rgb); | |
| 2775 | float dth = texCD(JoNTSC_S05,texcoord).a; | |
| 2776 | float DEB = max(lerp(0.375*NDEBLUR, NDEBLUR, max(1.0-DSMART, dth)), 1.0); | |
| 2777 | float d11=min(min(l01,l21),l11); | |
| 2778 | l11=max(max(l01,l21),l11); | |
| 2779 | float lmn=min(min(get_luma(c01),get_luma(c21)),get_luma(c11));float ln1=min(lerp(d11,lmn,lmn),lmn); | |
| 2780 | float lmx=max(max(get_luma(c01),get_luma(c21)),get_luma(c11));float lx1=max(lerp(lmx,l11,lmx),lmx); | |
| 2781 | float r11=get_luma(res); | |
| 2782 | float di1=max((r11-ln1),0.0)+0.00001;di1=pow(di1,DEB); | |
| 2783 | float di2=max((lx1-r11),0.0)+0.00001;di2=pow(di2,DEB); | |
| 2784 | float ratio=di1/(di1+di2); | |
| 2785 | float zharpen=lerp(ln1,lx1,ratio); | |
| 2786 | zharpen=min(zharpen,max(DREDGE*zharpen,r11)); | |
| 2787 | res=rgb2yiq(res); | |
| 2788 | d11=res.x; | |
| 2789 | res.x=zharpen; | |
| 2790 | res.x=clamp((1.0+ DSHARP)* res.x-DSHARP*d11,ln1*(1.0-contrazt),lx1*(1.0+contrazt)); | |
| 2791 | res=max(yiq2rgb(res),0.0); | |
| 2792 | } | |
| 2793 | return float4(res,1.0); | |
| 2794 | } | |
| 2795 | ||
| 2796 | float4 PS_CRT_BlackCrush_AvgLum(float4 position:SV_Position,float2 texcoord:TEXCOORD) : SV_Target | |
| 2797 | {
| |
| 2798 | float vTsmooth = 0.8; | |
| 2799 | const float tsmooth_at_60 = 0.8; | |
| 2800 | const float tsmooth_at_30 = 0.65; | |
| 2801 | float t = (60.0 - get_fps()) / 30.0; | |
| 2802 | vTsmooth = lerp(tsmooth_at_60, tsmooth_at_30, t); | |
| 2803 | ||
| 2804 | float3 c_current = texCD(JoNTSC_S06, texcoord).rgb; | |
| 2805 | float lum_past = texCD(JBCrsh_S01, texcoord).a; | |
| 2806 | float lum_current = (c_current.r + c_current.g + c_current.b) / 3.0; | |
| 2807 | ||
| 2808 | if (framecount == 0.0) lum_past = lum_current; | |
| 2809 | float lum_avg = lerp(lum_current, lum_past, vTsmooth); | |
| 2810 | return float4(c_current, lum_avg); | |
| 2811 | } | |
| 2812 | ||
| 2813 | float4 PS_CRT_BlackCrush(float4 position:SV_Position,float2 texcoord:TEXCOORD) : SV_Target | |
| 2814 | {
| |
| 2815 | float lum = tex2Dlod(JBCrsh_S01, float4(float2(0.5,0.5), 20.0,0)).a; | |
| 2816 | float3 c = texCD(JoNTSC_S06, texcoord).rgb; | |
| 2817 | c = adaptive_black(c, lum, abs(ADPT_BLK_RANGE),ADPT_BLK_RANGE > 0.0); | |
| 2818 | ||
| 2819 | return float4(c, 1.0); | |
| 2820 | } | |
| 2821 | ||
| 2822 | float4 LuminancePS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2823 | {
| |
| 2824 | float m=max(log2(LumSize.x),log2(LumSize.y)); | |
| 2825 | m=floor(max(m,1.0))-1.0; | |
| 2826 | float2 dx=float2(1.0/LumSize.x,0.0); | |
| 2827 | float2 dy=float2(0.0,1.0/LumSize.y); | |
| 2828 | float2 x2=2.0*dx; | |
| 2829 | float2 y2=2.0*dy; | |
| 2830 | float ltotal=0.0; | |
| 2831 | ltotal+=length(tex2Dlod(JBCrsh_S02,float4(float2(0.3,0.3),m,0)).rgb); | |
| 2832 | ltotal+=length(tex2Dlod(JBCrsh_S02,float4(float2(0.3,0.7),m,0)).rgb); | |
| 2833 | ltotal+=length(tex2Dlod(JBCrsh_S02,float4(float2(0.7,0.3),m,0)).rgb); | |
| 2834 | ltotal+=length(tex2Dlod(JBCrsh_S02,float4(float2(0.7,0.7),m,0)).rgb); | |
| 2835 | ltotal*=0.25; | |
| 2836 | ltotal=pow(0.577350269*ltotal,0.7); | |
| 2837 | float lhistory=texCD(JoNTSC_S07,float2(0.5,0.5)).a; | |
| 2838 | ltotal=lerp(ltotal,lhistory,min(lerp(lsmooth, lsmooth + lsdev, ltotal),0.99)); | |
| 2839 | float3 l1=texCD(JBCrsh_S02,fuxcoord.xy ).rgb; | |
| 2840 | float3 r1=texCD(JBCrsh_S02,fuxcoord.xy+dx).rgb; | |
| 2841 | float3 l2=texCD(JBCrsh_S02,fuxcoord.xy-dx).rgb; | |
| 2842 | float3 r2=texCD(JBCrsh_S02,fuxcoord.xy+x2).rgb; | |
| 2843 | float c1=dist(l2,l1); | |
| 2844 | float c2=dist(l1,r1); | |
| 2845 | float c3=dist(r2,r1); | |
| 2846 | return float4(c1,c2,c3,ltotal); | |
| 2847 | } | |
| 2848 | ||
| 2849 | ||
| 2850 | float4 LinearizeNewPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2851 | {
| |
| 2852 | float3 c = texCD(JBCrsh_S02,fuxcoord).rgb; | |
| 2853 | if((downsample_levelx+downsample_levely)>0.025) | |
| 2854 | {
| |
| 2855 | c=fetch_pixel(fuxcoord); | |
| 2856 | } | |
| 2857 | float intera = texCD(JoNTSC_S0I,fuxcoord).a; | |
| 2858 | float gamma_in=gamma_i; | |
| 2859 | c=pow(c,gamma_in); | |
| 2860 | if(fuxcoord.x>0.5)gamma_in=intera;else gamma_in=1.0/gamma_in; | |
| 2861 | return float4(c,gamma_in); | |
| 2862 | } | |
| 2863 | ||
| 2864 | float4 HGaussianPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2865 | {
| |
| 2866 | float FINE_GAUSS= (FINE_GAUSS>0.5)? FINE_GAUSS: lerp(0.75,0.50,-FINE_GAUSS); | |
| 2867 | float4 AdvSize=float4(OrgSize.x,OrgSize.y,OrgSize.z,OrgSize.w)*float4(FINE_GAUSS,FINE_GAUSS,1.0/FINE_GAUSS,1.0/FINE_GAUSS); | |
| 2868 | float f=frac(AdvSize.x*texcoord.x); | |
| 2869 | f=0.5-f; | |
| 2870 | float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw; | |
| 2871 | float3 color=0.0; | |
| 2872 | float2 dx=float2(AdvSize.z ,0.0); | |
| 2873 | float3 pixel; | |
| 2874 | float w; | |
| 2875 | float wsum=0.0; | |
| 2876 | float n=-SIZEH; | |
| 2877 | do | |
| 2878 | {
| |
| 2879 | pixel=texCD(JoNTSC_S08,tex+n*dx).rgb; | |
| 2880 | if(m_glow>0.5) | |
| 2881 | {
| |
| 2882 | pixel=max(pixel-m_glow_cutoff,0.0); | |
| 2883 | pixel=plant(pixel,max(max(max(pixel.r,pixel.g),pixel.b)-m_glow_cutoff,0.0)); | |
| 2884 | } | |
| 2885 | w=gauss_h(n+f); | |
| 2886 | color=color+w*pixel; | |
| 2887 | wsum=wsum+w; | |
| 2888 | n=n+1.0; | |
| 2889 | } | |
| 2890 | while(n<=SIZEH); | |
| 2891 | color=color/wsum; | |
| 2892 | return float4(color,1.0); | |
| 2893 | } | |
| 2894 | ||
| 2895 | float4 VGaussianPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2896 | {
| |
| 2897 | float FINE_GAUSS= (FINE_GAUSS>0.5)? FINE_GAUSS: lerp(0.75,0.50,-FINE_GAUSS); | |
| 2898 | float4 AdvSize=float4(SrcSize.x,OrgSize.y,SrcSize.z,OrgSize.w)*float4(FINE_GAUSS,FINE_GAUSS,1.0/FINE_GAUSS,1.0/FINE_GAUSS); | |
| 2899 | float f=frac(AdvSize.y*texcoord.y); | |
| 2900 | f=0.5-f; | |
| 2901 | float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw; | |
| 2902 | float3 color=0.0; | |
| 2903 | float2 dy=float2(0.0,AdvSize.w ); | |
| 2904 | float3 pixel; | |
| 2905 | float w; | |
| 2906 | float wsum=0.0; | |
| 2907 | float n=-SIZEV; | |
| 2908 | do | |
| 2909 | {
| |
| 2910 | pixel=texCD(JoNTSC_S10,tex+n*dy).rgb; | |
| 2911 | w=gauss_v(n+f); | |
| 2912 | color=color+w*pixel; | |
| 2913 | wsum=wsum+w; | |
| 2914 | n=n+1.0; | |
| 2915 | } | |
| 2916 | while(n<=SIZEV); | |
| 2917 | color=color/wsum; | |
| 2918 | return float4(color,1.0); | |
| 2919 | } | |
| 2920 | ||
| 2921 | float4 BloomHorzPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2922 | {
| |
| 2923 | float FINE_BLOOM= (FINE_BLOOM>0.5)? FINE_BLOOM: lerp(0.75,0.50,-FINE_BLOOM); | |
| 2924 | float4 AdvSize=float4(OrgSize.x,OrgSize.y,OrgSize.z,OrgSize.w)*float4(FINE_BLOOM,FINE_BLOOM,1.0/FINE_BLOOM,1.0/FINE_BLOOM); | |
| 2925 | float f=frac(AdvSize.x*texcoord.x); | |
| 2926 | f=0.5-f; | |
| 2927 | float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw; | |
| 2928 | float4 color=0.0; | |
| 2929 | float2 dx=float2(AdvSize.z ,0.0); | |
| 2930 | float4 pixel; | |
| 2931 | float w; | |
| 2932 | float wsum=0.0; | |
| 2933 | float n=-SIZEX; | |
| 2934 | do | |
| 2935 | {
| |
| 2936 | pixel=texCD(JoNTSC_S08,tex+n*dx); | |
| 2937 | w=bloom_h(n+f); | |
| 2938 | pixel.a =max(max(pixel.r,pixel.g),pixel.b); | |
| 2939 | pixel.a*=pixel.a*pixel.a; | |
| 2940 | color=color+w*pixel; | |
| 2941 | wsum=wsum+w; | |
| 2942 | n=n+1.0; | |
| 2943 | } | |
| 2944 | while(n<=SIZEX); | |
| 2945 | color=color/wsum; | |
| 2946 | return float4(color.rgb,pow(color.a,0.333333)); | |
| 2947 | } | |
| 2948 | ||
| 2949 | float4 BloomVertPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2950 | {
| |
| 2951 | float FINE_BLOOM= (FINE_BLOOM>0.5)? FINE_BLOOM: lerp(0.75,0.50,-FINE_BLOOM); | |
| 2952 | float4 AdvSize=float4(SrcSize.x,OrgSize.y,SrcSize.z,OrgSize.w)*float4(FINE_BLOOM,FINE_BLOOM,1.0/FINE_BLOOM,1.0/FINE_BLOOM); | |
| 2953 | float f=frac(AdvSize.y*texcoord.y); | |
| 2954 | f=0.5-f; | |
| 2955 | float2 tex=floor(AdvSize.xy*texcoord)*AdvSize.zw+0.5*AdvSize.zw; | |
| 2956 | float4 color=0.0; | |
| 2957 | float2 dy=float2(0.0,AdvSize.w ); | |
| 2958 | float4 pixel; | |
| 2959 | float w; | |
| 2960 | float wsum=0.0; | |
| 2961 | float n=-SIZEY; | |
| 2962 | do | |
| 2963 | {
| |
| 2964 | pixel=texCD(JoNTSC_S12,tex+n*dy); | |
| 2965 | w=bloom_v(n+f); | |
| 2966 | pixel.a*=pixel.a*pixel.a; | |
| 2967 | color=color+w*pixel; | |
| 2968 | wsum=wsum+w; | |
| 2969 | n=n+1.0; | |
| 2970 | } | |
| 2971 | while(n<=SIZEY); | |
| 2972 | color=color/wsum; | |
| 2973 | return float4(color.rgb,pow(color.a,0.175000)); | |
| 2974 | } | |
| 2975 | ||
| 2976 | float4 NTSC_TV1_PS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 2977 | {
| |
| 2978 | float f=frac(LumSize.x*fuxcoord.x); | |
| 2979 | f=0.5-f; | |
| 2980 | float2 tex=floor(LumSize.xy*fuxcoord)*LumSize.zw+0.5*LumSize.zw; | |
| 2981 | float3 color=0.0.xxx; | |
| 2982 | float solor=0.0; | |
| 2983 | float2 dx=float2(LumSize.z ,0.0); | |
| 2984 | float3 pixel; | |
| 2985 | float w=0.0; | |
| 2986 | float swum=0.0; | |
| 2987 | float wsum=0.0; | |
| 2988 | float3 cmax=0.0.xxx; | |
| 2989 | float3 cmin=1.0.xxx; | |
| 2990 | float xs=max(2.0*0.4, 1.0); | |
| 2991 | float hsharpness=HSHARPNESS*xs*filter_res; | |
| 2992 | float LIGMA_H2 = LIGMA_H * HSHARPNESS; | |
| 2993 | xs=1.0/(2.0*LIGMA_H2*LIGMA_H2*xs*xs*filter_res*filter_res); | |
| 2994 | float sharp=crthd_h(hsharpness,xs) *S_SHARP; | |
| 2995 | float ksharp = -2.0*hsharpness*xs*sharp; | |
| 2996 | float maxsharp=MAXS; | |
| 2997 | float FPR=hsharpness; | |
| 2998 | float FPRi=1.0/hsharpness; | |
| 2999 | float fpx=0.0; | |
| 3000 | float sp=0.0; | |
| 3001 | float sw=0.0; | |
| 3002 | float ts=0.025; | |
| 3003 | float3 luma=float3(0.2126,0.7152,0.0722); | |
| 3004 | float LOOPSIZE=ceil(2.0*FPR); | |
| 3005 | float n=-LOOPSIZE; | |
| 3006 | do | |
| 3007 | {
| |
| 3008 | pixel=texCD(JoNTSC_S08,tex+n*dx).rgb; | |
| 3009 | w=crthd_h(n+f,xs)-sharp; | |
| 3010 | fpx=clamp((abs(n+f)-FPR)*FPRi, 0.0, 1.0); | |
| 3011 | if(w<0.0)w=max(ksharp*fpx, maxsharp * ksharp * (1.0-fpx*fpx)); else | |
| 3012 | {
| |
| 3013 | cmax=max(cmax,pixel);cmin=min(cmin,pixel);sw=w*(dot(pixel,luma)+ts); | |
| 3014 | sp=max(max(pixel.r,pixel.g),pixel.b); | |
| 3015 | solor=solor+sw*sp; | |
| 3016 | swum=swum+sw; | |
| 3017 | } | |
| 3018 | color=color+w*pixel; | |
| 3019 | wsum=wsum+w; | |
| 3020 | n=n+1.0; | |
| 3021 | } | |
| 3022 | while(n<=LOOPSIZE); | |
| 3023 | color=color/wsum; | |
| 3024 | solor=solor/swum; | |
| 3025 | color=clamp(lerp( clamp (color,cmin,cmax),color,SSRNG),0.0,1.0); | |
| 3026 | solor=clamp(lerp(max(max(color.r,color.g),color.b),solor,spike),0.0,1.0); | |
| 3027 | return float4(color,solor); | |
| 3028 | } | |
| 3029 | ||
| 3030 | float4 NTSC_TV2_PS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 3031 | {
| |
| 3032 | float gamma_in=1.0/texCD(JoNTSC_S08,float2(0.25,0.25)).a; | |
| 3033 | float lum=texCD(JoNTSC_S07,float2(0.5,0.5)).a; | |
| 3034 | float intera=texCD(JoNTSC_S08,float2(0.75,0.25)).a; | |
| 3035 | bool hscans=(hiscan>0.5); | |
| 3036 | bool inter6=(intera<0.35&&interm==6.0); | |
| 3037 | bool interb=(((intera<0.35&&!inter6)||(no_scanlines>0.025))&&!hscans); | |
| 3038 | float4 AdvSize= LumSize; | |
| 3039 | float SourceY=AdvSize.y; | |
| 3040 | float sy=1.0; | |
| 3041 | if( intres==1.0)sy=max(round(SourceY/224.0),1.0); | |
| 3042 | if( intres>0.25&&intres!=1.0)sy=intres; | |
| 3043 | if (inter6) sy*=2.0; | |
| 3044 | AdvSize*=float4(1.0,1.0/sy,1.0,sy); | |
| 3045 | float2 lexcoord=fuxcoord.xy; | |
| 3046 | if(IOS> 0.0&& !interb) | |
| 3047 | {
| |
| 3048 | float2 ofactor= NewSize.xy/OrgSize.xy; | |
| 3049 | float2 ifactor=(IOS<2.5)? floor(ofactor):ceil(ofactor); | |
| 3050 | float2 diff=ofactor/ifactor; | |
| 3051 | float scan=diff.y; | |
| 3052 | lexcoord=overscan(lexcoord,scan,scan); | |
| 3053 | if(IOS==1.0||IOS==3.0) lexcoord=float2(fuxcoord.x,lexcoord.y); | |
| 3054 | } | |
| 3055 | float factor=1.0+(1.0-0.5*OS)*blm_2/100.0-lum*blm_2/100.0; | |
| 3056 | lexcoord=overscan(lexcoord,factor,factor); | |
| 3057 | lexcoord.y = lexcoord.y - VShift*OrgSize.w; | |
| 3058 | lexcoord=overscan(lexcoord,(OrgSize.x-overscanx)/OrgSize.x,(OrgSize.y-overscany)/OrgSize.y); | |
| 3059 | float2 pos = warp(lexcoord); | |
| 3060 | float ii = float(inter6)*(floor(mod(float(framecount), 2.0))); | |
| 3061 | float2 coffset = float2(0.5, 0.5 + 0.5*ii); | |
| 3062 | float2 ps=AdvSize.zw; | |
| 3063 | float2 OGL2Pos=pos*AdvSize.xy-coffset; | |
| 3064 | float2 fp=frac(OGL2Pos); | |
| 3065 | float2 dx=float2(ps.x,0.0); | |
| 3066 | float2 dy=float2(0.0,ps.y); | |
| 3067 | float f=fp.y; | |
| 3068 | float2 pC4=floor(OGL2Pos)*ps+0.5*ps; pC4.y = pC4.y + float(inter6)*0.25*dy.y; | |
| 3069 | pC4.x=pos.x; | |
| 3070 | if( intres==0.5<1.5)pC4.y=floor(pC4.y*OrgSize.y)*OrgSize.w+0.5*OrgSize.w; | |
| 3071 | if( interb&&no_scanlines<0.025|| hscans) pC4.y=pos.y;else | |
| 3072 | if( interb) pC4.y=pC4.y+smoothstep(0.40-0.5*no_scanlines,0.60+0.5*no_scanlines,f)*AdvSize.w; | |
| 3073 | float3 color1=texCD(JoNTSC_S09,pC4).rgb; | |
| 3074 | float3 solor1=texCD(JoNTSC_S09,pC4).aaa; | |
| 3075 | if(!interb)color1=pow(color1,scangamma/gamma_in); | |
| 3076 | pC4+=dy; | |
| 3077 | if( intres==0.5<1.5)pC4.y=floor((pos.y+0.33*dy.y)*OrgSize.y)*OrgSize.w+0.5*OrgSize.w; | |
| 3078 | float3 color2=texCD(JoNTSC_S09,pC4).rgb; | |
| 3079 | float3 solor2=texCD(JoNTSC_S09,pC4).aaa; | |
| 3080 | if(!interb)color2=pow(color2,scangamma/gamma_in); | |
| 3081 | float3 ctmp=color1;float w3=1.0;float3 color=color1; | |
| 3082 | float3 one=1.0; | |
| 3083 | if( hscans){color2=color1;solor2=solor1;}
| |
| 3084 | if(!interb|| hscans) | |
| 3085 | {
| |
| 3086 | float ssub = ssharp*abs(solor1.x-solor2.x); | |
| 3087 | float shape1=lerp(scanline1,scanline2 + ssub * solor1.x * 35.0, f); | |
| 3088 | float shape2=lerp(scanline1,scanline2 + ssub * solor2.x * 35.0,1.0-f); | |
| 3089 | float wt1=st0( f); | |
| 3090 | float wt2=st0(1.0-f); | |
| 3091 | float3 color0=color1*wt1+color2*wt2; | |
| 3092 | float3 solor0=solor1*wt1+solor2*wt2; | |
| 3093 | ctmp = color0/(wt1+wt2); | |
| 3094 | float3 stmp=solor0/(wt1+wt2); | |
| 3095 | if(abs(rolling_scan)>0.005){color1=ctmp;color2=ctmp;solor1=stmp;solor2=stmp;}
| |
| 3096 | float3 w1,w2; | |
| 3097 | float3 cref1=lerp(stmp,solor1,beam_size);float creff1=pow(max(max(cref1.r,cref1.g),cref1.b),scan_falloff); | |
| 3098 | float3 cref2=lerp(stmp,solor2,beam_size);float creff2=pow(max(max(cref2.r,cref2.g),cref2.b),scan_falloff); | |
| 3099 | if(tds>0.5){shape1=lerp(scanline2,shape1,creff1);shape2=lerp(scanline2,shape2,creff2);}
| |
| 3100 | float scanpix=OrgSize.y/NewSize.y; | |
| 3101 | float f1=frac(f-rolling_scan*float(framecount)*scanpix); | |
| 3102 | float f2=1.0-f1; | |
| 3103 | float m1=max(max(color1.r,color1.g),color1.b)+eps; | |
| 3104 | float m2=max(max(color2.r,color2.g),color2.b)+eps; | |
| 3105 | cref1=color1/m1; | |
| 3106 | cref2=color2/m2; | |
| 3107 | if(gsl< 0.5) | |
| 3108 | {w1=sw0(f1,creff1,shape1,cref1);w2=sw0(f2,creff2,shape2,cref2);}else
| |
| 3109 | if(gsl==1.0) | |
| 3110 | {w1=sw1(f1,creff1,shape1,cref1);w2=sw1(f2,creff2,shape2,cref2);}else
| |
| 3111 | {w1=sw2(f1,creff1,shape1,cref1);w2=sw2(f2,creff2,shape2,cref2);}
| |
| 3112 | float3 w3=w1+w2; | |
| 3113 | float wf1=max(max(w3.r,w3.g),w3.b); | |
| 3114 | if(wf1>1.0){wf1=1.0/wf1;w1*=wf1,w2*=wf1;}
| |
| 3115 | if(abs(clp)>0.005) | |
| 3116 | {
| |
| 3117 | sy=m1; one=(clp>0.0)?w1:1.0.xxx; | |
| 3118 | float sat=1.0001-min(min(cref1.r,cref1.g),cref1.b); | |
| 3119 | color1=lerp(color1,plant(pow(color1,0.70.xxx-0.325*sat),sy),pow(sat,0.3333)*one*abs(clp)); | |
| 3120 | sy=m2; one=(clp>0.0)?w2:1.0.xxx; | |
| 3121 | sat=1.0001-min(min(cref2.r,cref2.g),cref2.b); | |
| 3122 | color2=lerp(color2,plant(pow(color2,0.70.xxx-0.325*sat),sy),pow(sat,0.3333)*one*abs(clp)); | |
| 3123 | } | |
| 3124 | color=gc1(color1)*w1+gc1(color2)*w2; | |
| 3125 | if (bloomsamp > 0.5) {
| |
| 3126 | float3 BloomS = texCD(JoNTSC_S13, pos).rgb; | |
| 3127 | BloomS = pow(BloomS, scangamma/gamma_in); | |
| 3128 | float cm = max(max(ctmp.r,ctmp.g),ctmp.b); | |
| 3129 | float bm = max(max(BloomS.r,BloomS.g),BloomS.b); | |
| 3130 | float bmix = clamp(max((cm-bm), (bm-cm)/(cm+0.25)-cm), 0.0, 1.0); | |
| 3131 | if (abs(clp) > 0.005) | |
| 3132 | {
| |
| 3133 | sy = cm + eps; one = (clp > 0.0) ? min(w1+w2,1.0) : 1.0.xxx; | |
| 3134 | cref1 = plant(BloomS,1.0); | |
| 3135 | float sat = 1.0001-min(min(cref1.r,cref1.g),cref1.b); | |
| 3136 | BloomS = lerp(BloomS, plant(pow(BloomS, 0.70.xxx-0.325*sat),sy), pow(sat,0.3333)*one*abs(clp)); | |
| 3137 | } | |
| 3138 | float3 Bloom1 = (color1*wt1 + color2*wt2)/(wt1+wt2); | |
| 3139 | BloomS = lerp(BloomS, Bloom1, min(3.0*abs(plant(sqrt(Bloom1),1.0) - plant(sqrt(BloomS),1.0)), 1.0)); | |
| 3140 | bm = max(max(BloomS.r,BloomS.g),BloomS.b); | |
| 3141 | BloomS = plant(lerp(BloomS,Bloom1,bloomsamp-1.0), lerp(bm, 1.125*cm, bmix)); | |
| 3142 | BloomS = gc1(BloomS)*(w1+w2); | |
| 3143 | color = min(lerp(color, BloomS, pow(cm, lerp(0.4, 0.2, pow(cm,0.375)))), max(BloomS,color)); | |
| 3144 | } | |
| 3145 | color=min(color,1.0); | |
| 3146 | } | |
| 3147 | if( interb) | |
| 3148 | {
| |
| 3149 | color=gc1(color1); | |
| 3150 | } | |
| 3151 | float colmx=max( max(ctmp.r,ctmp.g),ctmp.b); | |
| 3152 | if(!interb){color=pow(color,gamma_in/scangamma); colmx = pow(colmx, gamma_in/scangamma); }
| |
| 3153 | return float4(color,colmx); | |
| 3154 | } | |
| 3155 | ||
| 3156 | float4 ChromaticPS(float4 position:SV_Position,float2 texcoord:TEXCOORD):SV_Target | |
| 3157 | {
| |
| 3158 | float gamma_in=1.0/texCD(JoNTSC_S08,float2(0.25,0.25)).a; | |
| 3159 | float lum=texCD(JoNTSC_S07,float2(0.5,0.5)).a; | |
| 3160 | float intera=texCD(JoNTSC_S08,float2(0.75,0.25)).a; | |
| 3161 | bool inter6=(intera<0.35&&interm==6.0); | |
| 3162 | bool interb=(((intera<0.35&&!inter6)||(no_scanlines>0.025))&&!hiscan); | |
| 3163 | float2 lexcoord=fuxcoord.xy; | |
| 3164 | if(IOS> 0.0&& !interb) | |
| 3165 | {
| |
| 3166 | float2 ofactor= NewSize.xy/OrgSize.xy; | |
| 3167 | float2 ifactor=(IOS<2.5)? floor(ofactor):ceil(ofactor); | |
| 3168 | float2 diff=ofactor/ifactor; | |
| 3169 | float scan=diff.y; | |
| 3170 | lexcoord=overscan(lexcoord,scan,scan); | |
| 3171 | if(IOS==1.0||IOS==3.0) lexcoord=float2(fuxcoord.x,lexcoord.y); | |
| 3172 | } | |
| 3173 | float factor=1.0+(1.0-0.5*OS)*blm_2/100.0-lum*blm_2/100.0; | |
| 3174 | lexcoord=overscan(lexcoord,factor,factor); | |
| 3175 | lexcoord.y=lexcoord.y - VShift*OrgSize.w; | |
| 3176 | lexcoord=overscan(lexcoord,(OrgSize.x-overscanx)/OrgSize.x,(OrgSize.y-overscany)/OrgSize.y); | |
| 3177 | float2 pos0= warp(fuxcoord); | |
| 3178 | float2 pos1= fuxcoord; | |
| 3179 | float2 pos = warp(lexcoord); | |
| 3180 | float2 posb = 2.0*(pos0-0.5); | |
| 3181 | if (blm_2 < 0.5) posb = max(abs(posb), abs(2.0*(pos-0.5)))*sign(posb); | |
| 3182 | posb = 0.5*posb + 0.5; | |
| 3183 | float3 color=texCD(JoNTSC_S14,pos1).rgb; | |
| 3184 | float3 Bloom=texCD(JoNTSC_S13,pos ).rgb; | |
| 3185 | float3 Glow =texCD(JoNTSC_S11,pos ).rgb; | |
| 3186 | if((abs(deconrx)+abs(deconry)+abs(decongx)+abs(decongy)+abs(deconbx)+abs(deconby))>0.2) bring_pixel(color,Bloom,Glow,pos1,pos); | |
| 3187 | float cm=igc(max(max(color.r,color.g),color.b)); | |
| 3188 | float mx1=texCD(JoNTSC_S14,pos1 ).a; | |
| 3189 | float colmx=max(mx1,cm); | |
| 3190 | float w3=min((max((cm-0.0005)*1.0005,0.0)+0.0001)/(colmx+0.0005),1.0);if(interb)w3=1.0; | |
| 3191 | float2 dx=float2(0.001,0.0); | |
| 3192 | float mx0=texCD(JoNTSC_S14,pos1-dx).a; | |
| 3193 | float mx2=texCD(JoNTSC_S14,pos1+dx).a; | |
| 3194 | float mxg=max(max(mx0,mx1),max(mx2,cm)); | |
| 3195 | float mx=pow(mxg,1.40/gamma_in); | |
| 3196 | float cx=pow(colmx,1.40/gamma_in); | |
| 3197 | dx=float2(OrgSize.z,0.0)*0.25; | |
| 3198 | mx0=texCD(JoNTSC_S14,pos1-dx).a; | |
| 3199 | mx2=texCD(JoNTSC_S14,pos1+dx).a; | |
| 3200 | float mb=(1.0-min(abs(mx0-mx2)/(0.5+mx1),1.0)); | |
| 3201 | float3 orig1=color; | |
| 3202 | float3 one=1.0; | |
| 3203 | float3 cmask=one; | |
| 3204 | float3 dmask=one; | |
| 3205 | float3 emask=one; | |
| 3206 | float mwidths[15]={2.0,3.0,3.0,6.0,6.0,2.4,3.4,2.4,3.25,3.4,4.4,4.25,7.4,6.25,5.25};
| |
| 3207 | float mwidth=mwidths[int(shadow_msk)]; | |
| 3208 | float mask_compensate=frac(mwidth); | |
| 3209 | float mwidth0 = mwidth; | |
| 3210 | if(shadow_msk> -0.5) | |
| 3211 | {
| |
| 3212 | float2 maskcoord= fracoord.xy+float2(laysh*masksize,0.0); | |
| 3213 | float2 scoord=maskcoord; | |
| 3214 | mwidth=floor(mwidth)*masksize; | |
| 3215 | float swidth=mwidth; | |
| 3216 | bool zoomed=(abs(mask_zoom)>0.75); | |
| 3217 | float mscale=1.0; | |
| 3218 | float2 maskcoord0=maskcoord; | |
| 3219 | maskcoord.y=floor(maskcoord.y/masksize); | |
| 3220 | mwidth0=max(mwidth+mask_zoom,2.0); | |
| 3221 | if( mshift> 0.25) | |
| 3222 | {
| |
| 3223 | float stagg_lvl=1.0; if(frac(mshift)>0.25)stagg_lvl=2.0; | |
| 3224 | float next_line=float(floor(mod(maskcoord.y,2.0*stagg_lvl))<stagg_lvl); | |
| 3225 | maskcoord0.x=maskcoord0.x+next_line*0.5*mwidth0; | |
| 3226 | } | |
| 3227 | maskcoord=maskcoord0/masksize; | |
| 3228 | if(!zoomed)cmask=crt_mask(floor(maskcoord),mx,mb);else | |
| 3229 | {
| |
| 3230 | mscale=mwidth0/mwidth; | |
| 3231 | 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); | |
| 3232 | ||
| 3233 | float coord = floor(maskcoord.x/mscale); | |
| 3234 | if (shadow_msk == 12.0 && mask_zoom == -2.0) coord = ceil(maskcoord.x/mscale); | |
| 3235 | cmask = lerp(crt_mask(float2(coord,maskcoord.y), mx, mb), crt_mask(float2(coord + 1.0, maskcoord.y), mx, mb), clerp); | |
| 3236 | } | |
| 3237 | float sm_offset=0.0;bool bsm_offset=(shadow_msk==0.0||shadow_msk==2.0||shadow_msk==5.0||shadow_msk==6.0||shadow_msk==8.0||shadow_msk==11.0); | |
| 3238 | if( zoomed) | |
| 3239 | {
| |
| 3240 | if(mask_layout<0.5&&bsm_offset)sm_offset=1.0;else | |
| 3241 | if(bsm_offset)sm_offset=-1.0; | |
| 3242 | } | |
| 3243 | swidth=round(mwidth0); if (slotwidth > 0.5) swidth = slotwidth; float smask = 1.0; | |
| 3244 | smask =slt_mask(scoord+float2(sm_offset,0.0),mx,swidth); | |
| 3245 | smask =clamp(smask+lerp(smask_mit,0.0,w3*pow(colmx,0.3)),0.0,1.0); | |
| 3246 | emask =cmask; | |
| 3247 | cmask*=smask; | |
| 3248 | dmask =cmask; | |
| 3249 | if(abs(mask_bloom)>0.025) | |
| 3250 | {
| |
| 3251 | float maxbl=max( max(max(Bloom.r,Bloom.g),Bloom.b),mxg); | |
| 3252 | maxbl=maxbl*max(lerp(1.0,2-colmx,bloom_dist),0.0); | |
| 3253 | if(mask_bloom>0.025) cmask= max(min(cmask +maxbl*mask_bloom,1),cmask); else | |
| 3254 | cmask=max(lerp(cmask,cmask*(1.0-0.5*maxbl)+plant(pow( Bloom,0.35.xxx),maxbl),-mask_bloom),cmask); | |
| 3255 | } | |
| 3256 | color=pow(color,mask_gamma/gamma_in); | |
| 3257 | color=color*cmask; | |
| 3258 | color=min(color,1.0); | |
| 3259 | color=pow(color,gamma_in/mask_gamma); | |
| 3260 | cmask=min(cmask,1.0); | |
| 3261 | dmask=min(dmask,1.0); | |
| 3262 | } | |
| 3263 | 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; | |
| 3264 | float bb=lerp(brightboost1,brightboost2,mx)* dark_compensate; color*=bb; | |
| 3265 | float3 Ref=texCD(JoNTSC_S08,pos).rgb; | |
| 3266 | float maxb=texCD(JoNTSC_S13,pos).a; | |
| 3267 | float vig =texCD(JoNTSC_S02,clamp(pos,0.0+0.5*OrgSize.zw,1.0-0.5*OrgSize.zw)).a; | |
| 3268 | if(pr_scan > 0.025) | |
| 3269 | {
| |
| 3270 | float mbl = max(max(Bloom.r,Bloom.g),Bloom.b); | |
| 3271 | Bloom = lerp(Bloom, lerp(Bloom, plant(orig1,mbl), min(2.5*(1.0-w3),1.0)), min(2.0*pr_scan, 1.0)); | |
| 3272 | } | |
| 3273 | float3 bcmask=lerp(one,dmask,b_mask); | |
| 3274 | float3 hcmask=lerp(one,dmask,h_mask); | |
| 3275 | float3 Bloomy=Bloom; | |
| 3276 | if(abs(blm_1)>0.025) | |
| 3277 | {
| |
| 3278 | if(blm_1<-0.01)Bloomy=plant(Bloom,maxb); | |
| 3279 | Bloomy= min(Bloomy*(orig1+color),max(0.5*(colmx+orig1-color),0.001*Bloomy)); | |
| 3280 | Bloomy=0.5*(Bloomy+lerp(Bloomy,lerp(colmx*orig1,Bloomy,0.5),1.0-color)); | |
| 3281 | Bloomy= bcmask*Bloomy*max(lerp(1.0,2.0-colmx,bloom_dist),0); | |
| 3282 | color=pow(pow(color,mask_gamma/gamma_in)+abs(blm_1)*pow( Bloomy,mask_gamma/gamma_in),gamma_in/mask_gamma); | |
| 3283 | } | |
| 3284 | if(halation> 0.01) | |
| 3285 | {
| |
| 3286 | Bloom= 0.5*(Bloom+Bloom*Bloom);float mbl=max(max(Bloom.r,Bloom.g),Bloom.b);float mxh=0.5*(colmx+colmx*colmx); | |
| 3287 | mbl=lerp(lerp(mxh,lerp( mxh,mbl,mbl),colmx),mbl,mb); | |
| 3288 | 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); | |
| 3289 | Bloom=(3.0-colmx-color)*plant(0.325+orig1/w3,0.5*(1.0+w3))*hcmask*Bloom; | |
| 3290 | color=pow(pow(color,mask_gamma/gamma_in)+ halation *pow( Bloom ,mask_gamma/gamma_in),gamma_in/mask_gamma); | |
| 3291 | }else | |
| 3292 | if(halation<-0.01) | |
| 3293 | {
| |
| 3294 | float mbl=max(max(Bloom.r,Bloom.g),Bloom.b); | |
| 3295 | Bloom=plant(Bloom+Ref+orig1+Bloom*Bloom*Bloom,min(mbl*mbl,0.75)); | |
| 3296 | Bloom = 2.0*lerp(1.0,w3,0.5*colmx)*hcmask*Bloom; | |
| 3297 | color = color -halation*Bloom; | |
| 3298 | } | |
| 3299 | color=min(color,1.0); | |
| 3300 | color=gc2(color,w3 ); | |
| 3301 | 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);}
| |
| 3302 | if(m_glow<0.5)Glow=lerp(Glow,0.25*color,colmx);else | |
| 3303 | {
| |
| 3304 | float3 orig2=plant(orig1+0.001*Ref,1.0); maxb=max(max(Glow.r,Glow.g),Glow.b); | |
| 3305 | Bloom=plant(Glow,1.0);Ref=abs(orig2-Bloom); | |
| 3306 | mx0=max(max(orig2.r,orig2.g),orig2.b)-min(min(orig2.r,orig2.g),orig2.b); | |
| 3307 | mx2=max(max(Bloom.r,Bloom.g),Bloom.b)-min(min(Bloom.r,Bloom.g),Bloom.b); | |
| 3308 | 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)); | |
| 3309 | if(m_glow>1.5)Glow=lerp(0.5*Glow*Glow,Bloom,Bloom); | |
| 3310 | Glow=lerp(m_glow_low*Glow,m_glow_high*Bloom,pow(colmx,m_glow_dist/gamma_in)); | |
| 3311 | } | |
| 3312 | if(m_glow<0.5) | |
| 3313 | {
| |
| 3314 | if(glow >=0.0)color=color+0.5*Glow*glow;else color=color+abs(glow)*min(emask*emask,1.0)*Glow;}else | |
| 3315 | {
| |
| 3316 | float3 fmask=clamp(lerp(one,dmask,m_glow_mask),0.0,1.0); | |
| 3317 | color=color+abs(glow)*fmask*Glow; | |
| 3318 | } | |
| 3319 | color=min(color,1.0); | |
| 3320 | if(edgemask>0.05) | |
| 3321 | {
| |
| 3322 | mx0=texCD(JoNTSC_S14,pos1-dx).a;mx0=texCD(JoNTSC_S14,pos1-dx*(1.0-0.75*sqrt(mx0))).a; | |
| 3323 | mx2=texCD(JoNTSC_S14,pos1+dx).a;mx2=texCD(JoNTSC_S14,pos1+dx*(1.0-0.75*sqrt(mx2))).a; | |
| 3324 | float mx3=texCD(JoNTSC_S14,pos1-4.0*dx).a; | |
| 3325 | float mx4=texCD(JoNTSC_S14,pos1+4.0*dx).a; | |
| 3326 | mx4=max(pow(abs(mx3-mx4),0.55-0.40*cx),min(max(mx3,mx4)/min(0.1+cx,1.0),1.0)); | |
| 3327 | mb=(1.0-abs(pow(mx0,1.0-0.65*mx2)-pow(mx2,1.0-0.65*mx0))); | |
| 3328 | mb=mx4*edgemask*(1.0001-mb*mb);float3 temp=lerp(color,orig1,mb); | |
| 3329 | 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); | |
| 3330 | } | |
| 3331 | color=color* lerp(1.0,lerp(0.5*(1.0+w3),w3,mx),pr_scan); | |
| 3332 | color=min(color,max(orig1,color)*lerp(one,dmask,mclip)); | |
| 3333 | color=pow(color,1.0/gamma_o); | |
| 3334 | float q=0.6*sqrt(max(max(color.r,color.g),color.b))+0.4; | |
| 3335 | if(abs(addnoised)>0.01) | |
| 3336 | {
| |
| 3337 | float3 noise0=noise(float3(floor(NewSize.xy*fuxcoord/noiseresd),float(framecount))); | |
| 3338 | if(noisetype<0.5)color=lerp(color,noise0,0.25*abs(addnoised)*q);else | |
| 3339 | color=min(color* lerp(1.0,1.5*noise0.x,0.5*abs(addnoised)),1.0); | |
| 3340 | } | |
| 3341 | colmx=max(max(orig1.r,orig1.g),orig1.b); | |
| 3342 | color=color+bmask*lerp(emask,0.125*(1.0-colmx)*color,min(20.0*colmx,1.0)); | |
| 3343 | return lerp(float4(color*vig*humbars(lerp(pos.y, pos.x, bardir))*post_br*corner(posb), 1.0), | |
| 3344 | texCD(JoNTSC_S0S, (floor(pos1*OrgSize.xy)+0.5)*OrgSize.zw), step(pos1.x,oimage-0.00025)); | |
| 3345 | } | |
| 3346 | ||
| 3347 | float4 RatioSizePS(float4 position : SV_Position, float2 texcoord : TEXCOORD) : SV_Target | |
| 3348 | {
| |
| 3349 | const bool margins=float(texcoord.x>=coord_w&&texcoord.x<=coord_e&&texcoord.y>=coord_n&&texcoord.y<=coord_s); | |
| 3350 | const float2 boxcoord=((texcoord-correct)*OptSize.xy+0)/BoxSize; | |
| 3351 | const float4 boxcolor=texCD(JoNTSC_S15,boxcoord); | |
| 3352 | const float4 orgcolor=texCD(JoNTSC_S00,texcoord); | |
| 3353 | return lerp(orgcolor,float4(margins*boxcolor.rgb,boxcolor.a),float(margins)); | |
| 3354 | } | |
| 3355 | ||
| 3356 | technique JobimaCRT_guest_advancedV8 | |
| 3357 | {
| |
| 3358 | pass StockPass | |
| 3359 | {
| |
| 3360 | VertexShader=CropProcessVS; | |
| 3361 | PixelShader=StockPassPS; | |
| 3362 | RenderTarget=JoNTSC_T0S; | |
| 3363 | PrimitiveTopology=TRIANGLESTRIP; | |
| 3364 | VertexCount=4; | |
| 3365 | } | |
| 3366 | pass Afterglow | |
| 3367 | {
| |
| 3368 | VertexShader=PostProcessVS; | |
| 3369 | PixelShader=AfterglowPS; | |
| 3370 | RenderTarget=JoNTSC_T01; | |
| 3371 | } | |
| 3372 | pass PreShader | |
| 3373 | {
| |
| 3374 | VertexShader=PostProcessVS; | |
| 3375 | PixelShader=PreShaderPS; | |
| 3376 | RenderTarget=JoNTSC_T02; | |
| 3377 | } | |
| 3378 | pass Interlace | |
| 3379 | {
| |
| 3380 | VertexShader=PostProcessVS; | |
| 3381 | PixelShader=InterlacePS; | |
| 3382 | RenderTarget=JoNTSC_T0I; | |
| 3383 | } | |
| 3384 | pass NTSCPASS1 | |
| 3385 | {
| |
| 3386 | VertexShader=PostProcessVS; | |
| 3387 | PixelShader=Signal_1_PS; | |
| 3388 | RenderTarget=JoNTSC_T03; | |
| 3389 | } | |
| 3390 | pass NTSCPASS2 | |
| 3391 | {
| |
| 3392 | VertexShader=PostProcessVS; | |
| 3393 | PixelShader=Signal_2_PS; | |
| 3394 | RenderTarget=JoNTSC_T04; | |
| 3395 | } | |
| 3396 | pass NTSCPASS3 | |
| 3397 | {
| |
| 3398 | VertexShader=PostProcessVS; | |
| 3399 | PixelShader=Signal_3_PS; | |
| 3400 | RenderTarget=JoNTSC_T05; | |
| 3401 | } | |
| 3402 | pass Sharpness | |
| 3403 | {
| |
| 3404 | VertexShader=PostProcessVS; | |
| 3405 | PixelShader=SharpnessPS; | |
| 3406 | RenderTarget=JoNTSC_T06; | |
| 3407 | } | |
| 3408 | pass BCAvgLum | |
| 3409 | {
| |
| 3410 | VertexShader = PostProcessVS; | |
| 3411 | PixelShader = PS_CRT_BlackCrush_AvgLum; | |
| 3412 | RenderTarget = JBCrsh_T01; | |
| 3413 | } | |
| 3414 | pass CRT_BlackCrush | |
| 3415 | {
| |
| 3416 | VertexShader = PostProcessVS; | |
| 3417 | PixelShader = PS_CRT_BlackCrush; | |
| 3418 | RenderTarget = JBCrsh_T02; | |
| 3419 | } | |
| 3420 | pass Luminance | |
| 3421 | {
| |
| 3422 | VertexShader=PostProcessVS; | |
| 3423 | PixelShader=LuminancePS; | |
| 3424 | RenderTarget=JoNTSC_T07; | |
| 3425 | } | |
| 3426 | pass Linearize | |
| 3427 | {
| |
| 3428 | VertexShader=PostProcessVS; | |
| 3429 | PixelShader=LinearizeNewPS; | |
| 3430 | RenderTarget=JoNTSC_T08; | |
| 3431 | } | |
| 3432 | pass CRT_Pass1 | |
| 3433 | {
| |
| 3434 | VertexShader=PostProcessVS; | |
| 3435 | PixelShader=NTSC_TV1_PS; | |
| 3436 | RenderTarget=JoNTSC_T09; | |
| 3437 | } | |
| 3438 | pass GaussianX | |
| 3439 | {
| |
| 3440 | VertexShader=PostProcessVS; | |
| 3441 | PixelShader=HGaussianPS; | |
| 3442 | RenderTarget=JoNTSC_T10; | |
| 3443 | } | |
| 3444 | pass GaussianY | |
| 3445 | {
| |
| 3446 | VertexShader=PostProcessVS; | |
| 3447 | PixelShader=VGaussianPS; | |
| 3448 | RenderTarget=JoNTSC_T11; | |
| 3449 | } | |
| 3450 | pass BloomHorz | |
| 3451 | {
| |
| 3452 | VertexShader=PostProcessVS; | |
| 3453 | PixelShader=BloomHorzPS; | |
| 3454 | RenderTarget=JoNTSC_T12; | |
| 3455 | } | |
| 3456 | pass BloomVert | |
| 3457 | {
| |
| 3458 | VertexShader=PostProcessVS; | |
| 3459 | PixelShader=BloomVertPS; | |
| 3460 | RenderTarget=JoNTSC_T13; | |
| 3461 | } | |
| 3462 | pass CRT_Pass2 | |
| 3463 | {
| |
| 3464 | VertexShader=PostProcessVS; | |
| 3465 | PixelShader=NTSC_TV2_PS; | |
| 3466 | RenderTarget=JoNTSC_T14; | |
| 3467 | } | |
| 3468 | pass Chromatic | |
| 3469 | {
| |
| 3470 | VertexShader=PostProcessVS; | |
| 3471 | PixelShader=ChromaticPS; | |
| 3472 | RenderTarget=JoNTSC_T15; | |
| 3473 | } | |
| 3474 | pass RatioSize | |
| 3475 | {
| |
| 3476 | VertexShader=PostProcessVS; | |
| 3477 | PixelShader=RatioSizePS; | |
| 3478 | } | |
| 3479 | } |