Dolphin, the GameCube and Wii emulator - Forums

Full Version: [Shader] FullScreen Smoothing + Scanlines
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4
Also you can check and bookmark this page to keep up with releases easier: http://dl.dolphin-emu.org/builds/
You would want to just pay attention to the master branch (unless you want to try any of the others).

Right now the latest is 1385.

BossTanaka

Thanks guys,

now I got it to work with the latest dev version. Smile

On a side note. In the meantime I tried sweetFX since there are also some crt enhancements in there.

Couldn't get that to work either. Any hint for a good tutorial to get sweetFx to work with dolphin?

(Couldn't find a good one via google- there a tons of profiles for it though).
No. And we're going to need a lot more info. than that to figure out what you did wrong. For starters which build did you use?
6-23-2013
*Updated*
(in 1st post)

-Fixed issue where screen would freeze while pressing ESC when in Fullscreen Mode.
Previously, bringing up the Process Menu in Windows would correct it.

Edit:

False alarm, after a few tests, when it stalls, double clicking on it with the mouse fixes it for some reason. Maybe it just needed time to unload? I dunno Tongue
Reverted.

Seems like the screen doesn't refresh properly when escaping the game in fullscreen like that at random times. It does this in the shader I edited this from too but notsocommon with other shaders.

Edit2: was an emulator bug that now seems to be fixed in later revisions.

Rickioo

Hello!

Great job, the screens looks amazing! I was searching exactly for this!!

But, unfortunately, my resolution isn't 1920x1080, and I don't know what I need to change to do to make it work on my native resolution, 1440x900.

Can anyone help?

Sorry for my bad english Smile I'm from Brazil.

Thanks in advance!!
Thanks. You would have to change the values that are in the first post to get the effect that you want. What those lines mean are described in the shader file.
You might not be able to get the lines to a crisp thin like I did in the first post because of your lower resolution but I'm sure that you can find a suitable setting.

Also, when using Dolphin 4.0, you have to copy everything in this shader and paste it into an existing shader (make sure you back that shader up first) because just changing the file extension does not work.

Rickioo

Thanks shinra358, but It's still not working...

If I get it right, the scanlines should appear even with the different resolution. The changes is to make it better, accourding to the current resolution, correct?

I made the copy to another file using the notepad, but It's just not working...nothing at all.

I uploaded the modified file. I made some test changes, but haven't noticed any difference.

https://www.dropbox.com/s/jw7qp7xl6vwb3cl/nightvision2scanlines.glsl

Thanks again!
(09-29-2013, 11:46 PM)shinra358 Wrote: [ -> ]Also, when using Dolphin 4.0, you have to copy everything in this shader and paste it into an existing shader (make sure you back that shader up first) because just changing the file extension does not work.

Dolphin 4.0 shaders are in a different directory. So if you overwrote 4.0 things with previous installments, it's not in the same place. Place 'portable.txt' into main dolphin folder if you do not like your settings to be stored in 'my documents' (like myself Tongue)
Updated for newer dolphin versions as requested.

CastleBravo

I know shinra358 is banned, but does anyone know how I could go about getting his shader to work with the latest builds? It works fine on the latest master build, but I just downloaded 4.0-2826 (the latest build as of this post), and I'm getting compilation errors when trying to use this shader:

Code:
Fragment shader failed to compile with the following errors:
ERROR: 1:43: error(#198) Redefinition error: samp9
ERROR: 1:45: error(#198) Redefinition error: ocol0
ERROR: 1:46: error(#198) Redefinition error: uv0
ERROR: 1:48: error(#198) Redefinition error: resolution
ERROR: error(#273) 4 compilation errors.  No code generated

The full shader is as follows:

Code:
#version 150

#extension GL_ARB_shader_image_load_store : enable
#extension GL_ARB_shading_language_420pack : enable

#extension GL_ARB_sample_shading : enable
#define SAMPLER_BINDING(x) layout(binding = x)


#define float2 vec2
#define float3 vec3
#define float4 vec4
#define uint2 uvec2
#define uint3 uvec3
#define uint4 uvec4
#define int2 ivec2
#define int3 ivec3
#define int4 ivec4
#define frac fract
#define lerp mix


SAMPLER_BINDING(8) uniform sampler2D samp8;
SAMPLER_BINDING(9) uniform sampler2D samp9;
out float4 ocol0;
in float2 uv0;
uniform float4 resolution;
uniform uint time;
float4 Sample()
{
    return texture(samp9, uv0);
}
float4 SampleLocation(float2 location)
{
    return texture(samp9, location);
}
#define SampleOffset(offset) textureOffset(samp9, uv0, offset)
float4 SampleFontLocation(float2 location)
{
    return texture(samp8, location);
}
float2 GetResolution()
{
    return resolution.xy;
}
float2 GetInvResolution()
{
    return resolution.zw;
}
float2 GetCoordinates()
{
    return uv0;
}
uint GetTime()
{
    return time;
}
void SetOutput(float4 color)
{
    ocol0 = color;
}
#define GetOption(x) (option_##x)
#define OptionEnabled(x) (option_##x != 0)
//Fullscreen Smoothing + Scanlines Filter by ShinRa358 (Edited from nightvision2scanlines)

uniform sampler2D samp9;



out vec4 ocol0;

in vec2 uv0;



uniform vec4 resolution;



void main()

{

  //variables

  float4 c0 = texture(samp9, uv0).rgba;

  //FullScreen Smoothing

  float4 smoothing_total = float4(0, 0, 0, 0);

  float smoothing_size = 0; // <--- # = [Higher# = MORE SMOOTHING / Lower# = LESS SMOOTHING] ***0 = SMOOTHING OFF***

  smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, -smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( smoothing_size, -smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( smoothing_size, smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, 0)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( smoothing_size, 0)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( 0, -smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( 0, smoothing_size)*resolution.zw);

  smoothing_total *= 0.125;

  c0 = smoothing_total;

  // Horizontal Scanlines

  float vPos = uv0.y*resolution.y / 3; // <--- # to the left of the ';' for scanline thickness [Higher# = THICKER / Lower# = THINNER] ***DON'T GO BELOW 2*** | ***9999 = SCANLINES OFF***

  float line_intensity = (((vPos - floor(vPos)) * 9) - 4) / 50; // <--- # to the left of the ';' for scanline darkness [Higher# = LIGHTER / Lower# = DARKER] ***DON'T GO BELOW 25***

  // output

  ocol0 = float4(c0.r, c0.g, c0.b, 1.0) + line_intensity;

}

If I can't get this to work, does anyone know of any other shaders out there that work with the latest dev builds that support scanline emulation? That's the whole reason I've been using this one.

Thanks in advance!

I figured it out. Love it when I do that right after making a post!

Anyway, the clue was in the compilation errors that Dolphin was throwing: redefinition of the variables samp9, ocol0, uv0, and resolution. Commenting out the variable declarations in the shader itself fixes the errors and the shader appears to be working in the latest dev builds. See the code below for the working shader:

Code:
//Fullscreen Smoothing + Scanlines Filter by ShinRa358 (Edited from nightvision2scanlines)


// Fixes redefinition errors.
/*
uniform sampler2D samp9;
out vec4 ocol0;
in vec2 uv0;
uniform vec4 resolution;
*/



void main()

{

  //variables

  float4 c0 = texture(samp9, uv0).rgba;

  //FullScreen Smoothing

  float4 smoothing_total = float4(0, 0, 0, 0);

  float smoothing_size = 0; // <--- # = [Higher# = MORE SMOOTHING / Lower# = LESS SMOOTHING] ***0 = SMOOTHING OFF***

  smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, -smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( smoothing_size, -smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( smoothing_size, smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2(-smoothing_size, 0)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( smoothing_size, 0)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( 0, -smoothing_size)*resolution.zw);

  smoothing_total += texture(samp9, uv0 + float2( 0, smoothing_size)*resolution.zw);

  smoothing_total *= 0.125;

  c0 = smoothing_total;

  // Horizontal Scanlines

  float vPos = uv0.y*resolution.y / 3; // <--- # to the left of the ';' for scanline thickness [Higher# = THICKER / Lower# = THINNER] ***DON'T GO BELOW 2*** | ***9999 = SCANLINES OFF***

  float line_intensity = (((vPos - floor(vPos)) * 9) - 4) / 50; // <--- # to the left of the ';' for scanline darkness [Higher# = LIGHTER / Lower# = DARKER] ***DON'T GO BELOW 25***

  // output

  ocol0 = float4(c0.r, c0.g, c0.b, 1.0) + line_intensity;

}
Pages: 1 2 3 4