Sharp-edged, Stripes-like Scanlines

  • AladinZ
  • Topic Author
More
7 years 6 months ago - 7 years 6 months ago #1 by AladinZ Sharp-edged, Stripes-like Scanlines was created by AladinZ
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: 7 years 6 months ago by AladinZ.

Please Log in or Create an account to join the conversation.

  • Marty McFly
More
7 years 6 months ago - 7 years 6 months ago #2 by Marty McFly Replied by Marty McFly on topic Sharp-edged, Strips-like Scanlines
For the first one:

float coord = floor(vpos.x / scan_width) * scan_width;
color *= coord % 2.0;
Last edit: 7 years 6 months ago by Marty McFly.

Please Log in or Create an account to join the conversation.

  • AladinZ
  • Topic Author
More
7 years 6 months ago - 7 years 6 months ago #3 by AladinZ Replied by AladinZ on topic Sharp-edged, Strips-like Scanlines

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: 7 years 6 months ago by AladinZ.

Please Log in or Create an account to join the conversation.

  • Marty McFly
More
7 years 6 months ago - 7 years 6 months ago #4 by Marty McFly Replied by Marty McFly on topic Sharp-edged, Strips-like Scanlines
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: 7 years 6 months ago by Marty McFly.

Please Log in or Create an account to join the conversation.

  • AladinZ
  • Topic Author
More
7 years 6 months ago - 7 years 6 months ago #5 by AladinZ Replied by AladinZ on topic Sharp-edged, Strips-like Scanlines

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: 7 years 6 months ago by AladinZ.

Please Log in or Create an account to join the conversation.

  • AladinZ
  • Topic Author
More
7 years 5 months ago - 7 years 5 months ago #6 by AladinZ Replied by AladinZ on topic Sharp-edged, Strips-like Scanlines
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: 7 years 5 months ago by AladinZ.

Please Log in or Create an account to join the conversation.

We use cookies
We use cookies on our website. Some of them are essential for the operation of the forum. You can decide for yourself whether you want to allow cookies or not. Please note that if you reject them, you may not be able to use all the functionalities of the site.