Learning to shade on a real CRT, could use advice/input/help


#1

I’ve tinkered around with creating shader presets for quite some time, and it’s extremely satisfying to see some of the results. I love cruising this forum to see what people make as well. I’ve not been able to truly create what I am looking for though and, after trying pretty intently for a couple weeks, I thought I’d seek some help/advice from those more learned in the subject than I am.

My Setup:

  • Curved 31Khz CRT PC monitor connected via HDMI-to-VGA.
  • I’m using CRTSwitchRes at 1920 width.
  • It will generate perfect native scanlines at 240p on it’s own.
  • It will ‘not’ display any resolution with interlacing on it’s own.

My preset Goal:

Create 3 presets that approximate the general look of RF, Composite, and a mostly clean variant that I will call ‘Component’. Also, since I’m using OpenGL, I’m only looking at glsl at the moment.

Proposed shader passes:

#1.) Color – Torn between NTSC-colors and LUT shaders. Looking to get something close to what a 1990 consumer set would have. (13" JVC VCR-Combo, if we want to get specific - but it doesn’t need to be that precise)

#2) Signal Quality – I need to learn more about what makes Composite, look like composite. I hear talk of artifacts, but not sure what I am looking for. (planning to skip this pass for the Component preset) I’ve tried ntsc, gtuv50, and tv-out-tweaks - but I don’t know what I’m doing on this pass.

#3.) image-adjustment.glsl – I feel this is important for any preset, but in particular adjustments like film grain will help me alter the Composite preset’s image to create a dirty RF look. (It’s my understanding RF is just Composite that’s been modulated to a frequency)

#3.) interlacing.glsl – My #1 favorite shader (props to hunterk of course <3 ) It gives me the perfect scanline look I want for 240, while giving me interlacing at 480. The best part is it doesn’t interfere with my CRT’s native scanlines at all, so it’s interchangeable across my LED and CRT.

#4.) Border – Ideally I would like to get ‘just’ the corner/border features of CRT-geom without any other of it’s other enhancements. If I can separate these features somehow, I’d love to learn. Or if there’s a shader that does this alone, I’d appreciate a point in the right direction.

#5.) Mask – Specifically, a slot-mask. I was previously using dotmask.glsl However, I couldn’t get it to look quite the way I was expecting, and I’m unclear as to what each mask style is meant to be. Currently I’ve been using crt-easymode as it has a very configurable mask setting. However it has 2 issues I run into. Because I can only offset the mask horizontally, I can’t re-create that staggered slot-mask look. Also, like crt-geom, it’s the only feature from this shader I require - so It’s not ideal.

And… well that’s it. Because it’s on an actual CRT I get all the other features native like a phosphor trail for white-on-black images. I am sure what I’m describing here isn’t perfect, or accurate, etc etc. However, I think these would be the perfect enhancement to my existing CRT.

As I work on this I will be uploading screenshots, both on-screen and off, to show progress. I’ll also continually upload the preset text in-case anyone wants to join in the fun.

Any input, positive or negative, I welcome entirely. This is just as much about learning to work with shaders as it is to create that ideal set I have in mind.


#2

Have you checked out “tv out tweaks?” It has a lot of useful adjustments for outputting to a CRT display.

Man, I really wish I still had a decent CRT. I can’t even find a decent PC monitor around here.


#3

If your city has an online classified that’s the best place I’ve found to get one. It’s rare to see a PC monitor, but they pop up once in a while.

As for tvout-weaks it’s one of the shaders I threw at the 2nd pass after color - but I really didn’t understand the parameters. That all changed last night when I discovered how configurable shaders are using the desktop UI - I’ve been using RGUI and XMB for the longest time.

I made a custom LUT last night too - so the 1st, 2nd, 3rd, and 4th passes are basically locked in for color, signal, image, and scanlines. That just leaves the border and mask passes to tinker with.

Unless I can do more composit-y things with another shader? Still trying to read online about what makes it the way it looks.

I’ll post the shader text and some screenshots/pictures later tonight to show where i’m at.


#4

Yeah I’m just not really interested in TVs anymore; they have too many flaws and require too much work to get them back to an acceptable condition IMO. PC CRTs on the other hand are like a poor man’s xVM; the picture quality with 240p content is very comparable for just a fraction of the cost. I had an awesome 20” Viewsonic that finally gave up the ghost about a year ago. Just kept getting gradually brighter until it was unusable. Now I wish that I had taken it to an electronics guy to have it repaired instead of recycling it, because I’ve been unable to find a decent replacement after months of searching :frowning:

Moral of the story: keep your CRTs!


#5

Sounds like a bad flyback transformer, which is a fairly easy repair, assuming you can find a replacement.


#6

I’m having the worst time trying to get pictures of this setup… On-screen shots on the LED make it look awful, off-screen shots on the CRT I can’t seem to get the stupid pictures from my phone onto the internet at all (infuriating haha). On-screen CRT screenshots are useless because of the resolution

For the most part this shader is nothing short of gorgeous. BUT I noticed that interlacing.glsl is causing a diagonal line to to from the bottom-left to the top-right. It was so sublte, I did not notice it - but now that it’s there I can’t unsee it.

interlacing is doing this at all scaling and at don’t care, nearest, and linear (I know it’s supposed to be 2x, but I double checked all the settings. to be thurough)

It’s a 1920 x 240 resolution. I know the scanlines from integer are not necessary here, but the shader needs to be versatile enough to pull up interlacing when that resolution goes higher.

I searched the forums, and found 1 instance of this, and the solution was linear filtering - but that doesn’t fix it here.


#7

I figured I could at least upload the preset if anyone wants to check it out. At least until I can figure out how to get my pictures online…

alias0 = ""
alias1 = ""
alias2 = ""
alias3 = ""
alias4 = ""
alias5 = ""
BRIGHT_BOOST = "1.200000"
cornersize = "0.030000"
cornersmooth = "80.000000"
CRTgamma = "2.400000"
CURVATURE = "0.000000"
d = "1.600000"
DILATION = "0.000000"
DOTMASK = "0.000000"
enable_480i = "1.000000"
float_framebuffer0 = "false"
float_framebuffer1 = "false"
float_framebuffer2 = "false"
float_framebuffer3 = "false"
float_framebuffer4 = "false"
float_framebuffer5 = "false"
GAMMA_INPUT = "2.000000"
GAMMA_OUTPUT = "1.800000"
ia_B = "1.000000"
ia_black_level = "0.000000"
ia_BOTMASK = "0.000000"
ia_bright_boost = "0.000000"
ia_contrast = "1.000000"
ia_FLIP_HORZ = "0.000000"
ia_FLIP_VERT = "0.000000"
ia_G = "1.000000"
ia_GRAIN_STR = "0.000000"
ia_LMASK = "0.000000"
ia_luminance = "1.000000"
ia_monitor_gamma = "2.200000"
ia_overscan_percent_x = "0.000000"
ia_overscan_percent_y = "0.000000"
ia_R = "1.000000"
ia_RMASK = "0.000000"
ia_saturation = "1.000000"
ia_SHARPEN = "0.000000"
ia_target_gamma = "2.200000"
ia_TOPMASK = "0.000000"
ia_XPOS = "0.000000"
ia_YPOS = "0.000000"
ia_ZOOM = "1.000000"
lum = "0.000000"
LUT_Size = "32.000000"
MASK_DOT_HEIGHT = "1.000000"
MASK_DOT_WIDTH = "2.000000"
MASK_SIZE = "1.000000"
MASK_STAGGER = "2.000000"
MASK_STRENGTH = "1.000000"
mipmap_input0 = "false"
mipmap_input1 = "false"
mipmap_input2 = "false"
mipmap_input3 = "false"
mipmap_input4 = "false"
mipmap_input5 = "false"
monitorgamma = "2.200000"
overscan_x = "102.000000"
overscan_y = "102.000000"
parameters = "LUT_Size;TVOUT_RESOLUTION;TVOUT_COMPOSITE_CONNECTION;TVOUT_TV_COLOR_LEVELS;TVOUT_RESOLUTION_Y;TVOUT_RESOLUTION_I;TVOUT_RESOLUTION_Q;ia_target_gamma;ia_monitor_gamma;ia_overscan_percent_x;ia_overscan_percent_y;ia_saturation;ia_contrast;ia_luminance;ia_black_level;ia_bright_boost;ia_R;ia_G;ia_B;ia_ZOOM;ia_XPOS;ia_YPOS;ia_TOPMASK;ia_BOTMASK;ia_LMASK;ia_RMASK;ia_GRAIN_STR;ia_SHARPEN;ia_FLIP_HORZ;ia_FLIP_VERT;CRTgamma;monitorgamma;d;CURVATURE;R;cornersize;cornersmooth;x_tilt;y_tilt;overscan_x;overscan_y;DOTMASK;SHARPER;scanline_weight;lum;percent;enable_480i;top_field_first;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"
percent = "0.000000"
R = "2.000000"
SamplerLUT = "W:\Emulators\RetroArch\shaders\shaders_glsl\reshade\shaders\LUT\Custom.png"
SamplerLUT_linear = "true"
SamplerLUT_mipmap = "false"
SamplerLUT_wrap_mode = "clamp_to_border"
SCANLINE_BEAM_WIDTH_MAX = "1.500000"
SCANLINE_BEAM_WIDTH_MIN = "1.500000"
SCANLINE_BRIGHT_MAX = "0.650000"
SCANLINE_BRIGHT_MIN = "0.350000"
SCANLINE_CUTOFF = "400.000000"
SCANLINE_STRENGTH = "0.000000"
scanline_weight = "0.500000"
shader0 = "W:\Emulators\RetroArch\shaders\shaders_glsl\reshade\shaders\LUT\LUT.glsl"
shader1 = "W:\Emulators\RetroArch\shaders\shaders_glsl\crt\shaders\tvout-tweaks.glsl"
shader2 = "W:\Emulators\RetroArch\shaders\shaders_glsl\misc\image-adjustment.glsl"
shader3 = "W:\Emulators\RetroArch\shaders\shaders_glsl\crt\shaders\crt-geom.glsl"
shader4 = "W:\Emulators\RetroArch\shaders\shaders_glsl\misc\interlacing.glsl"
shader5 = "W:\Emulators\RetroArch\shaders\shaders_glsl\crt\shaders\crt-easymode.glsl"
shaders = "6"
SHARPER = "1.000000"
SHARPNESS_H = "0.500000"
SHARPNESS_V = "1.000000"
srgb_framebuffer0 = "false"
srgb_framebuffer1 = "false"
srgb_framebuffer2 = "false"
srgb_framebuffer3 = "false"
srgb_framebuffer4 = "false"
srgb_framebuffer5 = "false"
textures = "SamplerLUT"
top_field_first = "0.000000"
TVOUT_COMPOSITE_CONNECTION = "0.000000"
TVOUT_RESOLUTION = "576.000000"
TVOUT_RESOLUTION_I = "256.000000"
TVOUT_RESOLUTION_Q = "256.000000"
TVOUT_RESOLUTION_Y = "256.000000"
TVOUT_TV_COLOR_LEVELS = "0.000000"
wrap_mode0 = "clamp_to_border"
wrap_mode1 = "clamp_to_border"
wrap_mode2 = "clamp_to_border"
wrap_mode3 = "clamp_to_border"
wrap_mode4 = "clamp_to_border"
wrap_mode5 = "clamp_to_border"
x_tilt = "0.000000"
y_tilt = "0.000000"

Obviously the LUT is going to not work lol as I made my own color set.

EDIT : Guess I could just upload the image:


#8

If you’re running at 240p, the interlacing isn’t going to work right anyway. It needs the full 480 lines.


#9

No, no, that part I totally get. Sorry I’m not explaining myself well…

I have it in the preset for when CRTswitchres changes my monitors resolution ‘to’ 1920x480 ‘from’ 1920x240. Previously I’ve used interlacing.glsl in this scenario on it’s own or w/ minimal other effects and it’s worked perfect 'cause it places it’s scanlines in exactly the right spot.

Only by adding these other effects in was I able to see this diagonal line at sub 480. But… I’m not sure why, or what I can do to fix it.

I’m thinking if I can disable interlacing.glsl’s effects until it needs to do interlacing that could work… I don’t know, now I’m just thinking out loud.

Really the end-goal is to have my monitor’s scanlines at 240p, and interlacing.glsl’s interlacing at 480p. All under the same preset.

Or if there’s some way to get CRTEmuDriver to make those resolutions interlaced, I think I could remove it from the preset alltogether.

I really hope that makes more sense - I’m really bad at communicating concepts in my head into words. hahaha


#10

Ok, so I checked this with my monitor at 1290x960 (4x 240p) and the effect is there.

The shader looks awful compared to native res here but this shows what I’m talking about. You can really see the effect in the line above the B and O in “Boss” and you can follow it through the radio.

Edit: It doesn’t look anywhere near this dark on my HDR LED or my CRT.


#11

Try changing this line:

to:

TEX0.xy = TexCoord.xy * 1.0001;


#12

So, a few things to report now.

The change to the interlacing.glsl didn’t disable the effect at sub-400. I double checked the file and my settings a couple times to make sure.

BUT here’s the real kicker, and I feel like the biggest idiot in the world… I decided to re-assemble the preset from scratch with this edited interlacing.glsl and I noticed after I load the shader passes but BEFORE I alter the parameters… it wasn’t happening.

The culprit wasn’t interlacing.glsl. Which I would have bet my life on from my previous tinkering/testing. I can’t explain where I went wrong… and I feel really bad for wasting your time with that rabbit hole man… seriously I feel stupid and I apologize.

It was crt-geom… the scanline weight parameter. Setting it to anything higher than 0.30 produces the effect… I had it set to .50 (max) because it was bringing up the brightness off the active lines on my regular LED screen (which from the screenshot you can see it needed all it can get haha)

I’m gonna try to figure out how to get my pictures online to show the state of it for now but… Thank you for your help, and I’m sorry for being an idiot haha. Ugh…


#13

no biggie. I didn’t spend a lot of time on that, as it’s the go-to solution for those diagonal lines, which are usually caused by rounding errors.