Welcome, Guest.
Username: Password: Remember me

TOPIC: Sharp-edged, Stripes-like Scanlines

Sharp-edged, Stripes-like Scanlines 2 months 2 days ago #1

First and foremost, Hi. I'm Writing to figure a way to realize scanlines, as shown in the photos bellow, using Reshade 3.0.

Photo #1
Photo #2

Those were taken using Dolphin Emulator; The Scanlines were simulated using DolphinFX

P.S. I Realize what I want doesn't look anything like an Authentic Scanlines Effect.

Thank you~
Last Edit: 2 months 1 day ago by AladinZ.
The administrator has disabled public write access.

Sharp-edged, Strips-like Scanlines 2 months 2 days ago #2

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 610
  • Thank you received: 720
For the first one:

float coord = floor(vpos.x / scan_width) * scan_width;
color *= coord % 2.0;
Last Edit: 2 months 2 days ago by Marty McFly.
The administrator has disabled public write access.

Sharp-edged, Strips-like Scanlines 2 months 2 days ago #3

Marty McFly wrote:
For the first one:

float coord = floor(vpos.x / scan_width) * scan_width;
color *= coord % 2.0;

I'm terribly sorry, But how do I Use the Code you provided me with ? Is there a shader out there that I missed and can use ?

Thank you~
Last Edit: 2 months 2 days ago by AladinZ.
The administrator has disabled public write access.

Sharp-edged, Strips-like Scanlines 2 months 2 days ago #4

  • Marty McFly
  • Marty McFly's Avatar
  • Offline
  • We've tried nothing and we're all out of ideas!
  • Posts: 610
  • Thank you received: 720
Ah sorry, I misread your post and thought you had already coded something but failed. Anyways, that should do.
Note that line_width 2 means 2 clear pixels, 2 black pixels, 2 clear pixels and so on. If you want 1 black pixel, 2 clear pixel or different spacings, that gets a lil bit more complicated.
Save this as anyfilename.fx:
#define line_width 1 //in pixel

#include "ReShade.fxh"

float4 LinePass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
	float4 color = tex2D(ReShade::BackBuffer, texcoord);
	float2 xycoord = floor(vpos.xy / line_width) * line_width;
        color.rgb *= xycoord.x % 2.0;
//for vertical stripes as well:
  //color.rgb *= xycoord.y % 2.0;


       return float4(color.xyz,1.0);
}

technique Lines
{
	pass
	{
		VertexShader = PostProcessVS;
		PixelShader = LinePass;
	}
}
Last Edit: 2 months 2 days ago by Marty McFly.
The administrator has disabled public write access.

Sharp-edged, Strips-like Scanlines 2 months 2 days ago #5

Marty McFly wrote:
Ah sorry, I misread your post and thought you had already coded something but failed. Anyways, that should do.
Note that line_width 2 means 2 clear pixels, 2 black pixels, 2 clear pixels and so on. If you want 1 black pixel, 2 clear pixel or different spacings, that gets a lil bit more complicated.
Save this as anyfilename.fx:
#define line_width 1 //in pixel

#include "ReShade.fxh"

float4 LinePass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
	float4 color = tex2D(ReShade::BackBuffer, texcoord);
	float2 xycoord = floor(vpos.xy / line_width) * line_width;
        color.rgb *= xycoord.x % 2.0;
//for vertical stripes as well:
  //color.rgb *= xycoord.y % 2.0;


       return float4(color.xyz,1.0);
}

technique Lines
{
	pass
	{
		VertexShader = PostProcessVS;
		PixelShader = LinePass;
	}
}


The Shader works flawlesly. However, I can't seem to get the lines to space out, even if I tinker with the numbers. I have even tried adding numbers to "line_width" with not avail. Please, do let me know what it is that I'm missing. Thank you~

P.S. Nevermind. I Figured I had to replace one of the "line_width" with a Value. Thank you so much.
PP.S. Now, If I want to space the lines so that the room between them isn't dependent on their Width, How Can go about that ? The thickness is having a reverse effect on Quality.

I really Appreciate your help.
Last Edit: 2 months 2 days ago by AladinZ.
The administrator has disabled public write access.

Sharp-edged, Strips-like Scanlines 1 month 6 days ago #6

So, I have been Experimenting with different Solutions, and by far, the ultimate Stripes-like Scanlines solution is to use a Crosshair shader that has been Kindly shared on this webpage: reshade.me/forum/shader-presentation/236...shair-overlay-shader

Result:



Scanlines were Edited outside Reshade. That is to say you have to either edit them yourself using a Photo Editing software and save the Image as "xhair_mask.png" (Without Quotation Marks) or Grab the Following Image and put it in "reshade-shaders\Textures" (open in a new tab or save to expose details):


I have only Tested the shader on a 1920x1080 Screen Resolution. Higher Screen Resolutions might require a larger Image as well as some tinkering within the Shader itself. If you experience a weird effect, change "Xhair Mode" to "Solid Color" and disable stroke.

Hopefully, I have Helped somebody out there.
Last Edit: 1 month 6 days ago by AladinZ.
The administrator has disabled public write access.