..:: PCSX2 Forums ::..

Full Version: Custom Shaders for GSdx
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Code:
#define USE_BORDER        0 //[0 or 1] Border : Makes the screenedge black as a workaround for the bright edge that forcing some AA modes sometimes causes.

Code:
/*-----------------------------------------------------------.
  /                        Border settings                      /
  '-----------------------------------------------------------*/
#define border_width float2(1,20)     //[0 to 2048, 0 to 2048] (X,Y)-width of the border. Measured in pixels.
#define border_color float3(0, 0, 0)  //[0 to 255, 0 to 255, 0 to 255] What color the border should be. In integer RGB colors, meaning 0,0,0 is black and 255,255,255 is full white.

Code:
/*-----------------------------------------------------------.
/                          Border                            /
'-----------------------------------------------------------*/
#ifndef border_width
  #define border_width float2(1,0)
#endif
#ifndef border_color
  #define border_color float3(0, 0, 0)
#endif

float4 BorderPass( float4 colorInput, float2 tex )
{
float3 border_color_float = border_color / 255.0;

float2 border = (pixel * border_width); //Translate integer pixel width to floating point
float2 within_border = saturate((-tex * tex + tex) - (-border * border + border)); //becomes positive when inside the border and 0 when outside

colorInput.rgb = all(within_border) ?  colorInput.rgb : border_color_float ; //

return colorInput; //return the pixel

}

PCSX2 Team, can we have this shader integrated into GSDX? We need it to cover up flickering borders in games when using AA or Higher Resolutions that disconnect the widescreen bars from the edges of the screen. Using the Zoom feature distorts shaders and line quality of drawn graphics. So that feature is not ideal for fixing that issue.
(06-26-2014, 01:01 PM)Monochrome100 Wrote: [ -> ]Asmodean I have request for you could you please port your shaders to RetroArch common shaders when you will have time ? In that way many more emulators will be able benefit from them. https://github.com/libretro/common-shaders/issues/13 , https://github.com/libretro/common-shaders .

Uhh, probably. I haven't really tried RetroArch, though. I mean, It would take a few minutes to port them to cg, but quite a bit longer to test properly etc. I'll have to see, it's not super high on my prio list right now, but I'll consider it.

(06-28-2014, 09:23 PM)masterotaku Wrote: [ -> ]Thanks a lot, Asmodean. As always, my emulation-related happiness has increased Laugh.
By the way, did you reach a conclusion about your scaling test of GSdx? I'm still saving your modified plugin Tongue.

I haven't gotten a chance to work on that properly in some time I'm afraid. When I was doing some work on it, it was kind of a 1 step forward, 2 steps backwards deal ;p. I'm hoping I'll make some time for it again soon, though, and I'll hopefully make some progress.

(07-01-2014, 04:40 PM)shinra358 Wrote: [ -> ]
Code:
#define USE_BORDER        0 //[0 or 1] Border : Makes the screenedge black as a workaround for the bright edge that forcing some AA modes sometimes causes.

Code:
/*-----------------------------------------------------------.
  /                        Border settings                      /
  '-----------------------------------------------------------*/
#define border_width float2(1,20)     //[0 to 2048, 0 to 2048] (X,Y)-width of the border. Measured in pixels.
#define border_color float3(0, 0, 0)  //[0 to 255, 0 to 255, 0 to 255] What color the border should be. In integer RGB colors, meaning 0,0,0 is black and 255,255,255 is full white.

Code:
/*-----------------------------------------------------------.
/                          Border                            /
'-----------------------------------------------------------*/
#ifndef border_width
  #define border_width float2(1,0)
#endif
#ifndef border_color
  #define border_color float3(0, 0, 0)
#endif

float4 BorderPass( float4 colorInput, float2 tex )
{
float3 border_color_float = border_color / 255.0;

float2 border = (pixel * border_width); //Translate integer pixel width to floating point
float2 within_border = saturate((-tex * tex + tex) - (-border * border + border)); //becomes positive when inside the border and 0 when outside

colorInput.rgb = all(within_border) ?  colorInput.rgb : border_color_float ; //

return colorInput; //return the pixel

}

PCSX2 Team, can we have this shader integrated into GSDX? We need it to cover up flickering borders in games when using AA or Higher Resolutions that disconnect the widescreen bars from the edges of the screen. Using the Zoom feature distorts shaders and line quality of drawn graphics. So that feature is not ideal for fixing that issue.

I took a few minutes and added that to gsdx fx below. It should work fine, but let me know if there's a problem.

[attachment=51433]
Works Smile
When you get time, can you add it to the dolphinFX too?
(07-02-2014, 07:44 PM)Asmodean Wrote: [ -> ]I took a few minutes and added that to gsdx fx below. It should work fine, but let me know if there's a problem.


Interesting Idea to fix the AA issue on edges threw the shader. I might have to give this try, as AA is definitely better then FXAA but always had those edge issues.


Now if only a shader could fix the other issue AA can cause, though most the time it just the edge issue i notice

Side note I really interested in your scaler test you where doing. I hope one day you able to complete, it seem very promising on resolving the issue cause by the current scaler., but best I could do it offer to test with few games i have.
[Image: izr4p6p.jpg]

Works as advertised Smile
It would look nicer if it was blending black to actual image the more you get in (for maybe 5 pixels width or so) Tongue2
Can someone tell me if those newest GSDXFX shaders are working without bugs on Radeon 290X I am thinking about buying new GPU but I heard AMD compilers/GPUs have problems with some shaders like Retroarch shaders and Asmodeans shaders.
(07-03-2014, 07:50 PM)rama Wrote: [ -> ]Works as advertised Smile
It would look nicer if it was blending black to actual image the more you get in (for maybe 5 pixels width or so) Tongue2

I'll probably do that internally, I'd need to tweak the renderstates.

(07-03-2014, 07:54 PM)Monochrome100 Wrote: [ -> ]Can someone tell me if those newest GSDXFX shaders are working without bugs on Radeon 290X I am thinking about buying new GPU but I heard AMD compilers/GPUs have problems with some shaders like Retroarch shaders and Asmodeans shaders.

You're referring the CG & GLSL. GSdx FX is written in HLSL, and should be equally fine on both AMD, and NV compilers. Both compilers can handle them differently. Sometimes the NV compiler is a bit too lenient. While the AMD one can be more strict.

I've had fixing the AMD compiler issues for the old glsl stuff (PS1, etc), for a while. But, I've yet to get around to it.
Is the latest shader in the latest GIT? i only ask because if it is than its a good excuse to update. If not I'll stick with the version I've been using and just update the shader :-P
No, for now it's just here. I've not been on GH, so I wouldn't have commit privs etc. I'll get around to it. Plan on updating system soon enough as well
(07-02-2014, 08:13 PM)shinra358 Wrote: [ -> ]Works Smile
When you get time, can you add it to the dolphinFX too?
DolphinFX? What did i miss?