Author |
Message |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
 The unofficial BSNES pixel shader thread
Okay here's where all discussions on hardware based filters using shaders for BSNES are based. (whether they are technically based or not)
For those that don't know, I worked out a simple method to get shaders working under BSNES (any version). All it involves is this pack, and the enclosed patch..
To use shaders:
* Apply the patch
* Copy one shader file (shader.fx) to the same directory as BSNES.
Last edited by mudlord on Thu Jun 05, 2008 11:51 am, edited 5 times in total.
|
Mon Mar 24, 2008 12:43 pm |
|
 |
ShadowFX
Regular
Joined: Thu Jul 29, 2004 8:55 am Posts: 265 Location: The Netherlands
|
Sorry for interruping this thread but I would like to know what a shader exactly is/does, and what the difference is between the shader filters in bsnes and the filters used in, say ZSNES.
_________________ "Change is inevitable; progress is optional"
|
Mon Mar 24, 2008 1:02 pm |
|
 |
Verdauga Greeneyes
Regular
Joined: Tue Mar 07, 2006 10:32 am Posts: 347 Location: The Netherlands
|
The only difference between a shader and a normal filter is that a shaders are computed using your graphics card's shading units rather than your CPU. This means you need a graphics card that supports shader version 1.4 or higher to use them. The advantage is, of course, to offload the task of filtering to the GPU, leaving your CPU to deal with the task of emulating the SNES (and running your operating system  ).
Edit: changed 'version 2 or higher' to 'version 1.4 or higher'.
|
Mon Mar 24, 2008 1:38 pm |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
EDIT: Bet me to it, Verdauga Greeneyes
Just a note, you can do Shader Model 1.4 shaders 
|
Mon Mar 24, 2008 1:38 pm |
|
 |
Verdauga Greeneyes
Regular
Joined: Tue Mar 07, 2006 10:32 am Posts: 347 Location: The Netherlands
|
Aah, so that's the version I was looking for  I tried 1.0, 1.1, 1.2 and 1.3.. I guess it only matters for the simplest of shaders, though. Should I make my scanline shader use PS 1.4?
Edit: by the way, do you think it would be possible to add debugging messages to the implementation? Right now it just fails silently, which can be frustrating for more complex shaders.
|
Mon Mar 24, 2008 1:46 pm |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
Yeah, okay, I'll make a simple logger that logs to a logfile the execution.
If you can do shaders in DX8.1 shader style ASM, be my guest. Otherwise its best to use PS 2.0, if you rather use plain HLSL instead of ASM.
|
Mon Mar 24, 2008 1:54 pm |
|
 |
Verdauga Greeneyes
Regular
Joined: Tue Mar 07, 2006 10:32 am Posts: 347 Location: The Netherlands
|
I've done ARB shader programs before, so I should be able to figure it out - need some time to read the reference pages though.
|
Mon Mar 24, 2008 2:25 pm |
|
 |
Palin
Hazed
Joined: Tue Nov 08, 2005 12:40 pm Posts: 96
|
Has anyone done any side by side testing to see what, if any, difference this is making for performance/quality?
There's a little voice in my head that says "this sounds like a cool idea" but I'm a sucker for placebos.
Last edited by Palin on Mon Mar 24, 2008 6:47 pm, edited 2 times in total.
|
Mon Mar 24, 2008 6:28 pm |
|
 |
Verdauga Greeneyes
Regular
Joined: Tue Mar 07, 2006 10:32 am Posts: 347 Location: The Netherlands
|
In general mudlord's wrapper DLL seems to be slowing bsnes down by about 2fps for me. That said, as long as the graphics card can perform the filtering fast enough, that should be the extent of the speed hit; whereas enabling the more complex filters in bsnes slows it down significantly. Shaders also offer the advantage that they are distributed separately from bsnes, so licensing should be less of an issue. For instance, I should be able to whip up a 2xSaI shader pretty quickly. It's still worth talking about licensing issues, but it won't effect bsnes directly. To get back to your question, speed-wise it offers an advantage iff (if and only if) we can make fast shaders for the more complex filters; right now that makes it hard to test 
|
Mon Mar 24, 2008 6:45 pm |
|
 |
Palin
Hazed
Joined: Tue Nov 08, 2005 12:40 pm Posts: 96
|
Ok, after downloading this looks like a sort of proof of concept. I'm impressed. I do suffer about an 8% performance hit when I use them though.
Haha, I need to play all of my games like this.
|
Mon Mar 24, 2008 6:47 pm |
|
 |
ZH/Franky
|
Whoa, talk about simulating a "play while drunk" situation 
|
Mon Mar 24, 2008 6:58 pm |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
There's little I can do about that, unfortunately. That said, for the people interested in how it works in detail, it uses derived classes of IDirect3DDevice9 and IDirect3D9, with modified functions for Present(), CreateDevice(), SetFVF(), and SetRenderTarget().
I'm hoping to add a timer uniform to allow for realtime effects, such as wave cycling.....
|
Mon Mar 24, 2008 10:13 pm |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
I managed to make the DLL popup a small error message box when theres a error in shader syntax, pointing out the exact issue  . Which should help greatly in debugging....My plans though in making a logfile weren't so successful (the config file will be created but text wouldn't be written.  ) for some insanely odd occasion, when my config file class worked fine in a test EXE....
I'll upload the updated DLL when I can.
|
Tue Mar 25, 2008 1:33 pm |
|
 |
King Of Chaos
Trooper
Joined: Mon Feb 20, 2006 3:11 am Posts: 394 Location: Space
|
Kinda reminds me of the drunk/drugged Yoshi in SMW2.
_________________ Kega Fusion Supporter | bsnes Supporter | Regen Supporter
|
Tue Mar 25, 2008 4:47 pm |
|
 |
Gil_Hamilton
Buzzkill Gil
Joined: Wed Jan 12, 2005 7:14 pm Posts: 4249
|
I said it in the monster thread, and I'll say it here...
Touch Fuzzy, get dizzy!
|
Tue Mar 25, 2008 8:50 pm |
|
 |
byuu
|
Sorry, just wanted to get in on quoting the large JPEG.
While we're at it ...
There we go, much better.
|
Tue Mar 25, 2008 10:07 pm |
|
 |
creaothceann
Seen it all
Joined: Mon Jan 03, 2005 5:04 pm Posts: 2302 Location: Germany
|
A GoodSNES ROM name! 
_________________ vSNES | Delphi 10 BPLs bsnes launcher with recent files list
|
Tue Mar 25, 2008 10:30 pm |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
Update one up.
Includes a new wave shader with dynamic alteration.
Word of warning about this shader: It can mess with your head in games like SMW. Please don't blame me if you keep losing.
|
Tue Mar 25, 2008 11:18 pm |
|
 |
Verdauga Greeneyes
Regular
Joined: Tue Mar 07, 2006 10:32 am Posts: 347 Location: The Netherlands
|
Hehe, trippy; thanks for the update. How does the new Timer work? I looked at your wave shader, but all it seems to do is initialise it to 1. Does this assignment happen only once, at the start of execution, or is it a periodic thing? Does the Timer increase every frame, and does it use modulus or does it simply overflow from time to time?
Oh, and could you put a list of Uniforms in either the first post or a readme in the shaderpack? (perhaps that would be the best place to answer my questions about the timer, too)
|
Tue Mar 25, 2008 11:56 pm |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
Thats basically the gist. All it does is increment every time Present() is called, every 100 milliseconds.
Yup, its initialised at the start of execution.
Sure.
|
Wed Mar 26, 2008 12:11 am |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
Update 2 uploaded.
|
Wed Mar 26, 2008 12:24 am |
|
 |
Verdauga Greeneyes
Regular
Joined: Tue Mar 07, 2006 10:32 am Posts: 347 Location: The Netherlands
|
Many thanks for the readme, should help a bundle.
'This contains the results of the previous pass. In the first pass, it will contain the results of the last but one pass from the previous frame.'
So.. technically, we should be able to interpolate two subsequent frames? Perhaps a topic of future discussion.. (though I bet we'd need at least a framerate counter or some such to make anything useful with it)
One last request, because I forgot it wasn't in there (you posted the list before on bsnes' mother thread): could you add a uniform that holds the size of tex1? tex2's size is the screen resolution, I presume, which is already provided for.
|
Wed Mar 26, 2008 1:50 am |
|
 |
mudlord
has wat u liek
Joined: Tue Sep 11, 2007 2:54 pm Posts: 559 Location: Banland.
|
|
Wed Mar 26, 2008 4:23 am |
|
 |
Palin
Hazed
Joined: Tue Nov 08, 2005 12:40 pm Posts: 96
|
Just curious; someone mentioned a while back that HQ2X is too complicated to implement as a shader, is that true? Not that I expect you to tackle a monster like that, but it'd be really damn awesome. Especially awesome if it's combined with OpenGL renderer shader support in the near future.
|
Wed Mar 26, 2008 8:35 am |
|
 |
FirebrandX
Trooper
Joined: Tue Apr 19, 2005 11:08 pm Posts: 376 Location: DFW area, TX USA
|
I'd very much like to try a scanline shader if someone can make it.
BTW I notice no "sharpening" of the image when I use the sharpen shader. Perhaps it doesn't work with point filtering?
I did confirm the shaders do work on my system by testing the drunken wave one. That's a Vista 64-bit test done for ya 
|
Wed Mar 26, 2008 9:02 am |
|
|