akgunter / crt-royale-reshade

A port of crt-royale from libretro to ReShade
GNU General Public License v2.0
171 stars 7 forks source link

Black crush / gamma issues #34

Open AkitoFire opened 1 year ago

AkitoFire commented 1 year ago

If I have the shader activated, I encounter severe black crush. It seems almost like some gamma issue. Even if LCD and CRT gamma under 'Color' are set to the same value one encounters this issue. My screenshots were taken with LCD and CRT gamma at 2.50: normal crt-royale

Notice how there's a ton of near-black detail missing in the middle section of the background, as the shader crushes everything into pure black. Which I think shouldn't happen if you basically disable the gamma conversion by setting both LCD and CRT gamma to the same value.

2mg commented 1 year ago

I have the same exact issues, and fiddling with Gamma or Contrast never fixes it:

duckstation-qt-x64-ReleaseLTCG_2023_07_23_04_35_42_949

FYI a good test to see if your black's are crushed, boot Crash Bandicoot 1, and the first set of stairs are shaded on their left side. It's very easy to see how crushed it can be, and how trying to fix it will make the stairs and right column too bright.

_Some talk about it here - https://www.reddit.com/r/RetroArch/comments/1573h36/gammacrushed_black_with_crtroyale/_

LordArchantos commented 1 year ago

After hours and hours of tinkering, I managed to get rid of most of the black crush through two things. First, using levels.fx shader (BEFORE Royale) to set black point to -10 (white point to 255). Then, setting NUM_BEAMDIST_COLOR_SAMPLES to 455. Some colour gradients also cause lost and/or messed up shades and banding unless diffusion is more than 0.20. I found a value of 0.24 to get rid of all perceivable "distortion" that I could find in a handful of games I was testing with.

But these are also additionally affected by triad and scanline sizes, phosphor thickness, and linear beam thickness, as well as beam shape, gamma, and contrast. I use linear beam myself since I haven't been able to find settings that don't distort or clip any colours with the gaussian beam shape.

Here are two of my presets designed for a 4k display, one for integer scaled 480p tv style, one for 720p monitor style. Maybe they can be of help in tweaking your own settings. The presets are named after triad size and scanline thickness.

Royale presets.zip

2mg commented 1 year ago

After hours and hours of tinkering, I managed to get rid of most of the black crush through two things. First, using levels.fx shader (BEFORE Royale) to set black point to -10 (white point to 255). Then, setting NUM_BEAMDIST_COLOR_SAMPLES to 455. Some colour gradients also cause lost and/or messed up shades and banding unless diffusion is more than 20. I found a value of 24 to get rid of all perceivable "distortion" that I could find in a handful of games I was testing with.

But these are also additionally affected by triad and scanline sizes, phosphor thickness, and linear beam thickness, as well as beam shape, gamma, and contrast. I use linear beam myself since I haven't been able to find settings that don't distort or clip any colours with the gaussian beam shape.

Here are two of my presets designed for a 4k display, one for integer scaled 480p tv style, one for 720p monitor style. Maybe they can be of help in tweaking your own settings. The presets are named after triad size and scanline thickness.

Royale presets.zip

I've managed with Lightroom, from wiki here, have to manually enter negative value.

Still I believe this Royale port was way more "almost works out of the box" in it's previous iterations. For example I could've applied barely noticeable flicker, now it's tied to scanline size, and a lot of Phosphor sharpness tinkering...

akgunter commented 1 year ago

Still I believe this Royale port was way more "almost works out of the box" in it's previous iterations. For example I could've applied barely noticeable flicker, now it's tied to scanline size, and a lot of Phosphor sharpness tinkering...

Admittedly I’ve noticed this too when helping people set it up. I think I Dunning-Krugered it a bit because I’m used to slapping tweaks together and underestimate the learning curve. I think after I get the fake scanlines done right, I’ll revisit the config and see if I can remove some extraneous crud and make the defaults better. That would correspond to a v3, since it wouldn’t be backwards compatible.

I also noticed the crushing too, and used a negative black level in Lightroom to compensate for it too. I’ll have to get RetroArch up and running again and see how my version compares to the original. If mine is mismatched, then I’ll just fix it and call it a day. If the original has the same issue, I’ll have to do some thinking.

2mg commented 1 year ago

I've usually go for "cheap TV look possible" to "pro level CRT" looks with these. But that's not actually all CRT's job, it's the signal shader that preceeds it too.

So setting up Royale as "cheap TV" is somewhat easy, but boy did it took me a lot of time to figure out how to make it "it has barely noticeable PC CRT pixels", for example Phosphor sharpness will have the most effect on how much of them will actually be visible instead of Phosphor thickness or Mask width, you'd think Mask width to low is the first to make them barely perceptible, but it just it goes into the subpixel chaos, then you switch to LowRes masks, but then the entire contrast is off again...

2mg commented 1 year ago

Oh anothe thing - can Interlacing/scanlines have "refresh speed" faster than 60? To get that PC CRT with higher refresh rates vibe?

akgunter commented 1 year ago

Oh anothe thing - can Interlacing/scanlines have "refresh speed" faster than 60? To get that PC CRT with higher refresh rates vibe?

No, the interlacing is designed to cycle every other frame like interlaced video formats did; so it’s coupled to the game’s framerate. Also ReShade isn’t capable of increasing the game’s framerate or of frame generation. So if you want the game to run above 60 fps, you’ll have to get the emulator/game to do it. Also bear in mind that most CRT content was 30fps interlaced, corresponding to 60 half-frames per second. So 60 is usually the “correct” rate for retro content.

2mg commented 1 year ago

But internal framerates can be 30 Progressive while emulator is working at 60 (or higher if your screen supports it), so I don't see why having this decoupled presents an issue, it is an effect like any other afaik so making them work at any rates should be possible, maybe if it's coded as a post-processing effect?

Imagine if interlaced lines were shown on 30fps/hz, it would be impossible to watch.

I have CrtRefresh.fx that Matsilagi made, you can set the speed and intensity however you like.

I've another question regarding (I hope it's black crush related) with scanlines and interlacing (without deinterlacing) - they "decimate" the image, hope the video shows good enough - ignore how triads look and shimmering, it's due to capturing, doesn't do that when it's in front of me, pay attention to colors on the wall, they aren't just darker, they literary change their colors:

https://github.com/akgunter/crt-royale-reshade/assets/7749968/7e9b2eec-d11a-4ea1-8f06-b6f5ada88ddc

2mg commented 9 months ago

Hey, any updates on this issue?

Dantrigger commented 8 months ago

Has anyone found a way to fix this? I'm trying to play Deus Ex 1 with CRT Royale on but the black crush makes the game dark and the textures look really bad.