Re-write and pushed a PR. Now it works even on non-integer, masks added, glow, curvature and is so fast that runs full speed on my old HTC One
Still working on this, some crazy ideas coming here and there lol. Thought something to regain lost brightness of scanlines.
float brightboost (float y,vec4 c)
{
//read pixel brightness
float lum=length(c)*0.5775;
lum=1.8*pow(lum,0.45)-0.8; lum=clamp(lum,0.0,1.0);
//redo our scanline calculation to get amount of light lost
float inten = 1.0*lum+(SCANLINE *sin(y*InputSize.y*PI*(2.0*TextureSize.y/InputSize.y)));
//apply our lost brightness back
float result = 1.0+((1.0-inten)/2.0);
return result;
}
scanlines applied then to a temporary copy of our screen hold before we apply this.
Results
before
after
Is it that youâre compositing the raw image with the image + scanlines?
Oh, I now read the code and I was wondering why something like this didnât exist before. Itâs basically a kind of âSmart Scanlines with Brightness Feedbackâ.
Something like this in CRT-Guest-Advanced would surely make my life a lot easier!
Another thing I thought about was clipping and saturation aware Smart Brightness control.
Currently I use different settings to compensate for the loss of brightness when using full strength mask and scanlines. If I use the post CRT Brightness Setting alone for example, 2 things might happen when pushed too far, saturation decreases giving a washed out look and white clipping occurs. I manually adjust the saturation to put back what is lost and I try to be very conservative with pushing brightness via these software multiplier controls to avoid clipping.
I canât help but thinking, if these controls were a little more âawareâ of the undesirable effects and automatically compensate for them, that would have been awesome.
So a CRT Brightness control that maybe tapers off its strength logarithmically in order to avoid clipping and that has a nice range limit thatâs calibrated to some standard to avoid clipping altogether would be nice - (Anti-whiteclip or Anti-burn).
That way, us shader preset developers can just crank it up nicely to where we want without having to worry about going too far.
The next aspect of this would be that the saturation is increased automatically as brightness is increased - (Anti-washout).
I even had an idea to generate more accurate âfake scanlinesâ by basing them on the location of where they would have been at native resolution instead of manually specifying the number.
Brilliant out of the box thinking! @DariusG
I enjoy your liberal use of Black Tiger! One of my favorites , so many quarters went into that one
Time for another crazy scientist-idea. After observing my shot of my Trinitron here and resized to 12% Lanczos i saw some colors gain one more pixel when the other 2 are almost off (e.g R on and GB void)
So another mask based on Lottes 2
Lottes 2
new Trinitron mask, probably can be improved
Another mask i thought. Accurate? Not like in a CRT, but smart in gaining some light and pixel dynamics per luminance.
Based on Lottes 2
else if (Shadowmask == 8.0) { float m =fract(x.x*0.3333);
if (m<0.3333) return vec3(MaskDark,MaskLight,MaskLight*col.b); //Cyan if (m<0.6666) return vec3(MaskLight*col.r,MaskDark,MaskLight); //Magenta else return vec3(MaskLight,MaskLight*col.g,MaskDark); //Yellow }
This way creates a pattern xGB RxB RGx, our âpixelâ has 2 stripes gap, 1 x in begin. 1 in the end, and 2 actual pixels used, GBR and BRG, the second one will light depending on pixel light (the *col.rgb multiplier)
Took some time to see why Glow looked like crap and improved it.
glow pattern before-after. The bigger the radius the slower it gets (and better looking), so i kept it small. Now if i can find something to reduce clipping.
I should start replying to you here instead of the other thread when itâs time to test something out. Speaking of testing, besides that interlacing issue I spoke of the other day, do you think itâs possible to add the vignette parameters from grade to the mix? We already know that trying to apply grade by itself doesnât work on opengl es, but maybe gutting those two parameters from it could work along with maybe the phosphor and display color space parameters. Iâm trying to see how much can be added in to this âgumbo potâ shader lol
Weâll see what can be done but donât want to make it super heavy in the end. If itâs light and not too much trouble (example if need to gut and tweak half of Grade like white point lol) sure.
Iâm looking forward to your experiments lol. Your shader already got me back to playing a bunch of Saturn classics anything else you add at this point will only make it better. Iâm so glad you added in that slot mask
Yeah also me I canât play those old 8bit games e.g. Atari 2600 or Zx spectrum/c64 with sharp filters or with too much noise from ntsc filters. It just doesnât feel right.
Check this out, this was relatively straight-forward since contrast was already there (Grade vignette works sitting on contrast). Zero cost on performance.
P.S. have to alter contrast value a tick, since i have a switch if contrast = 1.0 not to be working, and disables vignette too that sits there.
https://mega.nz/file/rvpE3aSS#WCf9RRLlA1g5Oh-Zc2QF-Qi5T01YQlMwanexm8alyag
Aha! So grade CAN be gutted after all lol. Thatâs lovely, this shader is turning out so fun I love it.
This is the preset I been using so far:
shaders = "1"
shader0 = "shaders_glsl/crt/shaders/testing.glsl"
filter_linear0 = "true"
wrap_mode0 = "clamp_to_border"
mipmap_input0 = "false"
alias0 = ""
float_framebuffer0 = "false"
srgb_framebuffer0 = "false"
blurx = "0.450000"
blury = "0.150000"
warpx = "0.030000"
warpy = "0.040000"
smoothness = "100.000000"
beamlow = "2.000000"
beamhigh = "2.400000"
Shadowmask = "6.000000"
MaskDark = "0.600000"
GAMMA_IN = "2.200000"
glow = "0.080000"
sat = "1.150000"
contrast = "1.050000"
WP = "-40.000000"
Were you ever able to look into that interlacing issue? I still see that moire like pattern with it toggled on
Iâll leave this post here so he can see what Iâm taking about. I hope heâll even be interested in dealing with that old version of his shader.
I am sure he can fix it in no time if he bothers. Regarding that mask 6 if you make the calculations it creates a virtual resolution 480 x 270 at 1080p which is pretty close to a normal TV. Not bad heh
Mask 4 should be 720 x 540
Ok so it is fixed with a simple fp.y*fp.y on integer scaling, on non-integer it creates some not-well aligned scanlines
Ok so actually it works even as it is, if integer is on and Y curvature off, so the problem is how it aligns to curved screen and in non-integer
Damn Iâm not home anymore to test all of this. So youâre saying it only looks right with integer scaling and youâll get the non aligned scanlines with non integer scaling? I hope thatâs not the case cause I never use integer scaling