A new little shader i did (glsl)

Haha lol yes should pass this as crt-cheap-ultra

1 Like

Speaking of cheapness, I tend to avoid mod,floor,fract if possible; since sin() is often super speedy, maybe this is faster:

float sin_check_offset = sin(frequency);
float is_even = step(sin_check_offset, 0.0);
y +=  is_even * 0.5;
2 Likes

Agree, mod() wrecks performance massively like it stops executing and check what you ordered at snail pace, also multiple texture reads, that’s probably the worse and close second is pow(). Also sign() etc. When you use an I-GPU like Intels of 200-300 gflops you can tell the difference.

1 Like

I noted that on my haswell too when pushing it at the limit. floor is the root of the evil; a single floor() in the wrong place killed it from 100fps to 80.
See that mod(),fract() are all implemented via floor as per spec: https://docs.gl/sl4/mod

Yes that mod() would be like 7-8 calculations at once. i always use sin() on shaders (scanlines-masks) that i want extra speed like crt-sines, zfast-composite etc. You can make a shader that looks like crt-geom using sin() for mask/scanlines and run at ~60 gflops while crt-geom would require ~500 gflops. Need to know the inner calculations of every command to properly optimize code. If you throw code at random here and there, it’s very easy to run at snail pace and another shader appears that renders the job useless lol.

I see shaders that look worse and have less options than eg crt-cyclon and run slower too:P. Then other shaders are fast like zfast-crt but no good scanlines, if you look carefully they misalign at non-integer. While sin() scanlines are perfect.

1 Like

Uploaded an Open Office excel i created to calculate the XYZ matrix of color primaries xy here

Click top right dots, and “download” or press CTRL+SHIFT+S

https://github.com/metallic77/shaders_glsl-slang/blob/main/xytoXYZ.ods

This is helpful for shader writers mostly.

3 Likes

Got a 20" curved CRT on superb condition. Some observations: Scanlines are very apparent everywhere, screen is curved but what you see is not, at least on this TV. Vignette is distributed on scanlines strength only at the edges as seen on screenshots. There is no darkening at all only stronger scanlines. Crt-cyclon slot mask, which is trying to emulate lottes mask 1 is almost exactly the same.

Green screen shows how vignette actually works

4 Likes

:point_up_2: This is something that I’ve been talking about for a while.

1 Like

Corners cut is there ofc, but actual screen curvature that you see when you sit in front of it, is much less than represented on shaders. Probably 0.01 x and y. That’s one of the things that is exaggerated on shaders and another is vignette which only applies to scanline strength at the edges. I would do a 0.01 curvature and a curved bezel in top of it to be accurate.

2 Likes

This is how i believe vignette should be done properly (GLSL). Applied on scanlines only like a real CRT does.

#define scan 0.15
float x = TEX0.x*4.0 - 0.5;
x = x*x;
res *= (scan+x)*sin((vTexCoord.y*SourceSize.y+0.5)*2.0*pi)+1.0-(scan+x);

4 Likes

That looks really good.

And yeah re: curvature, if you take the plastic bezel off of a TV and can see all the way to the edges (like on an arcade monitor), you can see actual curvature, but CRTs usually include knobs to compensate for the barrel distortion with pincushioning, so when properly set up, straight lines are straight when you look directly at the screen. All of the dead space that creates around the edges are then covered by the plastic bezel.

6 Likes

Probably that’s why it’s zooming in too, so you can’t see the black areas.

Small update to xy to RGB matrix calculator, you can enter any temperature and get white point xy. Also added DCI as a bonus, as i read many cellphones now use that color space.

https://github.com/metallic77/shaders_glsl-slang/blob/main/xytoXYZ.ods

4 Likes

That Emmir NTSC filter is on puNES standalone emulator, that looks pretty good but too slow (?) like 20 fps.

It doesn’t bother the GPU, there is no acceleration at all, only CPU (my laptop has an i7-7th gen)

1 Like

Replaced “ntsc-simple” GLSL with a simpler, faster version, here combined with crt-cyclon

A comparison blargg (saturated)/ntsc-simple now (the desaturated one). Overall blurring is pretty close now.

2 Likes

Since you seem to use intel+linux, I just discovered a nice way to get generated gpu assembly by the driver you may be interested in.

It also tells you how many cycles the gpu will do:
export MESA_GLSL_CACHE_DISABLE=1 ; export INTEL_DEBUG=ann,fs retroarch <whatever> 2>&1 | tee /path/to/asm.txt

Tried that several times in the past and failed; then I realized that the shader cache had to be disabled :slight_smile:

1 Like

Slang version of simple_color_controls is apparently buggy, it can’t be combined with other presets using append/prepend. RA Log says something about duplicate parameters e.g. " Duplicate parameters found for “contrast”, but arguments do not match."

I will correct that, I noticed the problem on glsl already and fixed

2 Likes

More actual Amiga composite screens, connected to Lcd directly to see what is going on without the crt effects.

There is also dot crawl rolling on pixels, eg bright next to dark or very saturated next to desaturated or dark. There is also an RF plug to the device but didn’t bother, it’s already awful enough lol

3 Likes