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. 

 HDRTV
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.

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

Cartoon
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.

Scale4xHQ
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.

Scanline3x
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)

Scanline4x

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 :/

7 comments:

  1. 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:

    http://i.imgur.com/DZwDtWp.jpg
    http://i.imgur.com/OUdvf6G.png

    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?

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

    ReplyDelete
  3. 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.

    ReplyDelete
  4. 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: http://www.mediafire.com/?71onvztscf4bwbm

    ReplyDelete
  5. AA Shader v2.0: http://www.mediafire.com/?2ur2k7r9z141017

    AA Shader v2.0 Bloom: http://www.mediafire.com/?xf19j1moiar3zig

    ReplyDelete
  6. @sparklewind
    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?

    ReplyDelete
  7. Strange. I can see a clear difference here.

    Without bloom: http://i.imgur.com/w0QLBKB.jpg

    With bloom: http://i.imgur.com/fXCFc7A.jpg

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

    ReplyDelete