New CRT shader from Guest + CRT Guest Advanced updates

What mask do you recommend to 1080p and what is your videos settings?

1 Like

I really recommend mask 8 (just added) for 1080p. After using slot masks for a while it’s very apparent how much better aperture grille is at 1080p.

I pasted my current settings below. Let me know if these settings work for you, gamma on my display is kinda weird though.

Guest posted some settings about a hundred posts up, I found they resulted in the black level being very high but you might get some ideas.

shaders = "7"
shader0 = "shaders_slang/misc/grade.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/crt/shaders/guest/crt-gdv-new/afterglow0.slang"
filter_linear1 = "false"
wrap_mode1 = "clamp_to_border"
mipmap_input1 = "false"
alias1 = "AfterglowPass"
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/crt/shaders/guest/crt-gdv-new/pre-shaders-afterglow.slang"
filter_linear2 = "false"
wrap_mode2 = "clamp_to_border"
mipmap_input2 = "false"
alias2 = "LinearizePass"
float_framebuffer2 = "true"
srgb_framebuffer2 = "false"
scale_type_x2 = "source"
scale_x2 = "1.000000"
scale_type_y2 = "source"
scale_y2 = "1.000000"
shader3 = "shaders_slang/crt/shaders/guest/crt-gdv-new/avg-lum.slang"
filter_linear3 = "true"
wrap_mode3 = "clamp_to_border"
mipmap_input3 = "true"
alias3 = "AvgLumPass"
float_framebuffer3 = "false"
srgb_framebuffer3 = "false"
scale_type_x3 = "source"
scale_x3 = "1.000000"
scale_type_y3 = "source"
scale_y3 = "1.000000"
shader4 = "shaders_slang/crt/shaders/guest/crt-gdv-new/blur_horiz2.slang"
filter_linear4 = "true"
wrap_mode4 = "clamp_to_border"
mipmap_input4 = "false"
alias4 = ""
float_framebuffer4 = "true"
srgb_framebuffer4 = "false"
scale_type_x4 = "absolute"
scale_x4 = "800"
scale_type_y4 = "source"
scale_y4 = "1.000000"
shader5 = "shaders_slang/crt/shaders/guest/crt-gdv-new/blur_vert2.slang"
filter_linear5 = "true"
wrap_mode5 = "clamp_to_border"
mipmap_input5 = "false"
alias5 = "GlowPass"
float_framebuffer5 = "true"
srgb_framebuffer5 = "false"
scale_type_x5 = "absolute"
scale_x5 = "800"
scale_type_y5 = "absolute"
scale_y5 = "600"
shader6 = "shaders_slang/crt/shaders/guest/crt-gdv-new/crt-guest-dr-venom2.slang"
filter_linear6 = "true"
wrap_mode6 = "clamp_to_border"
mipmap_input6 = "false"
alias6 = ""
float_framebuffer6 = "false"
srgb_framebuffer6 = "false"
scale_type_x6 = "viewport"
scale_x6 = "1.000000"
scale_type_y6 = "viewport"
scale_y6 = "1.000000"
parameters = "g_gamma_in;g_signal_type;g_gamma_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;PR;PG;PB;AS;sat;TNTC;CP;CS;WP;wp_saturation;GAMMA_INPUT;lsmooth;SIZEH;GLOW_FALLOFF_H;SIZEV;GLOW_FALLOFF_V;glow;bloom;TATE;IOS;OS;BLOOM;gamma_c;brightboost;brightboost1;gsl;scanline1;scanline2;beam_min;beam_max;beam_size;vertmask;scans;spike;h_sharp;s_sharp;csize;bsize;warpX;warpY;shadowMask;masksize;maskDark;maskLight;CGWG;mcut;slotmask;slotwidth;double_slot;slotms;mclip;inter;interm;gamma_out"
g_gamma_in = "2.400000"
g_signal_type = "1.000000"
g_gamma_type = "1.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 = "8005.000000"
g_sat = "0.000000"
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"
PR = "0.140000"
PG = "0.140000"
PB = "0.140000"
AS = "0.080000"
sat = "0.100000"
TNTC = "0.000000"
CP = "0.000000"
CS = "0.000000"
WP = "0.000000"
wp_saturation = "1.000000"
GAMMA_INPUT = "2.400000"
lsmooth = "0.900000"
SIZEH = "4.000000"
GLOW_FALLOFF_H = "0.300000"
SIZEV = "4.000000"
GLOW_FALLOFF_V = "0.300000"
glow = "0.000000"
bloom = "0.000000"
TATE = "0.000000"
IOS = "0.000000"
OS = "1.000000"
BLOOM = "0.000000"
gamma_c = "1.000000"
brightboost = "1.000000"
brightboost1 = "1.500000"
gsl = "0.000000"
scanline1 = "6.000000"
scanline2 = "18.000000"
beam_min = "1.999999"
beam_max = "1.000000"
beam_size = "1.000000"
vertmask = "0.000000"
scans = "1.000000"
spike = "0.000000"
h_sharp = "3.000001"
s_sharp = "1.000000"
csize = "0.000000"
bsize = "600.000000"
warpX = "0.000000"
warpY = "0.000000"
shadowMask = "8.000000"
masksize = "1.000000"
maskDark = "0.500000"
maskLight = "1.000000"
CGWG = "0.500000"
mcut = "1.150000"
slotmask = "0.000000"
slotwidth = "2.000000"
double_slot = "1.000000"
slotms = "1.000000"
mclip = "0.500000"
inter = "350.000000"
interm = "1.000000"
gamma_out = "2.400000"
textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3"
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"
1 Like

It’s a feature but like rafan said, you need at least black frame insertion.

1 Like

I’m getting nice results from your new shader. I found it’s easier to deal with colors after I removed the grade pass. Lut 1 is has very odd almost monochromatic color and lut 3 causes black artifacts, which if I recall, is a problem with 1650 gpu. Temperature is very tricky to get right and not have it blow out details in the brights.

3 Likes

I think the ease of using grade depends on what you’re actually try to do with the color management.

2 Likes

I think Venom 2 might have some overlapping or conflicting color and gamma issues with grade. I could be wrong but I felt like I wasn’t getting as good as results with it as before.

1 Like

Could you post the 240p test suite color bars with ver. 2 and grade + lut’s?

I’m getting:

LUT1:

LUT2:

LUT3:

Lower res. is OK. I’m getting nice results though, perhaps it’s fixable although i’d had to guess a bit.

And also grade + problematic color temperature. But there is really no need to use both functionalities though.

grade + color temp -100%

Also very important, to start a new setup with the newest version, from the given folder. The folder can be renamed though.

Unfortunately this update breaks the support for LUTs with size 64.0 :frowning: I’m getting discontinuities in blue. See (scaled down) image of Super Aleste title screen below:

Super Aleste (J)

Btw, I’m using DisplayCAL 3D luts for Reshade as per Dogway’s suggestion for using screen calibration profile in RA full screen mode.

//#define LUT_Size 32.0
#define LUT_Size 64.0

This used to work with previous versions of your shader (either with lut.slang as separate pass or with it incorporated in the prepass). It also works with grade.slang correctly (which has configurable size for luts).

Could you possibly test your updates also with a lut size 64.0? I know your two luts are specific to the shader, but it’s immensely useful to be able to use the DisplayCAL 3D Luts for reshade.

Too little info. I didn’t change the lookup code, only customized the adjustments a bit after the lut is read. There are two ways to use other custom lut’s:

  1. increase the parameter range and add lut there.

or

  1. wipe clean the if-else lut section after the line:

res = mixfix(color1, color2, mixer);

because the correctures are lut specific.

I’m not sure what you mean I should do:

I have the following custom lut in my preset:

SamplerLUT2 = "shaders_slang/crt/shaders/guest/lut/displayCAL-2.2.png"

TNTC = "2.000000"

then in the prepass I have changed the #define LUT_Size 32.0 to #define LUT_Size 64.0

Given the above, what should I wipe out from the code below, or better what should I keep?

   if (int(TNTC) == 0)
   {
      color.rgb = color.rgb;
   }
   else
   {
      float red = ( imgColor.r * (LUT_Size - 1.0) + 0.499999 ) / (LUT_Size * LUT_Size);
      float green = ( imgColor.g * (LUT_Size - 1.0) + 0.499999 ) / LUT_Size;
      float blue1 = (floor( imgColor.b  * (LUT_Size - 1.0) ) / LUT_Size) + red;
      float blue2 = (ceil( imgColor.b  * (LUT_Size - 1.0) ) / LUT_Size) + red;
      float mixer = clamp(max((imgColor.b - blue1) / (blue2 - blue1), 0.0), 0.0, 32.0);
      vec4 color1, color2, res;
      if (int(TNTC) == 1)
      {
         res = mixfix(color1, color2, mixer);
         float mx = max(res.r,max(res.g,res.b));
         float l = mix(length(imgColor.rgb), length(res.rgb), max(mx-0.5,0.0));
         res.rgb = mix(imgColor.rgb, res.rgb, clamp(25.0*(mx-0.02),0.0,1.0));
         res.rgb = normalize(res.rgb+1e-10)*l;
      }
      else if (int(TNTC) == 2)
      {
         color1 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue2, green ));
         res = mixfix(color1, color2, mixer);
		 res.rgb = lift(color, res.rgb);
      }	
      else if (int(TNTC) == 3)
      {
         color1 = COMPAT_TEXTURE( SamplerLUT3, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT3, vec2( blue2, green ));
         res = mixfix(color1, color2, mixer);
         res.rgb = pow(res.rgb, vec3(1.0/1.20));
         float mx = max(res.r,max(res.g,res.b));
         res.rgb = mix(imgColor.rgb, res.rgb, clamp(25.0*(mx-0.05),0.0,1.0));		
         float l = length(imgColor.rgb);
         res.rgb = normalize(res.rgb + 1e-10)*l;
      }	
      
      color = mix(imgColor.rgb, res.rgb, min(TNTC,1.0));
   }
1 Like

There is indeed a bug that didn’t get picked up, but it doesn’t involve LUT2.

You should change:

else if (int(TNTC) == 2)
      {
         color1 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue2, green ));
         res = mixfix(color1, color2, mixer);
         res.rgb = lift(color, res.rgb);
      }

into

else if (int(TNTC) == 2)
      {
         color1 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue2, green ));
         res = mixfix(color1, color2, mixer);
      }	

though.

Unfortunately this doesn’t fix the issue.

Edit: happens with regular, hires and ntsc version

UPDATE:

A version with lut fixes.

https://mega.nz/file/Fg5EnRSL#AE08sZnngrfRDGMuhHjXh-J2weDuoFN00i49mP_lwkQ

You should try the fixed version, but preferably add an extra LUT in the code for better issue resolving:

Something like this:

   if (int(TNTC) == 0)
   {
      color.rgb = color.rgb;
   }
   else
   {
      float red = ( imgColor.r * (LUT_Size - 1.0) + 0.499999 ) / (LUT_Size * LUT_Size);
      float green = ( imgColor.g * (LUT_Size - 1.0) + 0.499999 ) / LUT_Size;
      float blue1 = (floor( imgColor.b  * (LUT_Size - 1.0) ) / LUT_Size) + red;
      float blue2 = (ceil( imgColor.b  * (LUT_Size - 1.0) ) / LUT_Size) + red;
      float mixer = clamp(max((imgColor.b - blue1) / (blue2 - blue1), 0.0), 0.0, 32.0);
      vec4 color1, color2, res;
      if (int(TNTC) == 1)
      {
         color1 = COMPAT_TEXTURE( SamplerLUT1, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT1, vec2( blue2, green ));         
		 res = mixfix(color1, color2, mixer);
         float mx = max(res.r,max(res.g,res.b));
         float l = mix(length(imgColor.rgb), length(res.rgb), max(mx-0.5,0.0));
         res.rgb = mix(imgColor.rgb, res.rgb, clamp(25.0*(mx-0.02),0.0,1.0));
         res.rgb = normalize(res.rgb+1e-10)*l;
      }
      else if (int(TNTC) == 2)
      {
         color1 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT2, vec2( blue2, green ));
         res = mixfix(color1, color2, mixer);
         res.rgb = lift(color, res.rgb);
      }	
      else if (int(TNTC) == 3)
      {
         color1 = COMPAT_TEXTURE( SamplerLUT3, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT3, vec2( blue2, green ));
         res = mixfix(color1, color2, mixer);
         res.rgb = pow(res.rgb, vec3(1.0/1.20));
         float mx = max(res.r,max(res.g,res.b));
         res.rgb = mix(imgColor.rgb, res.rgb, clamp(25.0*(mx-0.05),0.0,1.0));		
         float l = length(imgColor.rgb);
         res.rgb = normalize(res.rgb + 1e-10)*l;
      }	
      else if (int(TNTC) == 4)
	  {
         color1 = COMPAT_TEXTURE( SamplerLUT4, vec2( blue1, green ));
         color2 = COMPAT_TEXTURE( SamplerLUT4, vec2( blue2, green ));
         res = mixfix(color1, color2, mixer); 
	  }
	  
	  color = mix(imgColor.rgb, res.rgb, min(TNTC,1.0));
   } 

And in the preset ofc:

textures = "SamplerLUT1;SamplerLUT2;SamplerLUT3;SamplerLUT4"
SamplerLUT1 = shaders/guest/lut/sony_trinitron1.png
SamplerLUT1_linear = true 
SamplerLUT2 = shaders/guest/lut/sony_trinitron2.png
SamplerLUT2_linear = true 
SamplerLUT3 = shaders/guest/lut/other1.png
SamplerLUT3_linear = true
SamplerLUT4 = shaders/guest/lut/displayCAL-2.2.png
SamplerLUT4_linear = true

…and increase the parameter range:

#pragma parameter TNTC "LUT Colors" 0.0 0.0 4.0 1.0
#define TNTC params.TNTC

But you should try the updated version first.

You can count the lut ‘squares’ and determine the lut’s size, should work.

2 Likes

I still think this is the most convincing photo I’ve ever taken, and now I’m just trying to remember how I did this. This was way back when guest-dr-venom was released. Maybe this is guest-sm? Part of it is the display; I’m using an LCD with standard subpixels in this photo. I really don’t like all these new displays with weird subpixel layouts. Anyway, now I’m trying to recreate this with new guest-dr-venom.

1 Like

@guest.r

What are your suggestions for keeping the phosphors as well-defined as possible, like in the above photo?

1 Like

Both do not resolve the issue :frowning:

I copied the LUT below, could you give it a try? Just load up SNES Super Aleste start screen with the blue bar gradient and you’ll see the blue bar missing. The size is 64. (btw, this lut worked with your venom2 versions from before today! (When only changing path to LUT2 and changing LUT size to 64.0 in prepass)

1 Like

Here is the default Venom 2 (No grade) with lut 1 for the color bars and lut 3 on mortal kombat. If I change my gpu to integrated I have no errors with lut 3 but lut 1 is completely black. I don’t get these error with lut’s from other shaders. Lut 2 plays nice with everything.

1 Like

I changed the trinitron 5&6 masks in the shader, so you cen get something like this. There are 2 control parameters for the trinitron masks, just a reminder.

Size of 64 is correct for this LUT. For old behaviour you can copy this over the LUT 4 code:

 color1 = COMPAT_TEXTURE( SamplerLUT4, vec2( blue1, green ));
 color2 = COMPAT_TEXTURE( SamplerLUT4, vec2( blue2, green ));
 res = mixfix(color1, color2, mixer);
 float l = mix(length(imgColor.rgb), length(res.rgb), 0.4);
 res.rgb = normalize(res.rgb + 1e-10)*l; 

This (the last two lines) are the changes from before… But strangely enough, it works with mine adapter. Probably rounding issues.

Thanks, the issue should be resolved now. It seemed OK with mine simple testing, since the drivers caught the exception and covered it up at it seems. :grin:

Unfortunately still the same issue.

Any chance you could revert the whole LUT change, or possibly adapt the LUT code from the grade shader? See here:

https://github.com/libretro/slang-shaders/blob/master/misc/grade.slang

I’m assuming the issue is with the LUT code. Or could it possibly be with these changes:

layout(set = 0, binding = 2) uniform sampler2D Source;
layout(set = 0, binding = 3) uniform sampler2D OriginalHistory0;
   vec4 imgColor = COMPAT_TEXTURE(OriginalHistory0, vTexCoord.xy);
   vec3 aftglow = COMPAT_TEXTURE(Source, vTexCoord.xy).rgb;   
   float w = 1.0;
   if ((imgColor.r + imgColor.g + imgColor.b) > 3.0/255.0) w = 0.0;
   float l = length(aftglow);
   aftglow = AS*w*normalize(pow(aftglow + 0.001, vec3(sat)))*l;		 
   
   imgColor.rgb = imgColor.rgb + aftglow;

versus old

layout(set = 0, binding = 2) uniform sampler2D StockPass;
layout(set = 0, binding = 3) uniform sampler2D AfterglowPass;
   vec4 imgColor = COMPAT_TEXTURE(StockPass, vTexCoord.xy);
   vec4 aftglow = COMPAT_TEXTURE(AfterglowPass, vTexCoord.xy);
   float w = 1.0-aftglow.w;
   float l = length(aftglow.rgb);
   aftglow.rgb = AS*w*normalize(pow(aftglow.rgb + 0.01, vec3(sat)))*l;
   imgColor.rgb = imgColor.rgb + aftglow.rgb;
1 Like

OK, last version for today, also found a squishy bug. Afterglow could have interfered with LUT reading, i moved it to the end of the shader. Else there is not much i can do for today.

UPDATE:

https://mega.nz/file/Fg5EnRSL#AE08sZnngrfRDGMuhHjXh-J2weDuoFN00i49mP_lwkQ

7 Likes