You’re talking about using my presets on that new ps2 core on RetroArch right? Yeah it should be available in the core downloader section.
I don’t need to the download the current version of RA?
I don’t think you do. First update the “core info files” then check to see if you see the new ps2 core in the core downloader section.
Thanks, Sonkun. I thought I had to move all of my shaders and saves to RA 1.20
I’ve put together this simple* mod for sonkun’s CRT presets to approximate the colors my real CRTs from 1989 and 2000, using the measurements that I posted last month. You can also still use sonkun’s own colors adjustments with the more accurate color, or you can get unmodified RGB from your emulator without adjustments. Some screenshots can be found here: https://imgur.com/a/oIaoA2d
Or at least, that’s what’s supposed to happen. My way of doing this is fairly hacky and imprecise, and the accuracy of the colors depends to some degree on your display’s resolution and RetroArch’s aspect ratio and overscan-cropping settings. What I did was make a shader program that takes almost 10 hours to generate an approximate inverse LUT of sonkun’s presets, and mod that LUT into one of the shader passes. This can be done with other CRT shaders in RetroArch too.
If you want to save yourself 10 hours at the cost of some accuracy, you can just use the LUT that I generated against my bizzare “1600p” display, but for better results on your own monitor’s resolution and scaling settings, I’m also posting instructions on how to generate an inverse LUT that’s optimized for your setup, which will take 10 hours of your time. Just beware that I’m probably going to edit this post later today or tomorrow to add a better LUT generator and to improve the precision a little bit more.
Basic Installation
(click to show/hide)
Install sonkun’s 2024-12-20-r1 presets according to sonkun’s own instructions, along with guest.r shader version 2024-12-05-r1. Try them to make sure that they’re working.
Download my modded Grade shader at https://www.mediafire.com/file/u517rqw25pxkevl/pre-shaders-afterglow-grade-sonkunfix.slang/file and place it inside shaders_slang/crt/shaders/guest/advanced/grade.
Those who are willing to spend 10 hours to get the best accuracy should scroll down to the “How to generate and install your own inverse LUT” section. Otherwise, read the next paragraph.
If you’re not extremely concerned about accuracy, or if you have a “1600p” monitor like mine (vertical resolution of 1600 pixels), download my pre-made LUT and presets at https://www.mediafire.com/file/9e63q1gd83nmz52/patchy68k_sonkunfix_presets_1600p.zip/file. The zip contains two slangp files that you should put in shaders_slang/sonkun/slot-mask/curved-screen/1440p, and one PNG image (the LUT) which you should put in shaders_slang/crt/shaders/guest/advanced/grade. In the settings, change “Afterglow Strength” to 0.0. Verify that you are able to load the presets in RetroArch and that shader’s colors look similar enough to how they look without any shader. If your monitor isn’t “1600p” and the brightest colors look “off”, go into the shader settings and decrease the setting called “crt-guest-advanced color fix maximum” until it looks acceptable. Make sure you follow the next paragraphs on how to set up my 1989 RCA and 2000 Panasonic CRT colorimetry, and more.
Color settings for NES games
(click to show/hide)
The instructions for NES depend on which NES color palette you decide to use. Also, make sure you change “Afterglow Strength” to 0.0 in the shader settings for now, since this currently has a glitch where it’s causing the emulator’s raw, unprocessed color to afterglow onto this setup’s processed color.
- To use my 1989 RCA ColorTrak palette or 2000 Panasonic CT-36D30B warm/normal/cool palettes, you can just install the custom palette as normal (by renaming the .pal file to MesenPalette.pal for Mesen, nes.pal for FCEUmm, or custom.pal for Nestopia, and placing this palette into the “system” folder in RetroArch), and don’t change any shader settings (except “crt-guest-advanced color fix maximum” as instructed earlier).
- For FirebrandX’s PVM Style D93 or D65, BMF’s palettes, or AspiringSquire’s palettes, don’t change any shader settings (except “crt-guest-advanced color fix maximum” as instructed earlier).
- For the Sony CXA2025AS US NES palette (another consumer palette, probably from about 1994) or for FCEUmm’s default palette (I assume this is a similar consumer palette, but not sure), in the shader settings, change “Use PlainOldPants’s Color (Requires Skip Grade)” to 1.0, change “Enable Composite/S-Video” to 0.0, and change “CRT: 2000 Panasonic Cool/Normal/Warm (1/2/3), 1989 RCA (4)” to whichever option you like best. I recommend 2.0 or 4.0, which are both close to D93. (If you insist on having “perfectly balanced” grays, a.k.a. D65, you can change “Enable Grayscale, Gamma, Gamut, and Whitepoint” to 0.0, but generally, consumer CRTs were bad at this. You might like 3.0, which is about 7100K.)
- For FirebrandX’s Magnum, Smooth, Smooth V2, or Digital Prime (which are based on a professional monitor from about 1996), or FirebrandX’s Composite Direct (based on a modern video capture), “Use PlainOldPants’s Color (Requires Skip Grade)” to 1.0, change “Enable Composite/S-Video” to 0.0, and change “Enable Grayscale, Gamma, Gamut, and Whitepoint” to 0.0. This is a properly calibrated grayscale at D65, the standard color temperature in NTSC and PAL, except in Japan.
Color settings for other consoles
(click to show/hide)
For Genesis, use BlastEm for better color accuracy. For SNES, don’t use bsnes-mercury; do use Snes9x, or others that won’t falsely trigger “2-phase”, and do not enable any “gamma ramp” setting.
In the shader settings, change “Afterglow Strength” to 0.0 (because it’s glitched), and change “Use PlainOldPants’s Color (Requires Skip Grade)” to 1.0 to enable my color fixes. Here are the main important settings:
- CRT: 2000 Panasonic Cool/Normal/Warm (1/2/3), 1989 RCA (4) - Self-explanatory. Which CRT are we trying to replicate? (The Panasonic CRT lets you pick a color temperature in its on-screen display too.) This affects both the composite/s-video correction and the grayscale/gamma/gamut/whitepoint correction, so if you’re struggling with composite/s-video settings, try changing this too.
- "Enable Composite/S-Video" - If set to 1.0, this enables the NTSC color corrections that this CRT does on RF, composite, and s-video signals.
- “Composite/S-Video Saturation (Color)” - If you enable composite/s-video, this determines the saturation. The real CRTs allow you to control this on the on-screen display.
Less important:
- "Black Level (Brightness)" - Changes the level of the deepest black. I’ve already calibrated it for you, but some CRTs have a very low brightness by default. The real CRTs allow you to adjust this on their on-screen display.
- "Composite/S-Video Hue Rotation (Tint)" - Rotates the hue. You can change it if you want, but I recommend keeping it at 0.0. The real CRTs allow you to adjust this on their on-screen display.
Probably shouldn’t change these:
- "Enable Grayscale, Gamma, Gamut, and Whitepoint" - Just leave this at 1.0. It approximates the CRT’s uncalibrated EOTFs individually for red, green, and blue, and it approximates the gamut of those red, green, and blue phosphors too. When set to 0.0, all it does is correct from 2.4 gamma to 2.2 gamma.
- "Picture / White Level (Contrast)" - Just leave this at exactly 1.0. Trust me. If you accidentally changed it to something else, change it back to 1.0. This setting looks like it’s doing nothing, but it is determining the physical CRT’s “contrast” without affecting the contrast that you actually see.
- "(RCA only) Enable gamut hack (Recommended)" - Just leave this turned on. Since I used my colorimeter’s default calibration without a spectrometer, I couldn’t get a good sample of the RCA CRT’s red phosphor, so this setting tries to correct this problem.
How to generate and install your own inverse LUT
oh no
Consider reading through all these instructions before starting. It’s like a meme, with how long and bizzare it is. You’ll need Java for one part.
Keep in mind that this LUT will be dependent on all the following things. If one thing changes, your LUT will be uncalibrated.
- The internal vertical resolution of the core. Make sure you do not crop vertical overscan, so that your vertical resolution is 240 or as close to 240 as possible. Both RetroArch itself and your individual cores have settings that affect vertical overscan. To make sure your core is outputting about 240 scanlines, try loading shaders_slang/misc/print_resolution.
- The final resolution that is output to your screen. The vertical resolution is especially important, as that controls the thickness of scanlines, even if the content is staying at 240 lines across cores. Consider going into RetroArch’s settings and forcing a 4:3, 5:4, or 6:5 aspect ratio across all cores.
- Curved screen vs flat screen
- Trinitron vs slot mask vs shadow mask
- Any updates to crt-guest and/or to sonkun’s presets might affect results.
In shaders_slang/crt/shaders/guest/advanced/grade, make a copy of pre-shaders-afterglow-grade.slang, and call it passthru.slang. Open passthru.slang in a text editor other than Windows notepad and locate this line:
FragColor = vec4(LUT2_output + aftglow.rgb, 1.0);
and replace it with this
FragColor = vec4(imgColor.rgb, 1.0);
and save the file.
Inside shaders_slang/sonkun/… locate the preset that you want to mod, and make a copy of it. You can add 00 to the beginning of the file name to move it to the top of the file list. Open this file in your text editor, and search for this string:
"../../../../crt/shaders/guest/advanced/grade/pre-shaders-afterglow-grade.slang"
Replace it with this:
"../../../../crt/shaders/guest/advanced/grade/passthru.slang"
and save the file. Verify that you are able to load this modified sonkun shader in RetroArch.
We are about to create the most useless shader in the history of shaders. Locate stock.slang inside your shaders_slang folder. Make a copy of it called white.slang, and locate this line inside white.slang:
FragColor = vec4(texture(Source, vTexCoord).rgb, 1.0);
Replace that with this:
FragColor = vec4(1.0);
Also in shaders_slang, locate nearest.slangp. Make a copy of it called white.slangp, and locate this line inside white.slangp:
shader0 = stock.slang
Change it to this
shader0 = white.slang
Add this new line after it
alias0 = LutIn
Download my LUT generation shaders at https://www.mediafire.com/file/odx29b6vpd2mcvl/auto-lut-invert-128.zip/file and unzip them into your shaders folder. I forgot to include a couple things. Make a copy of auto-lut-output-invert.slangp called average-screen.slangp and locate this line at the top of average-screen.slangp:
shaders = "2"
Change it to
shaders = "1"
In RetroArch, go into your hotkey settings, and make sure you know how to screenshot at any time. You will need to be able to screenshot the LUT when it’s done generating using RetroArch’s built-in screenshot feature, without accidentally causing the LUT to reset to pitch-black. Screenshots get saved into a folder named “screenshots”. Also make sure that you have no other overlays on-screen, and that you know how to show and hide your FPS just by pressing a hotkey, which I believe is F3 by default.
In RetroArch, go into a game with 240 scanlines of resolution. As described in an earlier part of these instructions, make sure you’re actually at 240 scanlines or something close enough like 239. Load shaders_slang/white.slangp. Append your modded sonkun preset. Append the average-screen.slangp file we created earlier. You should see a black screen with two white rectangles. Your FPS might drop very badly, or it might stay stable.
Scroll to the bottom of the shader settings, where you see the options “Average size”, “Point size”, and “Average scale”. Decrease “Point size” to the lowest it’ll go without the two rectangles disappearing. “Average size” is the width and height (in pixels) of a rectangle in the middle of your screen that is being averaged, so try to adjust this to something that is reasonable to you while not dropping your framerate under 60 FPS. On my PC, 200 pixels works well.
Take a screenshot of the two white rectangles, and open the screenshot in an image editor. One of the rectangles should be 255, 255, 255, while the other should be something else. In your shader settings, change “Average scale” to that something else. Screenshot again, and now both rectangles should be 255, 255, 255.
Load your modified sonkun shader again. Prepend auto-lut-input-128.slangp, and append auto-lut-output-invert.slangp. You should now see the LUT being generated, but it’s not correct yet. Quickly, in the shader’s settings, set “Afterglow Strength” to 0.0, then scroll all the way down to the settings at the bottom, and change the averager settings to whatever you set them to earlier. Starting right now, this is the part that takes 10 hours, assuming your game is running at 60 FPS constantly. BE CAREFUL because doing certain actions in RetroArch will cause the LUT to reset to a black screen.
On some computers, you might be able to do certain glitches in RetroArch to speed this up. For example, I’m able to turn off VSync, close and reopen the menu, and turn VSync back on, and this causes the process to speed up a lot until I close the menu, which then causes the whole LUT to reset to black. Even if I take a screenshot while the RetroArch menu is open, it’ll only be a screenshot of the game content plus any overlays like FPS or a notification of another screenshot.
After the 10 hours are over, use the F8 key (by default) on your keyboard to take a screenshot. It’s normal for the LUT to have some gaps where there’s no existing inverse for that RGB value.
Download this short Java program https://www.mediafire.com/file/mzs4t99f9zfnrwq/jav64.java/file and put it inside your screenshots directory. Inside jav64.java, change “2048-250109-123436.png” to the name of your screenshotted LUT. When you run this program, it should generate sonkun_fix_lut.png. Put it inside shaders_slang/crt/shaders/guest/advanced/grade, and feel free to rename the file if you’re doing this process multiple times.
In case you skipped this step, download my modded Grade shader as instructed earlier. Inside your modded sonkun preset, go back to this line:
"../../../../crt/shaders/guest/advanced/grade/passthru.slang"
and change it to this
"../../../../crt/shaders/guest/advanced/grade/pre-shaders-afterglow-grade-sonkunfix.slang"
and scroll down to the bottom where you see these textures:
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3;SamplerLUT4"
SamplerLUT1 = "../../../../crt/shaders/guest/advanced/lut/trinitron-lut.png"
SamplerLUT1_wrap_mode = "clamp_to_border"
SamplerLUT1_mipmap = "false"
SamplerLUT2 = "../../../../crt/shaders/guest/advanced/lut/inv-trinitron-lut.png"
SamplerLUT2_wrap_mode = "clamp_to_border"
SamplerLUT2_mipmap = "false"
SamplerLUT3 = "../../../../crt/shaders/guest/advanced/lut/nec-lut.png"
SamplerLUT3_wrap_mode = "clamp_to_border"
SamplerLUT3_mipmap = "false"
SamplerLUT4 = "../../../../crt/shaders/guest/advanced/lut/ntsc-lut.png"
SamplerLUT4_wrap_mode = "clamp_to_border"
SamplerLUT4_mipmap = "false"
Change it to this. If you’ve renamed your sonkun fix LUT file, make sure to reflect that here too.
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3;SamplerLUT4;ScalableSamplerLUT1"
SamplerLUT1 = "../../../../crt/shaders/guest/advanced/lut/trinitron-lut.png"
SamplerLUT1_wrap_mode = "clamp_to_border"
SamplerLUT1_mipmap = "false"
SamplerLUT2 = "../../../../crt/shaders/guest/advanced/lut/inv-trinitron-lut.png"
SamplerLUT2_wrap_mode = "clamp_to_border"
SamplerLUT2_mipmap = "false"
SamplerLUT3 = "../../../../crt/shaders/guest/advanced/lut/nec-lut.png"
SamplerLUT3_wrap_mode = "clamp_to_border"
SamplerLUT3_mipmap = "false"
SamplerLUT4 = "../../../../crt/shaders/guest/advanced/lut/ntsc-lut.png"
SamplerLUT4_wrap_mode = "clamp_to_border"
SamplerLUT4_mipmap = "false"
ScalableSamplerLUT1 = "../../../../crt/shaders/guest/advanced/grade/sonkun_fix_lut.png"
ScalableSamplerLUT1_wrap_mode = "clamp_to_border"
ScalableSamplerLUT1_mipmap = "false"
You should be able to load the preset in RetroArch, but it’s not quite ready yet. You still need to set certain settings. Read the “Color settings for NES games” and “Color settings for other consoles” sections above to do this correctly. However, there are two additional settings you’ll need to fix, because sonkun’s presets aren’t able to output darker or brighter than certain thresholds. You need to set “crt-guest-advanced color fix minimum” and “crt-guest-advanced color fix maximum” to force your colors to stay in-bounds, because out-of-bounds colors just become pitch black. For me, the values that worked were 1.0 and 240.0 respectively, but they might be different for you.
hello where do we place this file?
https://www.mediafire.com/file/n3nxm4wc5m9uzur/patchy68k_mod_files.zip/file
This should be easier, hopefully. Unzip this, and put the “patchy68k_mod” folder at shaders_slang/sonkun/patchy68k_mod. These are for 1440p.
It’s almost 3AM where I live. I don’t know why I made such an overcomplicated post.
Wow this is amazing. Thanks for even choosing my presets for your experiments lol. When I get some time hopefully later today I’ll take a deep dive into everything.
So far off the top the image I like the best is this one:
That one gives me the “crt vibes” if that makes any sense. This should be fun to play around with.
is for removing dithering adding for the composite shaders of yours is adding sgenpt-mix advised?
You’re asking about adding sgenpt-mix to the composite presets? Am I reading this right?
I notice that with the composite preset on NES, the game Tiny Toon Adventures 1 is very bright on auto settings on stage 1.
yes that is what i want to do
If you think that game is bright you should try Sky Kid for NES, that game will blind you lol. The very last parameter settings “Post Brightness” you can try turning that down. I’m retweaking glow settings in anticipation for guest.r’s next shader update release which I predict will be a sexy one, not sure how it will affect that game but I’m playing with settings switching some things around which I’ll probably use on my next pack release.
You can try prepending that over a composite preset. I’m not sure what your aim is with that but that sounds like a bizarre mix up, kind of curious myself just to see what would happen mixing the two.
Fortunately there is not need to. Got recently some modern glasses for my eyesight that have those filters for monitors and smart phones to absorb light and protect the cornea. Thus game looks fine. Optician told me that due to COVID and people spending more time on their monitors, they made such glasses mandatory.
This is not a joke post, right?
It’s blended on my end. Grab guest.r’s latest shader release that should do the trick.
I didn’t know such a thing existed, Smart Glasses I believe is what they’re called? Sounds like something you’d see in some cybernetic type of movie or something haha.
Not sure what could be causing it, even loading that specific shader up things are good on my end:
Might be one of those cases where you might just have to reinstall everything from scratch as I have no idea where in your set up could be causing that. I doubt it’s the overlay causing it.
maybe it could be i don’t use scaling core provided i use custom so that it fits in the overlay