Thread Rating:
  • 10 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom Shaders for GSdx
(12-18-2013, 01:25 AM)Asmodean Wrote: (For the small few who care) I did indeed say I would update the other two, with the improvements implemented into the Dolphin Version. I've been doing some work on PCSX2's shaders.

It takes so long because; A: I can only work on it when I've got the time, and B: It takes quite a while longer to do things with so many constraints. About 75% of the time I spend when writing shaders for emus, is trying to find ways around problems getting effects to output as intended. I don't mean PCSX2 specifically here, I mean emulation in general.

People generally aren't all that interested in emu post processing. This is typically part of the reasoning why there aren't any real post processing frameworks done for console emulation. Hence you get the same generic scaling filters you see for console emus with any post processing support, because trying to do more than this is quite the pain.

I'll have to maybe try talk with KrossX or rama, If I do up a patch for using the vertex shader externally. I've done my best to keep everything done in the pixel shader, so I wouldn't have to be doing custom builds for my shaders.

There are also some scaling issues that prevent me from doing effects based on the input res of a game. Such as some scaling filter types, and scanlines that won't shift about the place when altering the IR.

edit: forgot to mention I've not been on my own system for about 2 weeks also.

Disclaimer: this ended up a bit of a rant, but this is not complaining, simply an attempt at an explanation ; )

I didnt know PCSX2FX worked with GSDX software for epsxe with 4x it look just as good as petes opengl2 Minus the wierd lines in pre render backgrounds.

Sponsored links

I'm having issues, basically PCSX2 won't load any shaders of any kind, I check the program log and there's no sign of even attempting to load them.

I'm trying to load PCSX2Fx, here's what I did/what happens:

• Extracted both shader.fx and PCSX2Fx_Settings.txt to the same directory as my pcsx2-r5350.exe
• Run FFX (or any game, makes no odds)

No difference seen, so I check the log and there's nothing there. I pressed PgUp and nothing happens.

Plugins opened successfully.
(UpdateVSyncRate) Mode Changed to NTSC.
(UpdateVSyncRate) FPS Limit Changed : 59.94 fps
(SYSTEM.CNF) Detected PS2 Disc = cdrom0:\SCES_504.90;1
(SYSTEM.CNF) Software version = 1.00
(SYSTEM.CNF) Disc region type = PAL
ELF (cdrom0:\SCES_504.90;1) Game CRC = 0xA39517AB, EntryPoint = 0x00100008
(SYSTEM.CNF) Detected PS2 Disc = cdrom0:\SCES_504.90;1
(SYSTEM.CNF) Software version = 1.00
(SYSTEM.CNF) Disc region type = PAL
(GameDB) Enabled Gamefix: IpuWaitHack
Cheats found!
comment: Final Fantasy X (PAL-E) [SCES-50490] 16:9 Widescreen Hack, Render Fix & Progressive Scan
Cheats Loaded: 7
EE/iR5900-32 Recompiler Reset
(UpdateVSyncRate) Mode Changed to PAL.
(UpdateVSyncRate) FPS Limit Changed : 50.00 fps

The last few entries in the program log, this after I've pressed PgUp. Not sure what I'm doing wrong :/

PCSX v1.0.0
GSDX v0.1.16 SSE4 r5350

GSDX set to DX11.

Oop, since checking my GSDX version I noticed that I had it set to SSE2, I dunno if that makes a huge difference, but I set it to SSE4, and now when pressing PgUp I get
GSdx: fxaa is now disabled.
GSdx: fxaa is now enabled.
After two presses. When looking in-game there is no visible difference though, no sign that FXAA is turning on/off, nor of any other shader-ish things.

It looks great all the work you've done on this and other emu shaders, really hoping to be able to play using it, so thanks for any help anyone can give!

EDIT: Working, needed to update GSDX, derr.
Yes. IIRC, the GSDX bundled with PCSX2 1.0.0 doesn't support external shaders.
use SVN builds
I'm uploading the current version of the FX suite, for testing & feedback.

All effects have been rewritten, and revised. Plus newly implemented additions & improvements.

Current effects included:
  • Bilinear FS Filtering
  • Bicubic FS Filtering
  • Gaussian FS Filtering
  • High Quality Blended Bloom
  • Per-Channel Gamma Correction
  • Scene Tone Mapping
  • RGB Colour Correction
  • S-Curve Contrast Enhancement
  • Texture Sharpening
  • Pixel Vibrance
  • Post-Complement Colour Grading
  • Cel Shading
  • Scanline Emulation
  • Vignette
  • Subpixel Dithering

Options & settings are inside shader.fx, instead of their own separate file, for now. Until I'm finished testing.

I'll update the PCSX2Fx OP, with the file, description, screens etc, when I feel I've gotten enough testing and feedback from this.

Edit: 01/01/14 Updated archive above again, highlight notes below;
  • FXAA: slightly improved the quality 4 preset, & pre-luminance calculations.
  • FXAA: removed the debug option, as it should no longer be needed, as the FXAA is completed. It was also interfering with the gamma correction, when enabled.
  • Gamma Correction: Implemented a new gamma correction curve to replace the pow function previously used, which I think yields nicer, more accurate results.
  • Bloom: some small improvements to the bloom blending output.
  • Colour Correction: Also implemented a new curve for the pre tone mapping colour correction.
  • Tonemapping: Improved some colour conversion operations.
  • Tonemapping: Added RGB colour curve options, for Red, Green, and Blue respectively.
  • Tonemapping: Added Filmic Tonemapping as a tonemap type to choose. The two types are now - Natural(default), and Filmic(cinematic style)
  • Contrast: Improved contrast curve type 1.
  • Other general coding cleanup, and improvements

Edit: Re uploaded the archive. Fixed a ninja bug in the texture sharpening, updated the filmic optional tonemapping, and mellowed down the default settings a bit, to make the initial setup a bit more neutral.

03/01/14 - Updated archive. Highlight notes below;
-Filtering: Updated the bicubic & gaussian texture filtering effects a bit.
-Filtering: Added Bilinear filtering to the list of filtering options.
-Bicubic Filtering: Added a cubic interpolation type to the interpolation options. Options are now (lightest, to strongest): CatMullRom, Bell, BSpline, Triangular, Cubic.
-Sharpening: Updated the texture sharpening, and added a new bicubic based sharpening type for testing.
-Colour Grading: changed the RGB grading options' values from float3(r,g,b) to individual options for red, green, blue respectively. A bit more user friendly.
-Updated some effect options & descriptions.

#EDIT:updated to latest version (16-Jan-2014)

.zip (Size: 14,7 KB / Downloads: 8.940)
Scanlines are better. Especially when you've figured out how to make them look the exact same no matter the resolution. However, there are a couple of dark lines per few scanlines (clumps).
Model: Clevo P570WM Laptop
GPU: GeForce GTX 980M ~8GB GDDR5
CPU: Intel Core i7-4960X CPU +4.2GHz (12 CPUs)
Memory: 32GB Corsair Vengeance DDR3L 1600MHz, 4x8gb
OS: Microsoft Windows 7 Ultimate
Please read option descriptions. if you're using a low internal res (IR) (< 3x or so) try setting ScanlineScale to 1.00. This is a work around for the way GSdx handles framebuffer scaling etc. Post processing is handled after scaling is done, so it affects any post effects relying on the input res (scan lines).

I would also appreciate it, if you guys can include the GSdx settings you're using, when submitting feedback please. Thanks.
I did read. I'm using the scanlines option 3. No matter what I change the scanlinescale to, every 4th scanline is darker than the rest. This is in window mode and in fullscreen. My fullscreen rez is 1080p. The other scanline modes are spaced fine when the screen is at screen resolution. Scanlines 3 however, isn't.

PCSX2FX Scanlines:


Edit: On another note, the gaussian effect is perfect at like 1.00 filter amount. Good job. I'm gonna be using that Wink
You should make the gaussian effect for ppsspp and epsxe.

If you can somehow get that gaussian effect on just the textures on epsxe, that'll do wonders for the pixelated text there without blurring the whole scene.

Lastly, for all the effects, we need some kind of option that says "if res > 1x, then the value is THIS; if not, then the value is THIS. That way, when we're using the go to software mode on video hack, it won't be super blurred or super fxaa'd because we'd have that covered.

//-[GAUSSIAN OPTIONS]-------||
#define FilterAmount 1.0 //[0.00 to 1.00] Filtering Strength of the effect.
#define FilterAmountNative 0.5 //[0.00 to 1.00] Filtering Strength of the effect in low resolution.
#define GaussianSpread 1.00 //[0.50 to 4.00] The spread & offset levels of the filter.
#define GaussianSpreadNative 0.50 //[0.50 to 4.00] The spread & offset levels of the filter in low resolution.

BTW, is Gaussian blur the same as Bilinear Interpolation?
Model: Clevo P570WM Laptop
GPU: GeForce GTX 980M ~8GB GDDR5
CPU: Intel Core i7-4960X CPU +4.2GHz (12 CPUs)
Memory: 32GB Corsair Vengeance DDR3L 1600MHz, 4x8gb
OS: Microsoft Windows 7 Ultimate
I wonder if it wouldn't be far easier to do the scanlines as an overlay outside of GSdx.
Maybe even in the GS window in PCSX2.

Some effects appear to fail in low resolution games like Mega Man X (only uses 240p in progressive scan).
This is just BLENDED_BLOOM enabled but others have this as well. I didn't see this problem in a regular PS2 game.

[Image: P8ohHQB.jpg] [Image: DXGPrCX.jpg]
Ah, GSdx's "internal shaders" (activated by F7) aren't affected by scaling!
float4 ps_crt(PS_INPUT input, int i)
    float4 mask[4] =
        float4(1, 0, 0, 0),
        float4(0, 1, 0, 0),
        float4(0, 0, 1, 0),
        float4(1, 1, 1, 0)
    return sample_c(input.t) * saturate(mask[i] + 0.5f);

Committed a simple completely even scanline effect Smile
(The screenshot must be viewed unscaled or else the lines will look uneven.)
[Image: JCdZBZW.png]

Users browsing this thread: 1 Guest(s)