New sonkun crt guest advanced hd presets thread

Hi! I ended up trying to use these shaders but for some reason the colors are just… very wrong, as can be clearly seen with the provided screenshot. I tried running it with vulkan, glcore, and swapping between presets (AV styles, resolutions, curved/flat, regions), but they all gave this weird color effect.

For context, I’m running on a 4K screen, with the Steam version of Retroarch, running on Arch Linux.

1 Like

Hello klazo and welcome to the forum. It’s unfortunate that your first post is you running into a issue with my presets but let’s see if we can get to the bottom of things. To start I’m assuming you’re using my latest pack and that you’ve downloaded guest.r’s latest shader update and manually installed it. That update is not yet available to download through RetroArch itself and my pack requires that very guest.r shader update.

From there we’ll see which setting might be causing your issue.

Which preset did you use?

1 Like

I think he tried them all. The key word I noticed was “Linux” for some reason Linux and the grade shader stay having issues working together. I have a feeling it might just be the “Display Color Space” setting, I’ll see if him defaulting that setting will do anything first.

Tried playing with these settings, but that’s not what I meant. I’m actually fine with things being crisp and I haven’t really had an issue with your presets aside from the November 6th regression that you fixed. I think it started happening when you began playing around with upscalers like ddt-xbr-lv1. I’m not sure if you just can’t see it in the pictures I posted or if I’m not explaining myself properly, but I’m referring to that smooth filtered look, which stands out even moreso in the shadow mask presets than in the aperture grille ones. I don’t think it looks good/accurate and it simply takes me out. Also, I don’t think S-Video used to look like that before.

I know I went back to the wrong version back in December 4th to illustrate my point back then, but you can already see there what I’m talking about.

Oh my bad, I had forgotten to read further below to find the new guest shaders. Installing the new version of those fixed the problem, thanks!!

1 Like

I figured I should weigh in on this one. On my 12 bit KRP-111FD Plasma panel, set to full, 12bpc, I definitely still need to lower that setting to 0.

I do perceive it brighter when set to Limited, and Limited definitely makes my movie files appear to not have true black, so take from this what you will.

Nice. That’s exactly why I started there first to double check that you had those packs installed. Glad that was all it took.

That’s lovely information and ties into why I recently put up a new Disclaimer on the main page for users going forward that if "blacks"aren’t looking the way they should to turn that very setting down or off with a screenshot of exactly which setting it is so there’s no confusion.

Once I went from “limited” to “full” all colors appeared more “rich” on my display and blacks darkened so I assume that to be the case when other people do the same.

Sorry been away a bit taking care of things and other projects I been working on so just now getting around to this. Aside from the RF/composite issue that you helped me resolve I’m still confused on the s-video situation. I know when I started playing with those upscalers that made me want to rearrange sharpness settings but you say sharpness isn’t the issue. The only other settings I changed on both svideo and rgb were the glow settings, the sigma settings to be exact. Besides that I didn’t touch anything else on svideo or rgb since that last pack you mentioned.

Maybe try deleting everything and starting from scratch, guest.r updates and all and re install everything.

Their S-video screenshot looks like it is being affected by the Sgenpt-mix shader, if I recall that being in there. I could never stand S video on my TVs, it always seemed like it gave us a checkerboard pattern across the entire screen, even with GameCube. Fortunately shaders never make it look that way.

1 Like

Ah ok. If that’s what he was talking about the svideo presets has always been that way with the “false positives” making some pixels look weird, that’s all strictly coming from the “sgenpt-mix multpass” shader that’s being used specifically just for the svideo presets. Some games I guess you’ll notice those kind of things happening with the pixels.

I created that preset mainly to be used with 5th generation systems like Saturn and PS1 to deal with checkerboard dithering. The “sgenpt-mix multpass” shader is also still a work in progress shader but imo the best one out of all the “dithering” shaders that can be found in that respective shader folder so that’s why I ended up using it.

Will that be good for PCSX2? I want to use your shaders from Composite to RGB on there.

1 Like

Should be, I haven’t tried that core out yet. If Dreamcast is any indication to go off of PS2 will most likely look like this:

Shadow Mask:

Slot Mask:

Aperture Grille:

The presets will most likely auto activate “Interlaced Mode” for most games.

Oh, part of the new update for RA? I forgot how to transfer my stuff to the new RA.

1 Like

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?

1 Like

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.

1 Like

Thanks, Sonkun. I thought I had to move all of my shaders and saves to RA 1.20

1 Like

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.

2 Likes

hello where do we place this file?

1 Like

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.

3 Likes