SGENPT-MIX - Sega Genesis Pseudo Transparency Mixer shader

As @Syh said, pink/purple/magenta tint from NTSC shaders is usually a result of the first pass not having “float_framebuffer” enabled, as it truncates some of the YIQ values that need to carry over to the second pass.

5 Likes

Thanks for explaining the problem to me @hunterk!

Well, as I said, is that when I use ntsc-adaptive in the Master System, the difference in resolution makes the dithering not close as much as in the Mega Drive. Now with the sgenpt-mix in both mode with bl 0.4 everything is better!

ntsc-adaptive, no sgenpt-mix:

ntsc-adaptive with sgenpt-mix:


ntsc-adaptive, no sgenpt-mix:

ntsc-adaptive with sgenpt-mix:

5 Likes

@Hyllian, do you intend to add some kind of ‘’ error prevention ‘’ adjustment, so that the blend mode at level 1.0 is already used without harming details? I read at the beginning of the topic that your intention was to produce a simple shader, but so far for me it is quite sophisticated for the results that can be achieved (like using both mode in blend 0.0, and using the second pass with checkerboards at 0.5 or 0.8).

I was testing only with crt at the last pass, but in many cases, it looks great with some upscaling shader like scalefx for example.

3 Likes

The problem of error prevention is that it can cause more harm than good. I couldn’t find (yet) a way to prevent errors without breaking something elsewhere. I’ll only update the shader if I find something worth, which means to improve what is already there. I’m always testing new ideas and evaluating the results. If anything worth appears, I’ll add to the shader. This is how I develop it.

Trust me, I intend to continually develop this shader in the next years.

If you have an idea about how something could be improved, please post here.

7 Likes

What is the main reason for having a second pass? What she’s the second pass do that the first one misses?

2 Likes

It was introduced to allow different Blend Levels between passes. For example, the first pass filter using checkerboard and BL=0.0 and the second pass filter using pseudo-transparency and BL=0.6.

If you ask me, I think only eagle eye users will need it. :wink:

4 Likes

The second pass is very useful when you need both blend (vertical lines and checkerboard) BL = 0.0 to filter the whole scenario, and the second pass only on CB BL = 6.0 to leave only the checkerboard life bars transparent. I do that in Marvel vs. Capcom Clash of Super Heroes.

3 Likes

I have had a hard time coming to a conclusion on whether I would implement this into my CRT shader configuration personally or not. Unfortunately, it seems that when using de-dithering shaders like this one that there is a strong trade-off between blended dithering and sharpness/clarity.

With the dithering effect, I notice that often while it will do a good job at blending in the dithering and eliminate the ugly checkerboard effect, it also can negatively affect fonts and sprites within games and can make them appear more blurred than they should be.

Here is an image of CRT-Easymode with no dithering filtering applied.

Here we have the same image and shader configured with SGENPT-Multipass and with the strongest dithering filter (3.00 for Pass 1 and 3.00 for Pass 2)

While the dithering checkerboard effect on the image is significantly smoothed out on the second image such as Blaze’s clothing and Axel’s tanktop and arm, if you look at the copyright text at the bottom you can also see it is much less clean and sharp than in the first image. Little details like this stick out like a sore thumb and are hard to ignore for me; it further goes into this tradeoff I have mentioned.

If you are not careful you can also apply too strong of a dithering effect and things can get blurred out, like the grooves in the ground on SOR2 for example.

I can further adjust the dithering presets and use a less intense blend level to mitigate this but it also comes at the sacrifice of getting as nice of a blended dither effect.

I know that this is a Sega Genesis Psuedo Transparency Mixer but I also tested out on a PS1 game with the dithering grid enabled, and the same issues I had spoken on above are present here as well.

Here is an image of the menu in Wipeout with the SGENPT blended dithering effect applied. While it does blend out the dithering in the background, it also affects the clarity of the text in the game and makes it look blurred.

Anyway, those are just some thoughts I had on the situation. I probably will need to experiment more to see for myself.

Here are the settings for my CRT-Easymode preset with Grade and SGENPT if anyone is interested.

shaders = "4"
shader0 = "shaders_slang/dithering/shaders/sgenpt-mix/sgenpt-mix.slang"
filter_linear0 = "false"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = "StockPass"
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
scale_type_x0 = "source"
scale_x0 = "1.000000"
scale_type_y0 = "source"
scale_y0 = "1.000000"
shader1 = "shaders_slang/dithering/shaders/sgenpt-mix/sgenpt-mix-pass2.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = ""
float_framebuffer1 = "false"
srgb_framebuffer1 = "false"
scale_type_x1 = "source"
scale_x1 = "1.000000"
scale_type_y1 = "source"
scale_y1 = "1.000000"
shader2 = "shaders_slang/misc/grade.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = ""
float_framebuffer2 = "false"
srgb_framebuffer2 = "false"
scale_type_x2 = "source"
scale_x2 = "1.000000"
scale_type_y2 = "source"
scale_y2 = "1.000000"
shader3 = "shaders_slang/crt/shaders/crt-easymode.slang"
filter_linear3 = "false"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "false"
alias3 = ""
float_framebuffer3 = "false"
srgb_framebuffer3 = "false"
parameters = "SGPT_BLEND_OPTION;SGPT_BLEND_LEVEL;SGPT_ADJUST_VIEW;SGPT_LINEAR_GAMMA;SGPT_BLEND_OPTION_P2;SGPT_BLEND_LEVEL_P2;SGPT_ADJUST_VIEW_P2;g_gamma_in;g_gamma_out;g_signal_type;g_crtgamut;g_space_out;g_hue_degrees;g_I_SHIFT;g_Q_SHIFT;g_I_MUL;g_Q_MUL;g_lum_fix;g_vignette;g_vstr;g_vpower;g_lum;g_cntrst;g_mid;wp_temperature;g_sat;g_vibr;g_satr;g_satg;g_satb;g_lift;blr;blg;blb;wlr;wlg;wlb;rg;rb;gr;gb;br;bg;LUT_Size1;LUT1_toggle;LUT_Size2;LUT2_toggle;SHARPNESS_H;SHARPNESS_V;MASK_STRENGTH;MASK_DOT_WIDTH;MASK_DOT_HEIGHT;MASK_STAGGER;MASK_SIZE;SCANLINE_STRENGTH;SCANLINE_BEAM_WIDTH_MIN;SCANLINE_BEAM_WIDTH_MAX;SCANLINE_BRIGHT_MIN;SCANLINE_BRIGHT_MAX;SCANLINE_CUTOFF;GAMMA_INPUT;GAMMA_OUTPUT;BRIGHT_BOOST;DILATION"
SGPT_BLEND_OPTION = "3.000000"
SGPT_BLEND_LEVEL = "0.200000"
SGPT_ADJUST_VIEW = "0.000000"
SGPT_LINEAR_GAMMA = "1.000000"
SGPT_BLEND_OPTION_P2 = "3.000000"
SGPT_BLEND_LEVEL_P2 = "0.200000"
SGPT_ADJUST_VIEW_P2 = "0.000000"
g_gamma_in = "2.222000"
g_gamma_out = "2.500000"
g_signal_type = "0.000000"
g_crtgamut = "2.000000"
g_space_out = "0.000000"
g_hue_degrees = "0.000000"
g_I_SHIFT = "0.000000"
g_Q_SHIFT = "0.000000"
g_I_MUL = "1.000000"
g_Q_MUL = "1.000000"
g_lum_fix = "0.000000"
g_vignette = "0.000000"
g_vstr = "40.000000"
g_vpower = "0.200000"
g_lum = "0.000000"
g_cntrst = "0.000000"
g_mid = "0.500000"
wp_temperature = "7504.000000"
g_sat = "0.130000"
g_vibr = "0.000000"
g_satr = "0.000000"
g_satg = "0.000000"
g_satb = "0.000000"
g_lift = "0.000000"
blr = "0.000000"
blg = "0.000000"
blb = "0.000000"
wlr = "1.000000"
wlg = "1.000000"
wlb = "1.000000"
rg = "0.000000"
rb = "0.000000"
gr = "0.000000"
gb = "0.000000"
br = "0.000000"
bg = "0.000000"
LUT_Size1 = "16.000000"
LUT1_toggle = "0.000000"
LUT_Size2 = "64.000000"
LUT2_toggle = "0.000000"
SHARPNESS_H = "0.600000"
SHARPNESS_V = "1.000000"
MASK_STRENGTH = "0.899999"
MASK_DOT_WIDTH = "1.000000"
MASK_DOT_HEIGHT = "1.000000"
MASK_STAGGER = "0.000000"
MASK_SIZE = "1.000000"
SCANLINE_STRENGTH = "1.000000"
SCANLINE_BEAM_WIDTH_MIN = "1.000000"
SCANLINE_BEAM_WIDTH_MAX = "1.000000"
SCANLINE_BRIGHT_MIN = "0.200000"
SCANLINE_BRIGHT_MAX = "0.250000"
SCANLINE_CUTOFF = "400.000000"
GAMMA_INPUT = "2.400000"
GAMMA_OUTPUT = "2.200000"
BRIGHT_BOOST = "1.200000"
DILATION = "0.000000"
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3;SamplerLUT4"
SamplerLUT1 = "shaders_slang/crt/shaders/guest/lut/sony_trinitron1.png"
SamplerLUT1_linear = "true"
SamplerLUT1_wrap_mode = "clamp_to_border"
SamplerLUT1_mipmap = "false"
SamplerLUT2 = "shaders_slang/crt/shaders/guest/lut/sony_trinitron2.png"
SamplerLUT2_linear = "true"
SamplerLUT2_wrap_mode = "clamp_to_border"
SamplerLUT2_mipmap = "false"
SamplerLUT3 = "shaders_slang/crt/shaders/guest/lut/other1.png"
SamplerLUT3_linear = "true"
SamplerLUT3_wrap_mode = "clamp_to_border"
SamplerLUT3_mipmap = "false"
SamplerLUT4 = "shaders_slang/crt/shaders/guest/lut/custom_lut.png"
SamplerLUT4_linear = "true"
SamplerLUT4_wrap_mode = "clamp_to_border"
SamplerLUT4_mipmap = "false"
3 Likes

Good points. Indeed, there are many negative effects when using the pseudo transparency option. Option 3 adds some blur. I personaly use mostly option 2, because most games need only checkerboard treatment. I combine it using BL=0.2 at 2x scale with smartblur (at 1x scale and 0.5x vertically) and then a crt to viewport. Using this I get satisfactory results. High contrast dithering is an open problem yet, because it is almost identical to hud elements or Sprite details like eyes.

7 Likes

@Hyllian would it be possible for pass 2 to filter only the high contrast dither, ignoring the low contrast dither? In this way, pass 2 would have more meaning, since it is just an option for those who want to control vertical lines individually from the checkerboard, or the other way around (as I have used).

Might just be on my end, but the download link just takes me a torrent site. May be broken?

it’s in the official shader repo now, so it should come with RetroArch.

3 Likes

sgenpt-mix-v8b Give a link to download the file

@kadet87 when you download Retroarch, it should come with it. Check the shaders\shaders_slang\presets directory, or the shaders\shaders_glsl\presets

3 Likes

I would like to know if any false positive mitigation method would be possible for the sgenpt mix shader?

I’ll be working on that next using some knowledge gained from checkerboard-dedither. I already made some tests and the results were very good, getting rid of many false positives and giving the image a less blurring aspect.

I’m solving some personal matters this month, btw.

7 Likes

In fact, sgenpt is the best option in my opinion for Mega Drive, and the blurry aspect only bothers at lower resolutions like the Master System or NES. I think the blurring you say would be what happens here on the black edges of the hud where it seems to blend in a little with the white of the font:

The truth is that this has become my default shader for Arcade, Saturn and Mega Drive games, as the same setting (both blend at 90) looks good on all games with resolutions larger than 320x224!

3 Likes

First release of SgenPT-Mix-Multipass:

Use online update from RA to get it.

What’s new:

  • Checkerboard treatment on par with checkerboar-dedither shaders (it’ll indeed be incorporated eventually);
  • Vertical Lines dedither improved, less false positives (though a bit of false negative);
  • CB and VL independent options.

It’s in development, so I won’t upload to RA repo until some stable version is achieved. Eventually it’ll replace checkerboard-dedither shaders.

9 Likes

Amazing! In cases where the blending interferes with the reading, just decreasing the blend works, The waterfalls, glass reflections and lights look beautiful!

Only some small dithers are ignored, maybe if using multipass together with sgenpt mix in blend 0

The only problem I found was with the fog blending in Streets of Rage 2, it doesn’t seem to be able to blend the dither at all.

3 Likes

I’m not home to try this yet but I wonder if the dreaded “x” in both super mario world and sonic 1 has been fixed.

Edit: Wait that happened in the checkerboard dedither shader I believe.

1 Like