English Amiga Board


Go Back   English Amiga Board > Support > support.FS-UAE

 
 
Thread Tools
Old 18 March 2021, 11:43   #21
dreadnought
Registered User
 
Join Date: Dec 2019
Location: Ur, Atlantis
Posts: 1,891
People usually get fixated on "scanlines", but it's just one of the elements of the CRT image and the drive to make the gaps as thick as possible a totally modern thing. If you think about it, why would anybody want such a disjointed image? It certainly wasn't a thing back in the day. So, shadowmask/aperture grille is equally important, as is colour bleeding and other things, because they make the IQ more uniform.

Also, there is no way you can have one "correct" shader, since there were different types of monitors and TVs. Eg, my Trinitron looks rather different from kokoko3k's arcade monitor, because it's aperture grille vs shadowmask:

dreadnought is offline  
Old 18 March 2021, 14:58   #22
RuySan
Registered User
 
RuySan's Avatar
 
Join Date: Jan 2005
Location: Portugal
Age: 42
Posts: 139
For me the best shader is undoubtedly crt-easymode-halation from Retroarch. Unfortunately the easymode that i downloaded from this thread looks nothing like it.

And I agree that lots of people go crazy for scanlines even though they weren't that prevalent in CRTs. I don't get it. I tried the Royale-Kurozumi shader that's very popular and those scanlines are completely exaggerated and take away much of the image detail.
RuySan is offline  
Old 18 March 2021, 17:06   #23
Retro-Nerd
Missile Command Champion
 
Retro-Nerd's Avatar
 
Join Date: Aug 2005
Location: Germany
Age: 52
Posts: 12,435
Best Retroarch shader is CRT-Guest-DrVenom/SM, or the newer one Guest is working on called CRT-Guest-Advanced. You can't ask for more.


https://forums.libretro.com/t/new-cr...-updates/25444
Retro-Nerd is offline  
Old 18 March 2021, 17:25   #24
dreadnought
Registered User
 
Join Date: Dec 2019
Location: Ur, Atlantis
Posts: 1,891
There is no "best" shader, really. It all depends part on personal preference and part on which machine/TV look you want to simulate.

That said, of course Guest is a top notch shader. My favourite is probably Geom, though it all depends on aforementioned factors. Using Geom+Redream (Dreamcast emu) is the first time I've actually said, "hell, this is good enough", and I really am an only-CRT die hard fanatic.
dreadnought is offline  
Old 18 March 2021, 17:36   #25
Pyromania
Moderator
 
Pyromania's Avatar
 
Join Date: Jan 2002
Location: Chicago, IL
Posts: 3,375
This looks great, thanx a bunch.
Pyromania is offline  
Old 18 March 2021, 18:53   #26
nobody
Registered User
 
nobody's Avatar
 
Join Date: Dec 2013
Location: GR
Age: 46
Posts: 1,416
indeed Crt-easymode-halation on Retroarch looks closer to a real shadow mask CRT, guest.r shader looks stunning too, can be tweaked to look the same.

https://ibb.co/PxRJD0G
https://ibb.co/561KmZN
nobody is offline  
Old 21 April 2021, 21:02   #27
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
Quote:
Originally Posted by kokoko3k View Post
doing what you ask [i]the way you ask[/i
will give everyone scanlines on an LCD, finally. This is how a CRT works and looks. You attach images with closeups. This is simply not what we see on a CRT. We don't view it at that distance. This must be understood to understand scanlines.

What I do see in the closeups is 2:2 distance between pixel lines, and horizontal spacing between pixels, preventing the pixels from melting together to pillows as they do on CRTs - viewed with eyes, and not from 5cm distance.

So the recipe is in my original reply. 1080p is perfect, 1:4 distance scanlines, 1px radius blur and done.

If you won't, where are tools and examples shared so I can do it?
Photon is offline  
Old 21 April 2021, 21:40   #28
kokoko3k
Registered User
 
Join Date: Nov 2020
Location: italy
Posts: 23
Did you at least take a look at the code and the available parameters?
It does not seem so.
kokoko3k is offline  
Old 08 July 2021, 12:47   #29
Diduz
Registered User
 
Join Date: Jul 2021
Location: Italy
Posts: 4
Greetings from a fellow Amiga aficionado!
@kokoko3K, I must say I'm VERY impressed by the work you did on this shader. I especially like how you focused on hires, since I never run an Amiga emulator in lowres (I know the vast majority of games are lowres, but still... I need the perfect Workbench fonts to feel at home! ).
Some posts ago you said there was a specific setting which could grasp some of the old 1084 monitor magic. I see you've renamed the settings on your server, so I'm a bit confused now. The original name was "scanlines.tweaked.vmask.shader", what's its equivalent now?
Thanks again for the time you spent on this shader (a glsl version for the latest DosBox code would be great!).
Diduz is offline  
Old 08 July 2021, 13:21   #30
kokoko3k
Registered User
 
Join Date: Nov 2020
Location: italy
Posts: 23
Quote:
Originally Posted by Diduz View Post
Greetings from a fellow Amiga aficionado!
@kokoko3K, I must say I'm VERY impressed by the work you did on this shader. I especially like how you focused on hires, since I never run an Amiga emulator in lowres (I know the vast majority of games are lowres, but still... I need the perfect Workbench fonts to feel at home! ).
Some posts ago you said there was a specific setting which could grasp some of the old 1084 monitor magic. I see you've renamed the settings on your server, so I'm a bit confused now. The original name was "scanlines.tweaked.vmask.shader", what's its equivalent now?
Thanks again for the time you spent on this shader (a glsl version for the latest DosBox code would be great!).
Hi,
glad to hear that, I share your view about hires and workbench fonts

Anyway, It is buried here now:
http://wpage.unina.it/aorefice/share...d.vmask.shader


You can browse all of the presets here too:
http://wpage.unina.it/aorefice/sharevari/koko-aio/

I suggest you to take a look to 1.40 folder as it contains improved presets and maybe you'll find something better that looks like the one you were looking for;
There, the presets follow a naming scheme made to suggest what (and how sometimes) the shader features are enabled.
-edit-
ops, i've already wroteabout the naming scheme at the end of the first post, see there too.
Oh, and about dosbox, it seems to use glsl, so the port should not be too complex, but i'm really not that interested in doing that, so i cannot promise anything...

Last edited by kokoko3k; 08 July 2021 at 13:32.
kokoko3k is offline  
Old 08 July 2021, 15:38   #31
Diduz
Registered User
 
Join Date: Jul 2021
Location: Italy
Posts: 4
Quote:
Originally Posted by kokoko3k View Post
I suggest you to take a look to 1.40 folder as it contains improved presets and maybe you'll find something better that looks like the one you were looking for;
Thanks! Wow, lots of testing ahead...

Quote:
Originally Posted by kokoko3k View Post
Oh, and about dosbox, it seems to use glsl, so the port should not be too complex, but i'm really not that interested in doing that, so i cannot promise anything...
Don't worry, it was worth a shot.
Diduz is offline  
Old 09 September 2021, 00:28   #32
markpaterson
Registered User
 
Join Date: Jan 2016
Location: Bay Area / USA
Posts: 43
Nice work kokoko3k. Is there any way to prevent the shader being used by FS-UAE in RTG modes? I'd like it for games only. Thanks!
markpaterson is offline  
Old 09 September 2021, 13:20   #33
kokoko3k
Registered User
 
Join Date: Nov 2020
Location: italy
Posts: 23
Hello, this is a good question, indeed.

I didn't found anything in the fs-uae docs to disable shaders for rtg modes.
Maybe you could ask in the upper level:
http://eab.abime.net/forumdisplay.php?f=122
Or, with a github account, asking upstream by opening a feature request here:
https://github.com/FrodeSolheim/fs-uae/issues/new

Let us know!
kokoko3k is offline  
Old 09 September 2021, 18:42   #34
markpaterson
Registered User
 
Join Date: Jan 2016
Location: Bay Area / USA
Posts: 43
I opened a GitHub issue about it. I guess a workaround would be to just make a separate config for gaming and one for workbench, but that's an inelegant solution. I'd rather just have one Amiga.
markpaterson is offline  
Old 09 September 2021, 19:24   #35
markpaterson
Registered User
 
Join Date: Jan 2016
Location: Bay Area / USA
Posts: 43
scanlines.tweaked might be my favorite CRT shader so far!

I'd like to tweak it slightly though, so that the whites don't blow out quite so much. It looks great for single lines, but for larger solid white areas I'd still like to see a little of the scanlines bleeding through. How would I do this? I opened it up in a text editor but i'm unsure what value to adjust. Thanks!

- EDIT. I figured it out after a little experimenting. halo_power is the setting I needed to change!


halo_power 1.7 (default)


halo_power 1.0

Last edited by markpaterson; 09 September 2021 at 19:38.
markpaterson is offline  
Old 09 September 2021, 19:39   #36
kokoko3k
Registered User
 
Join Date: Nov 2020
Location: italy
Posts: 23
Quote:
Originally Posted by markpaterson View Post
scanlines.tweaked might be my favorite CRT shader so far! I'd like to tweak it slightly though, so that the whites don't blow out quite so much. It looks great for single lines, but for larger solid white areas I'd still like to see a little of the scanlines bleeding through. How would I do this? I opened it up in a text editor but i'm unsure what value to adjust. Thanks!

- EDIT. Figured it out after a little experimenting. halo_power is the setting I needed to change.


halo_power 1.0


halo_power 1.7 (default)
Yep, i'was just replying.
You can even try higher halo_h values (counter intuitive, i know!)

edit

btw the default is 1.5, not 1.7 (as in shader version 1.35)
http://wpage.unina.it/aorefice/share...tweaked.shader

Last edited by kokoko3k; 09 September 2021 at 19:45.
kokoko3k is offline  
Old 09 September 2021, 22:56   #37
Photon
Moderator
 
Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 5,602
@MarkPaterson getting closer! I've tried to explain what I'm looking for, no love for that so currently I'm settling for a solution without shaders.

Note that you have to display it at 100% scaling to see it properly. (Click twice to get it.)
Attached Thumbnails
Click image for larger version

Name:	SandDragon-Scanlines.jpg
Views:	258
Size:	331.0 KB
ID:	73150  

Last edited by Photon; 09 September 2021 at 23:25.
Photon is offline  
Old 10 September 2021, 12:24   #38
kokoko3k
Registered User
 
Join Date: Nov 2020
Location: italy
Posts: 23
Ok Photon, check this out.
I made a modification to the shader that allows you to "invert" the logic of the "darklines" feature.
Darklines were meant to draw less bright lines across the screen in "real monitor" coordinates; that means that they do not depend on the amiga resolution.
In the past the shader only allowed you to draw "one darkline every #DARKLINES_PERIOD".
Now you can pass a negative number to DARKLINES_PERIOD to invert the logic, so that if you set:
DARKLINES_PERIOD = -4.0
you'll have 3 less bright lines and a full bright line.
To recap, shader parameters that affect that "feature" are:
Code:
#define DO_DARKLINES           true  //Draw dark screenlines
#define DARKLINES_PERIOD       -4.0  //positive: Draw one darkline every # pixels
                                     //negative: Draw #num darklines and one standard line
#define DARKLINES_TRANSPARENCY 0.3   //0.0 to 1.0 from opaque to totally transparent
#define DRKLN_OVERWHITE        0.9   //how much darklines should affect bright colors
As already stated, this will:
* break compatibility with fs-uae zoom function
* strictly requires the real monitor resolution being an integer multiple of the amiga resolution.




Also note that i've disabled any scanline smoothing/glowing, because they do not make sense for your use-case; if you want thin scanlines and big gaps, there is just no room to smooth them; smoothing them would just produce the very same effect you seem to dislike.


A pre-configured shader with everything disabled apart from what you want follows:

Code:
<?xml version="1.0" encoding="UTF-8"?>

<shader language="GLSL">



<fragment scale="1.0" filter="linear"><![CDATA[
    #define DO_SCANLINES	false	//(true)	enable scanlines
    #define s1 				0.01	//(1.00)		even scanlines opacity
    #define s2				1.0	//(0.01)		odd scanlines opacity

	uniform sampler2D rubyTexture;
    void main(void) {
		//Use a vec4 for the color, so that even the alpha channel will be
		//'scanlined' this will come handy later to understand if a line is
		//a scanline or not. (see the bloom function)
        vec4 pixel = texture2D(rubyTexture, gl_TexCoord[0].xy);
        if ( DO_SCANLINES ) {
            if (mod(gl_FragCoord.y, 2.0) < 1.0) {
                    pixel *= s1;
            } else {
                    pixel *= s2;
            }
        }
        gl_FragColor = pixel;
    }

]]></fragment>

<fragment filter="linear"><![CDATA[
	
	#define DO_IN_GLOW		false			//(true)	Input signal glow, disables FIX_SCANLINES
	#define IN_GLOW_ADD		0.0				//0.0		0.0-1.0 glow overflows from the scanlines and image becomes sharper
	#define in_glow_w		2.0			//(1.5)		Input signal blur/glow width tightness
	#define in_glow_h		2.0			//(1.5)		Input signal blur/glow height tightness
	#define in_glow_power	0.5             //(1.35)	Input signal glow strength
	#define in_glow_gamma	1.0				//(5.0)		1.0-9.0, The higher,  the less the glow on dark colors, use integers.
	
	#define FIX_SCANLINES	false			//(true)	Mitigate dephasing when FS-UAE scales the texture
											//          WW: it only works when is true and DO_IN_GLOW is false


	#define DO_RGB_MASK		false			//(true)	Draw rgb mask
	// RGB mask:       R     G     B
    #define m1 vec3 ( 1.0 , 0.0 , 0.0 )    //col 1
    #define m2 vec3 ( 0.0 , 1.0 , 0.0 )    //col 2
    #define m3 vec3 ( 0.0 , 0.0 , 1.0  )   //col 3

	#define VMASK_OVERWHITE			1.0		//how much vmask should affect bright colors
	#define DRKLN_OVERWHITE			1.0		//how much darklines should affect bright colors
	
	#define DO_DARKLINES			true	//(false)	Draw dark screenlines
	#define DO_DARKLINES_VOFFSET    false   //(true)	When drawind darklines, offset them by triads
	#define DARKLINES_PERIOD		-4.0	//(4.0)		// for positive numbers: Draw one darkline every # pixels
														// for negative numbers: Draw #num darklines and one standard line
	#define DARKLINES_TRANSPARENCY	0.7		//(0.4)		0.0 to 1.0 from opaque to totally transparent
	#define FIX_FOR_INTEL			true	//1.0		There must be a weird bug into the intel shader compiler
														//which leads to absymal performance when doing 
														//halo after darklines.
														//use 1.0 to fix.
	
	#define DO_HALO	   false			  //(true)		Halation on/off
	#define halo_w     0.5            //(0.5)		Halo width tightness
	#define halo_h     0.5            //(0.5)		Halo height tightness
	#define halo_power 0.6            //(1.1)		Halo strength
	#define halo_gamma 3.0            //(5.0)		1.0-9.0 The higher, the less the halo on dark colors, use integers.

													//conflicts with real scanlines and autozoom.

	#define DO_BLOOM	  		false	//(true)	Blooming
	#define bloom_directions	16.0		//16.0		BLOOM DIRECTIONS More is better but slower)
	#define bloom_quality		2.0		//2.0		BLOOM QUALITY 4.0 - More is better but slower
	#define bloom_size			5.0		//5.0		BLOOM SIZE (Radius)
	#define bloom_gamma			2.0		//3.0		1.0-9.0 integer: restrict bloom to bright colors
	#define bloom_mix			0.1		//0.2		BLOOM final mix 
	#define bloom_over_scanline false	//true		Set it false to spare some gpu cycles if you disabled scanlines in the first fragment.

	#define DO_ALT_BLANK		false	//false     Show/blank odd/even fields alternately.
                                                    //to emulate short persistence of a CRT display. 
                                                    //Requires vsync and 50/100/150hz modeline and halves brightness.
	
	#define DO_COLOR_CORRECTION		false	//(true) 	Do (RGB) gamma correction
	#define GAMMA					1.7		//1.5		Global Gamma correction, the higher, the darker.
	#define cc vec3(0.46 ,0.45 , 0.44)		//(0.46,0.45,0.44) r,g,b, gamma correction values
	#define saturation				1.1		//1.0    Saturation modifier, 1.0 is neutral saturation.

/*****************************************************************************/	
	#define eps 1e-8
	uniform int rubyFrameCount ;
	uniform sampler2D rubyTexture;
	uniform vec2 rubyTextureSize;
	uniform vec2 rubyOutputSize ;
	uniform vec2 rubyOrigInputSize;

	vec3 int_pow3(vec3 v, float fpow){
		if ( fpow == 1.0 ) { return v; };
		if ( fpow == 2.0 ) { return v*v; }; 
		if ( fpow == 3.0 ) { return v*v*v; }; 
		if ( fpow == 4.0 ) { return v*v*v*v; }; 
		if ( fpow == 5.0 ) { return v*v*v*v*v; }; 
		if ( fpow == 6.0 ) { return v*v*v*v*v*v; }; 
		if ( fpow == 7.0 ) { return v*v*v*v*v*v*v; }; 
		if ( fpow == 8.0 ) { return v*v*v*v*v*v*v*v; }; 
		if ( fpow == 9.0 ) { return v*v*v*v*v*v*v*v*v; }; 
	}

	float int_pow(float v, float fpow){
		if ( fpow == 1.0 ) { return v; };
		if ( fpow == 2.0 ) { return v*v; }; 
		if ( fpow == 3.0 ) { return v*v*v; }; 
		if ( fpow == 4.0 ) { return v*v*v*v; }; 
		if ( fpow == 5.0 ) { return v*v*v*v*v; }; 
		if ( fpow == 6.0 ) { return v*v*v*v*v*v; }; 
		if ( fpow == 7.0 ) { return v*v*v*v*v*v*v; }; 
		if ( fpow == 8.0 ) { return v*v*v*v*v*v*v*v; }; 
		if ( fpow == 9.0 ) { return v*v*v*v*v*v*v*v*v; }; 
	}
	
	vec3 pixel_glow(float my_glowpix, float my_glowpixy, float my_glow, float glow_gamma) {
		// Calculating texel coordinates
			vec2 size     = rubyTextureSize;
			vec2 inv_size = 1.0/rubyTextureSize;
			vec2 OGL2Pos = gl_TexCoord[0].xy * size  - vec2(0.5,0.5);
			vec2 fp = fract(OGL2Pos);
			vec2 dx = vec2(inv_size.x,0.0);
			vec2 dy = vec2(0.0, inv_size.y);
			vec2 pC4 = floor(OGL2Pos) * inv_size + 0.5*inv_size;    

			vec2 x2 = 2.0*dx; vec2 x3 = 3.0*dx;
			vec2 y2 = 2.0*dy;

			float wl3 = 2.0 + fp.x; wl3*=wl3; wl3 = exp2(-my_glowpix*wl3);
			float wl2 = 1.0 + fp.x; wl2*=wl2; wl2 = exp2(-my_glowpix*wl2);
			float wl1 =       fp.x; wl1*=wl1; wl1 = exp2(-my_glowpix*wl1);
			float wr1 = 1.0 - fp.x; wr1*=wr1; wr1 = exp2(-my_glowpix*wr1);
			float wr2 = 2.0 - fp.x; wr2*=wr2; wr2 = exp2(-my_glowpix*wr2);
			float wr3 = 3.0 - fp.x; wr3*=wr3; wr3 = exp2(-my_glowpix*wr3);    
			
			float wt = 1.0/(wl3+wl2+wl1+wr1+wr2+wr3);

			vec3 l3 = texture2D(rubyTexture, pC4 -x2 ).xyz;
			vec3 l2 = texture2D(rubyTexture, pC4 -dx ).xyz;
			vec3 l1 = texture2D(rubyTexture, pC4     ).xyz;
			vec3 r1 = texture2D(rubyTexture, pC4 +dx ).xyz;
			vec3 r2 = texture2D(rubyTexture, pC4 +x2 ).xyz;
			vec3 r3 = texture2D(rubyTexture, pC4 +x3 ).xyz;
			l3=int_pow3(l3,glow_gamma); l2=int_pow3(l2,glow_gamma); l1=int_pow3(l1,glow_gamma); 
			r1=int_pow3(r1,glow_gamma); r2=int_pow3(r2,glow_gamma); r3=int_pow3(r3,glow_gamma); 

			vec3 t1 = (l3*wl3 + l2*wl2 + l1*wl1 + r1*wr1 + r2*wr2 + r3*wr3)*wt;

			l3 = texture2D(rubyTexture, pC4 -x2 -dy).xyz;
			l2 = texture2D(rubyTexture, pC4 -dx -dy).xyz;
			l1 = texture2D(rubyTexture, pC4     -dy).xyz;
			r1 = texture2D(rubyTexture, pC4 +dx -dy).xyz;
			r2 = texture2D(rubyTexture, pC4 +x2 -dy).xyz;
			r3 = texture2D(rubyTexture, pC4 +x3 -dy).xyz;
			l3=int_pow3(l3,glow_gamma); l2=int_pow3(l2,glow_gamma); l1=int_pow3(l1,glow_gamma); 
			r1=int_pow3(r1,glow_gamma); r2=int_pow3(r2,glow_gamma); r3=int_pow3(r3,glow_gamma); 

			vec3 t2 = (l3*wl3 + l2*wl2 + l1*wl1 + r1*wr1 + r2*wr2 + r3*wr3)*wt;    

			l3 = texture2D(rubyTexture, pC4 -x2 +dy).xyz;
			l2 = texture2D(rubyTexture, pC4 -dx +dy).xyz;
			l1 = texture2D(rubyTexture, pC4     +dy).xyz;
			r1 = texture2D(rubyTexture, pC4 +dx +dy).xyz;
			r2 = texture2D(rubyTexture, pC4 +x2 +dy).xyz;
			r3 = texture2D(rubyTexture, pC4 +x3 +dy).xyz;
			l3=int_pow3(l3,glow_gamma); l2=int_pow3(l2,glow_gamma); l1=int_pow3(l1,glow_gamma); 
			r1=int_pow3(r1,glow_gamma); r2=int_pow3(r2,glow_gamma); r3=int_pow3(r3,glow_gamma); 

			vec3 b1 = (l3*wl3 + l2*wl2 + l1*wl1 + r1*wr1 + r2*wr2 + r3*wr3)*wt;

			l3 = texture2D(rubyTexture, pC4 -x2 +y2).xyz;
			l2 = texture2D(rubyTexture, pC4 -dx +y2).xyz;
			l1 = texture2D(rubyTexture, pC4     +y2).xyz;
			r1 = texture2D(rubyTexture, pC4 +dx +y2).xyz;
			r2 = texture2D(rubyTexture, pC4 +x2 +y2).xyz;
			r3 = texture2D(rubyTexture, pC4 +x3 +y2).xyz;
			l3=int_pow3(l3,glow_gamma); l2=int_pow3(l2,glow_gamma); l1=int_pow3(l1,glow_gamma); 
			r1=int_pow3(r1,glow_gamma); r2=int_pow3(r2,glow_gamma); r3=int_pow3(r3,glow_gamma); 

			vec3 b2 = (l3*wl3 + l2*wl2 + l1*wl1 + r1*wr1 + r2*wr2 + r3*wr3)*wt;    

			wl2 = 1.0 + fp.y; wl2*=wl2; wl2 = exp2(-my_glowpixy*wl2);
			wl1 =       fp.y; wl1*=wl1; wl1 = exp2(-my_glowpixy*wl1);
			wr1 = 1.0 - fp.y; wr1*=wr1; wr1 = exp2(-my_glowpixy*wr1);
			wr2 = 2.0 - fp.y; wr2*=wr2; wr2 = exp2(-my_glowpixy*wr2);

			wt = 1.0/(wl2+wl1+wr1+wr2);    

			vec3 Bloom = (t2*wl2 + t1*wl1 + b1*wr1 + b2*wr2)*wt;
			return Bloom*my_glow;
	}
	vec3 pixel_vmask(vec3 source,vec3 lm1,vec3 lm2,vec3 lm3, vec3 white_reference,float over_white) {
		float col = float(int(gl_FragCoord.x));
		vec3 pixel_out;
		vec3 vmasked;
		
		if (int(mod(col, 3.0)) < 1) {
			vmasked = lm1*source;
		}
		else if (int(mod(col, 3.0)) < 2) {
			vmasked = lm2*source;
		}
		else {
			vmasked = lm3*source;
		}
		if (over_white == 1.0) {
			return vmasked;
		} else {
			float whiteness=(white_reference.r+white_reference.g+white_reference.b)/3.0;
			whiteness-=over_white;
			whiteness=min(whiteness,1.0);
			whiteness=max(whiteness,0.0);
			return mix(vmasked,source,whiteness);
		}
	}

vec3 blur(float Directions, float Quality, float Size) {
	vec2 iResolution = rubyTextureSize;
	float Pi = 6.28318530718; // Pi*2
	vec2 Radius = Size/iResolution.xy;
	//vec2 uv = vec2(gl_FragCoord.xy / iResolution);
	vec2 uv = gl_TexCoord[0].xy;
		
	vec3 color = texture2D(rubyTexture, uv).rgb;
	float steps=0.0;
	for( float d=0.0; d<Pi; d+=Pi/Directions) {
		for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality) {
			color += texture2D( rubyTexture, uv+vec2(cos(d),sin(d))*Radius*i).rgb;		
			steps+=1.0;
        }
    }	
	color /= steps; //(Quality * Directions - 15.0);


	return color;
}
	
	vec3 bloom(float Directions, float Quality, float Size,float fbloom_gamma,bool over_scanline) {
		float Pi = 6.28318530718; // Pi*2
		vec2 Radius = Size/rubyTextureSize.xy;
		vec2 uv = gl_TexCoord[0].xy;
		float steps=0.0;
		vec4 lookup=vec4(0.0,0.0,0.0,0.0);
		vec3 color=vec3(0.0,0.0,0.0);
		for( float d=0.0; d<Pi; d+=Pi/Directions) {
			for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality) {
				//lookup texel around
				lookup = texture2D( rubyTexture, uv+vec2(cos(d),sin(d))*Radius*i);
				if (over_scanline) {
					color +=int_pow3(lookup.rgb,fbloom_gamma) / (int_pow(lookup.a,fbloom_gamma)+0.00001);
				} else {
					color +=int_pow3(lookup.rgb,fbloom_gamma);
				}
				steps+=1.0;
			}
		}	
		color = color/steps; //(Quality * Directions - 15.0);

		return color;
	}

	vec3 pixel_darklines(vec3 source,float darkline_every, float darkline_trans, bool do_offset, vec3 white_reference,float over_white) {
		vec3 pixel_out=source;
		float col_2 =  gl_FragCoord.x;
		float line_2 = gl_FragCoord.y;

		float fDarkline_part_w=3.0 ;             //Triads width, float type
		float fDarkline_part_w_x2 = 6.0 ;        //Triads width, float type, *2
		int iDarkline_part_w = 3 ;               //Triads width, integer type (3 pixels unless changing m1,m2,m3 datatype
		
		if (over_white != 1.0) {
			//less effect on bright colors.
			float whiteness=(white_reference.r+white_reference.g+white_reference.b)/3.0;
			darkline_trans+=(whiteness-over_white);
			darkline_trans=max(darkline_trans,0.0);
			darkline_trans=min(darkline_trans,1.0);
		}
		
		if (do_offset) { 
			int hmask_shape_offset = int (darkline_every/2.0) + 1 ;
			if  (int(mod(line_2, darkline_every)) == 1) {
				if (int(mod(col_2, fDarkline_part_w_x2)) < iDarkline_part_w) {
					pixel_out =  pixel_out * darkline_trans;
				}
			} else if  (int(mod(line_2, darkline_every)) == hmask_shape_offset ) {
				// DRAW WITH OFFSET:
				col_2+=fDarkline_part_w;
				if ((int(mod(col_2, fDarkline_part_w_x2))) < iDarkline_part_w) {
					pixel_out =  pixel_out * darkline_trans;
				}
			}
		} else {
			if ( darkline_every >= 0.0) {
				if  (int(mod(line_2, darkline_every)) == 1) {
					pixel_out =  pixel_out * darkline_trans;
				}
			}
			
			if ( darkline_every < 0.0) {
				if  (int(mod(line_2, abs(darkline_every)       )) != 1) {
					pixel_out =  pixel_out * darkline_trans;
				}
			}
			
				
		}
		
		return pixel_out;
	}

	
vec3 blur5(vec2 uv, vec2 resolution, vec2 direction) {
  vec3 color = vec3(0.0);
  vec2 off1 = vec2(1.3333333333333333) * direction;
  color += texture2D(rubyTexture, uv).rgb * 0.29411764705882354;
  color += texture2D(rubyTexture, uv + (off1 / resolution)).rgb * 0.35294117647058826;
  color += texture2D(rubyTexture, uv - (off1 / resolution)).rgb * 0.35294117647058826;
  return color; 
}


vec3 fix_scanlines(float radius) {
	vec2 uv = gl_TexCoord[0].xy;
	vec2 direction=vec2(0.0,1.0);
	vec3 color=vec3(0.0);
	direction*=radius;
	color=blur5(uv,rubyTextureSize.xy,direction);
	return color;
}
	
	
vec3 pixel_alternate(vec3 source) {
	float line = gl_FragCoord.y;
	vec3 pixel_out = source;
	if  (int(mod(float(rubyFrameCount),2.0  )) == 1) {
		if  (int(mod(line,2.0  )) == 1) {
			pixel_out=vec3(0.0,0.0,0.0) ; 
		}
	} else {
		if  (int(mod(line,2.0  )) == 0) {
			pixel_out=vec3(0.0,0.0,0.0) ; 
		}
	}
	return pixel_out;
}
	

    void main(void) {
		vec3 pixel_in = texture2D(rubyTexture, gl_TexCoord[0].xy).rgb; 
		vec3 pixel_out = pixel_in;
		vec3 haloed = pixel_in;
		vec3 glowed = pixel_in;
		vec3 bloomed = pixel_in;

		if (DO_IN_GLOW) { 
			/* Input signal is blurred and glows.
			glow power versus blur power is defined by IN_GLOW_ADD.
			this allows the rgb vmask to light up on the black scanline.
			*/
			glowed = pixel_glow(in_glow_w,in_glow_h,in_glow_power,in_glow_gamma);
			if (IN_GLOW_ADD>0.0) {
				pixel_out =mix(glowed,glowed+pixel_out,IN_GLOW_ADD);
			} else {
				pixel_out =glowed;
			}
		} else if (FIX_SCANLINES) { 
			pixel_out=fix_scanlines(0.2); 	//try from 0.1 to 0.3
		} 

		
		if (DO_RGB_MASK) { 
			pixel_out = pixel_vmask(pixel_out,m1,m2,m3,pixel_in,VMASK_OVERWHITE);
		}

		if (DO_DARKLINES && DO_HALO && FIX_FOR_INTEL) {
			haloed = pixel_glow(halo_w,halo_h,halo_power,halo_gamma);
			pixel_out+=haloed; //yes i know, 
			pixel_out-=haloed; //but still...
		}
		
		
		if (DO_DARKLINES) {
			pixel_out = pixel_darklines(pixel_out,DARKLINES_PERIOD,DARKLINES_TRANSPARENCY,DO_DARKLINES_VOFFSET,pixel_in,DRKLN_OVERWHITE);
		}

		if (DO_HALO) { 
			haloed = pixel_glow(halo_w,halo_h,halo_power,halo_gamma);
			pixel_out +=haloed;
		}

		if (DO_BLOOM) {
			bloomed = bloom(bloom_directions,bloom_quality,bloom_size,bloom_gamma,bloom_over_scanline);
			pixel_out = (pixel_out * (1.0-bloom_mix) ) + ( bloomed*bloom_mix);
		}

		if (DO_COLOR_CORRECTION) {
			pixel_out = pow(pixel_out,cc*GAMMA);
		}

		if (DO_ALT_BLANK) {
			pixel_out = pixel_alternate(pixel_out);
		}
		
		if (!(saturation == 1.0)) {
			float l = length(pixel_out);
			pixel_out = normalize(pow(pixel_out + vec3(eps,eps,eps), vec3(saturation,saturation,saturation)))*l;
		}

		gl_FragColor = vec4(pixel_out,1.0);
    }
]]></fragment>
    

    


</shader>

PS: Your posted images is scaled by a factor of 3x and is not 1080p as you requested (?), the repeating pattern i see is indeed bright,dark,dark, while what i posted is bright,dark,dark,dark (4x zoom, 1080p)

Last edited by kokoko3k; 12 September 2021 at 16:07.
kokoko3k is offline  
Old 13 October 2021, 11:46   #39
kokoko3k
Registered User
 
Join Date: Nov 2020
Location: italy
Posts: 23
Uploaded a new version, 1.42:
Ability to invert the logic of pixel_darklines (see previous post)
tewaked a lot of presets (less blooming, more scanlines)
pixel_vmask: do not draw over scanlines gaps

presets:
http://wpage.unina.it/aorefice/share...koko-aio-1.42/

screenshots:
http://wpage.unina.it/aorefice/share...2/screenshots/
kokoko3k is offline  
Old 22 November 2021, 12:51   #40
RuySan
Registered User
 
RuySan's Avatar
 
Join Date: Jan 2005
Location: Portugal
Age: 42
Posts: 139
Quote:
Originally Posted by markpaterson View Post
scanlines.tweaked might be my favorite CRT shader so far!
I really don't get these heavy scalines filters. They look nothing like in CRTs. Nostalgia can pull us tricks, but every CRT that i've been using recently does what shadow mask displays do, it gives a sort of hive-pattern of the image, and not lines at all.

On Retroarch CRT-Lottes, is probably the most aproximate to the real shadow mask effect, but In general I find Easymode Halation more pleasant.
RuySan is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Shader support cybermat support.FS-UAE 4 07 March 2018 14:52
sharp-bilinear-simple shader for FS-UAE rsn8887 support.FS-UAE 15 16 January 2018 08:41
fs-uae is possible made computer with 68040 but only ocs chipcset? JPQ support.FS-UAE 4 05 May 2014 18:46
Shader support and scaling options in FS-UAE 1.3 FrodeSolheim support.FS-UAE 9 18 December 2013 17:30
Please help me with my shader! tjcbs support.WinUAE 3 02 February 2013 21:49

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 23:15.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.43510 seconds with 16 queries