Thursday, March 14, 2013

Pixel Shaders for RetroArch 3D Cores

RetroArch got its first 3D core recently in the form of TyrQuake and it seems most of the existing pixel shaders either look unimpressive or don't work at all. Thankfully, shaders written for Pete's OpenGL plugin for PSX emulators are easy to port to RetroArch's XML format and they seem to generally work well enough.

A Lovely Bloom
One of the few conventional shaders that still functions as expected, this one looks really nice, and the screenshot doesn't really do it justice. It gives light sources a nice bloomy glow that softens things up a bit. 

This shader saturates colors somewhat and adds faint scanlines. It has been around for a long time (it was one of the original shaders available for bsnes when it first got pixel shader support) but the scanlines weren't visible on 2D sources, so I was surprised to see them here.

This shader uses the "natural vision" algorithm to do some color adjustment with added post-proc anti-aliasing.

This one darkens the image too much to be very useful in an already dark game like Quake but may be good for future cores that have brighter games.

Edge Detection
While not necessarily practical, this shader draws a line at each color intersection to produce a cool, old-timey effect.

One of the only scale/interpolation shaders that has any noticeable effect, this one is a bit blurry for my tastes but it evens out a lot of the jaggies.

I'm a sucker for scanlines and these normally crummy-looking scanline filters I made a while back actually look pretty nice here. (Note: I think I got the 3x and 4x mixed up; 3x should have fewer, larger scanlines than 4x)


Themaister Waterpaint Scanlines
While the effect isn't as pronounced as with 2D cores, this shader does some smoothing with scanlines and ends up with a sort of screen-door effect that nevertheless looks pretty good.

CPU Filters
Some of the bsnes-style CPU filters work, but not that well. The NTSC variants all perform their normal functions, but the the image is off-center and cuts some things off, as pictured. The scanline filters work pretty well, too, though they're sort of hard to see. Interpolation filters like HQ2X seem to have no visible effect, and SuperEagle crashed my game :/


sparklewind said...

Hi hunterk. I have noticed the same problem with 3D that you describe using the mednafen PSX core. One of the few shaders that have any meaningful effect on 3D is the NV+MSAA shader. I was actually looking for it before, so thanks for posting it. I took two screenshots using mednafen PSX:

I like what it's doing overall, but even here I can see that the 2D is affected more than the 3D. Basically, I would like the same smoothing effect shown in the screenshots on the 3D, or perhaps even stronger, but a weaker effect on the 2D. Do you know if that's possible? Can you shade 3D and 2D separately? Also, would it be possible to convert this shader to cg?

sparklewind said...

Oh, I forgot to mention that the shader is applied twice in the screenshots.

Hunter K. said...

hey man :)

I fiddled around with it some last night and, while I couldn't figure out any way to modulate 2D effects vs 3D, I did find that you can increase the overall brightness by modifying line 97:
c00 = 0.25*(u+d+r+l)
I changed the 0.25 to around 0.45 and it made Quake much more playable.

sparklewind said...

Oh, that's good to know. :) I think I managed to take out the whole Natural Vision part of this shader, in case you're interested:

sparklewind said...

AA Shader v2.0:

AA Shader v2.0 Bloom:

Hunter K. said...

Nice :D I like that 4xMSAA with NV quite a bit. The AA shader looks nice, too, but I didn't see any difference between it and the Bloom version. Am I missing something?

sparklewind said...

Strange. I can see a clear difference here.

Without bloom:

With bloom:

Maybe it doesn't like Quake? I haven't tested with that so I don't know.

Analytics Tracking Footer