What's new

Demul v0582 - Custom shader effect

GinForBreakfast

New member
First of all, thanks for the continued work on this emulator. Great job and I'm looking forward to future releases.

I'd like to add my own "scanlines" shader to Demul v0582. I've googled a bit and saw someone placing a ".slf" and ".slv" in a "shaders" sub-directory in the Demul installation folder.

I tried the following files (found online):

test.slv:

uniform vec4 OGL2Param;
uniform vec4 OGL2Size;

void main()
{
float x = (OGL2Size.x/2048.0)*OGL2Param.x;
float y = (OGL2Size.y/1024.0)*OGL2Param.y;

gl_Position = ftransform();
gl_TexCoord[0] = gl_MultiTexCoord0;
gl_TexCoord[1].xy = gl_TexCoord[0].xy + vec2( x, 0.0 );
}

test.slf:

uniform sampler2D OGL2Texture;

void main()
{
vec4 rgb = texture2D(OGL2Texture, gl_TexCoord[0].xy);

// if x is even => smooth with next pixel
if (fract(gl_FragCoord.x*0.5)>0.5)
rgb = ( rgb + texture2D(OGL2Texture,gl_TexCoord[1].xy) )*0.5;

// Test on 2 lines
// float test = fract(gl_FragCoord.y/2);
// if (test>0.5) gl_FragColor = rgb;
// else gl_FragColor = rgb*0.5;

// Test on 3 lines
// float test = fract(gl_FragCoord.y/3);
// if (test>0.666) gl_FragColor = rgb;
// else if(test>0.333) gl_FragColor = rgb*0.75;
// else gl_FragColor = rgb*0.5;

// Test on 4 lines
float test = fract(gl_FragCoord.y/4);
if (test>0.75) gl_FragColor = rgb;
else if (test>0.5) gl_FragColor = rgb*0.75;
else if (test>0.25) gl_FragColor = rgb*0.5;
else gl_FragColor = rgb*0.25;

}

But I still can't select this as a shader in the "Shader effects" section of the "Demul Direct3D11 Graphics Configuration"? Any help would be much appreciated. Thanks.
 

Top