Author Topic: xBR filter  (Read 48903 times)

Offline Hyllian

  • Newbies
  • *
  • Posts: 22
  • Karma: +3/-0
Re: xBR filter
« Reply #30 on: March 26, 2012, 02:21:53 PM »
Lantus, could you test if these xBR winuae shader ports work on FBA?

Offline lantus

  • Expert
  • *****
  • Posts: 162
  • Karma: +32/-0
Re: xBR filter
« Reply #31 on: March 26, 2012, 03:34:19 PM »
ill check it out as soon as i get home tonight. i guess if it doesnt look right theres a problem with my shader code. We will see here shortly

edit: well that shader doesnt look right either so theres a code problem somewhere. thanks for your assistance Hyllian i will get it sorted out

thanks!
« Last Edit: March 26, 2012, 09:54:28 PM by lantus »

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: xBR filter
« Reply #32 on: March 28, 2012, 12:23:55 PM »
Is the image being scaled by a certain factor when using the xBR shader?

On PS3, the user can toggle between 1x/2x/3x/4x scaling of the image.

Offline Aquashark

  • Newbies
  • *
  • Posts: 48
  • Karma: +0/-0
Re: xBR filter
« Reply #33 on: April 06, 2012, 02:58:59 PM »
please add this filter, it's looking amazing

Offline Hyllian

  • Newbies
  • *
  • Posts: 22
  • Karma: +3/-0
Re: xBR filter
« Reply #34 on: April 06, 2012, 03:17:44 PM »
please add this filter, it's looking amazing
You already can use it with FBA through SSNES 0.9.5, which was released two days ago for PC.

Offline zebrastripes

  • Newbies
  • *
  • Posts: 15
  • Karma: +0/-0
Re: xBR filter
« Reply #35 on: April 07, 2012, 12:43:38 AM »
Hopefully it also gets implemented into FB Alpha 0.2.97.95. IMHO, this is the only graphic's filter you need as it has made everything else before it seem redundant.

Offline pmc2

  • Jr. Member
  • **
  • Posts: 69
  • Karma: +3/-0
Re: xBR filter
« Reply #36 on: April 07, 2012, 06:16:12 AM »
A filter that would merit in fba,  clearly.

Offline Hyllian

  • Newbies
  • *
  • Posts: 22
  • Karma: +3/-0
Re: xBR filter
« Reply #37 on: April 07, 2012, 08:06:53 AM »
Some screenshots of it running on SSNES 0.9.5 naked (without CRT).

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: xBR filter
« Reply #38 on: April 08, 2012, 08:35:10 AM »
Would be great to see FBA finally use that WIP SSNES renderer code that was alluded to in an earlier post. It should be about time PC emulators in general try to gradually phase out CPU filters as most PCs nowadays at least have a GPU capable of running vertex and fragment shaders with decent performance - and CPU filters take a heavy burden on the CPU which could (should IMHO) be better spent on the actual emulation.

This is the approach I have taken from day one with the PS3 emulator ports - without it, performance would have suffered immeasurably - I doubt I would have even been able to run something like VBA with acceptable performance running with a low-key CPU filter like 2xSaI. On top of that, you get shader stacking and other enviable features in the shader spec we have made, such as 'prev' textures (allowing for motion blurring effects), and 'frame count' (allowing for shaders with animations).

Someone is even working on a Braid-style rewind shader that will work very similar to the game Braid - with VCR-style graphical effects.



In short, it makes sense to go this route and you will get more visual bling in return as well. It's just backwards for it to be 2012 where we fork out a lot of money for a PC to have a fast GPU and a quad-core/whatever CPU, only to then still keep developing emulators that put all the strain on the CPU for filtering duties - instead of leveraging the increased parallelization options available to us (now that we have GPUs that can do the filtering stuff for us) instead and giving the CPU some breathing room at the same time.  I would champion it, and you guys have full permission from me and Maister to take whatever code you need from SSNES to make it happen - there are Direct3D and OpenGL versions of the renderer code in the same codebase - should contain all you need. GLSL and Cg is catered for - only HLSL code is needed right now in SSNES - but I will have to add that eventually as I'm targeting 360 too.

It should not be tied to the core because the libretro port for use with SSNES will just use SSNES' own rendering code instead. The interface/ portions of FBA should be a good place to abstract away the OpenGL/D3D SSNES rendering code for use with FBA Win32. I bypass all 'interface' code in FBA libretro/libsnes anyway - I'd like to keep being able to do that - the performance I'm reaching now with the PS3 port depends on it)
« Last Edit: April 08, 2012, 12:56:01 PM by Twinaphex »

Offline neocvera

  • Newbies
  • *
  • Posts: 39
  • Karma: +1/-0
Re: xBR filter
« Reply #39 on: April 09, 2012, 12:13:08 AM »
You already can use it with FBA through SSNES 0.9.5, which was released two days ago for PC.

I suppose this is true but I think the intent of the user was an "easy" solution. I just tried running a game with Phoenix GUI, etc and it wasn't a walk in the park and I've encountered numerous errors. I'm sure I am missing all the relevant shaders since I don't believe the "full" package includes shaders. So it hasn't been an easy experience getting a game to run on my pc with ssnes to test out the shaders. Granted, I simply looked at the forum, some starting tips, not a lot of time invested or asked for any help. I'm sure its a few tweaks here and there, a download or two I may be missing and voila, but it was not intuitive.

Edit: Played with it some more, found 6 xBR filters, downloaded one, tested it. Got it to work. Games run at a crawling 12-15 fps. I don't have a dedicated video card so I'm sure this is part of the problem now. Perhaps this will be revisted once I upgrade my hardware.  Tried multiple settings but at least I was able to see the filter in actions.
« Last Edit: April 09, 2012, 12:51:40 AM by neocvera »

Offline Hyllian

  • Newbies
  • *
  • Posts: 22
  • Karma: +3/-0
Re: xBR filter
« Reply #40 on: April 09, 2012, 02:10:10 AM »
You're right about ssnes configuration not being easy. I recommend these two tutorials about it:

http://filthypants.blogspot.com.br/2011/11/getting-started-with-ssnes.html
http://filthypants.blogspot.com.br/2011/11/advanced-ssnes-configuration-options.html

And, to run shaders at good speed you'll need good gpu at least.

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: xBR filter
« Reply #41 on: April 09, 2012, 08:22:44 PM »
I suppose this is true but I think the intent of the user was an "easy" solution. I just tried running a game with Phoenix GUI, etc and it wasn't a walk in the park and I've encountered numerous errors. I'm sure I am missing all the relevant shaders since I don't believe the "full" package includes shaders. So it hasn't been an easy experience getting a game to run on my pc with ssnes to test out the shaders. Granted, I simply looked at the forum, some starting tips, not a lot of time invested or asked for any help. I'm sure its a few tweaks here and there, a download or two I may be missing and voila, but it was not intuitive.

Edit: Played with it some more, found 6 xBR filters, downloaded one, tested it. Got it to work. Games run at a crawling 12-15 fps. I don't have a dedicated video card so I'm sure this is part of the problem now. Perhaps this will be revisted once I upgrade my hardware.  Tried multiple settings but at least I was able to see the filter in actions.

Yes, Maister is a UNIX coder who doesn't like to write pretty GUIs and stuff like that (in fact, hates it) - SSNES-Phoenix pretty much assumes of the user that he/she knows what it is they're doing. I agree with you that it could be much more intuitive. Unfortunately, this is going to require somebody getting involved that cares about an intuitive user interface on PC - and neither me or Maister are really interested in doing that.

This is where SSNES PS3 and 360 really come into play I guess - I supply all the shaders with each install of SSNES PS3 (they're just git cloned from a repo called common-shaders) and the user can very easily configure the two shaders along with scaling factor, aspect ratio, and other assorted options.

But I suppose not many people have jailbroken PS3s/360s on this forum, so I guess we still arrive at the problem that SSNES lacks a user-friendly GUI on PC.

With regards to how powerful your GPU has to be for these kinds of shaders - I don't consider the PS3's GPU to be powerful by any stretch of the imagination (in fact, it's weaker than 360's ATI chip, and it's a total pushover for modern-day PC GPUs), and it runs pretty much all of the shaders in my common-shaders repo effortlessly - even in FBO mode where you can run two shaders at a time - with frame buffer objects x4 the actual size of the game width/height. The RSX is a slightly modified Nvidia Geforce 7800-class GPU, so I'd say if your GPU is within the vicinity of that (or well over it), then you should be fine. If you have a 2009/2010 era Nvidia/Intel mobile GPU then you can pretty much forget it  - my Geforce 9200M GS in one of my laptops has really crappy performance with SSNES when running these shaders - I can 'nearly' get 60fps with 2xSaL and that's one of the least-demanding shaders out there. Its performance is a total joke compared to the PS3/360 (ran the RE5 tech demo at 4/5fps IIRC).
« Last Edit: April 09, 2012, 08:34:41 PM by Twinaphex »

Offline Twinaphex

  • Jr. Member
  • **
  • Posts: 81
  • Karma: +8/-0
Re: xBR filter
« Reply #42 on: April 15, 2012, 07:17:04 PM »
This got buried a few posts ago -

Lantus - there was nothing wrong with your shader code it seems - I got the exact same result after finally adding HLSL shader support to SSNES 360. Perhaps there's some kind of bug or quirk that creates the below par image quality that we get with 5xBR v3.7c on 360.

On the other hand, 4xBR-v3.5+CRT.cg looks pretty much on par with how it looks on PS3 - so I'd just chalk it up to the 5xBR versions having some issues with HLSL and just settle for the 4x versions on 360 - which seem to look fine (2xBR looked very much the same as 5xBR on 360 - as in - not very good).
« Last Edit: April 15, 2012, 07:28:01 PM by Twinaphex »

Offline msbhvn

  • New Member
  • *
  • Posts: 5
  • Karma: +0/-0
Re: xBR filter
« Reply #43 on: April 20, 2012, 11:19:02 PM »
This is a quick and dirty cut-and-paste job, but I've implemented xBR 2x, 3x and 4x in FBA 0.2.97.24. I am not really a programmer and I've probably done 101 things wrong, so feel free to fix the attached files.

I couldn't get diff to work properly, so I'm just uploading the modified files instead to be unzipped over the 0.2.97.24 source.

I copied the xBR source code from the Paintown project, so I'm not sure if it is the latest version of xBR or not. Hyllian can suggest changes to xBR.cpp, if it is not.

After all those disclaimers and my obvious ineptitude, 3xBR makes 3rd Strike look fantastic on my 1360x768 monitor. I hope someone gets a kick out of it. :wink:
« Last Edit: April 20, 2012, 11:42:56 PM by msbhvn »

Offline Hyllian

  • Newbies
  • *
  • Posts: 22
  • Karma: +3/-0
Re: xBR filter
« Reply #44 on: April 21, 2012, 02:27:55 AM »
Nice one! Great contribution!

Looking at the sources, I can say they're the latest CPU filter editions I used in Kega Fusion plugins.

There are three xBR flavors: squared, semi-rounded and rounded. In Kega plugins I named them as "a", "b" and "c", respectively. These flavors differ mainly in how fonts and huds are treated.

In your sources, you've used "b" flavor for 2xBR and 4xBR, and "a" flavor for 3xBR. They differ only by these lines (look at the lines 127, 342 and 544 in your sources to see the flavors you're using):

"a" flavor:
Code: [Select]
          if ((e<i)  && ( !eq(PF,PB) && !eq(PF,PC) || !eq(PH,PD) && !eq(PH,PG) || eq(PE,PI) && (!eq(PF,F4) && !eq(PF,I4) || !eq(PH,H5) && !eq(PH,I5)) || eq(PE,PG) || eq(PE,PC)) )\
"b" flavor:
Code: [Select]
          if ((e<i)  && ( !eq(PF,PB) && !eq(PH,PD) || eq(PE,PI) && (!eq(PF,I4) && !eq(PH,I5)) || eq(PE,PG) || eq(PE,PC)) )\
"c" flavor:
Code: [Select]
          if (e<i)\

I can't say which of them is the best. It depends on taste. You probably like more the "a" version. You could try adding all flavors to each, making a total of 9 xBR filter options.
« Last Edit: April 21, 2012, 02:31:51 AM by Hyllian »