Is there a collection of GLSL shader in .vsh format anywhere, ive noticed that MAMEUIFX now can use GLSL shaders but they seem to be in .vsh file format
No. We use single, combined shader files while MAME uses essentially the same code but broken into separate vertex (vsh) and fragment (fsh) files. It’s possible to separate ours into those separate files, but it’s a hassle, particularly since our programatically converted GLSL shaders are hideous from a code-clarity standpoint. This also complicates the other necessary part of the process, which is converting the various uniforms (for things like input texture sizes, framecounters, etc.) from RetroArch’s nomenclature to that of MAME. In this case, it’s probably easier just to convert them by hand from Cg format, since Cg and GLSL aren’t wildly different in syntax, anyway.
So, tl;dr: no, it’s not super-difficult to convert them to the format, but it’s not something that’s automatic or that’s already been done.
[QUOTE=hunterk;21288]No. We use single, combined shader files while MAME uses essentially the same code but broken into separate vertex (vsh) and fragment (fsh) files. It’s possible to separate ours into those separate files, but it’s a hassle, particularly since our programatically converted GLSL shaders are hideous from a code-clarity standpoint. This also complicates the other necessary part of the process, which is converting the various uniforms (for things like input texture sizes, framecounters, etc.) from RetroArch’s nomenclature to that of MAME. In this case, it’s probably easier just to convert them by hand from Cg format, since Cg and GLSL aren’t wildly different in syntax, anyway.
So, tl;dr: no, it’s not super-difficult to convert them to the format, but it’s not something that’s automatic or that’s already been done.[/QUOTE]
Damn thats a shame, it was only like 3 shaders i wanted converted…
crt-easymode crt-geom (one with the curve and one without) crt-lottes
What is it that you need from mameuifx that isn’t in the libretro MAME cores?
The trouble with mame core is that there a fair few buttons that both RGUI and Mame use and they conflict with each other and the navigation of selecting a game as RA can only seem the rom file names and not actual Game names
You can change those mappings through both RGUI and MAME’s own GUI (I think it’s one of the shoulder buttons by default to bring up) to make them not conflict. And I haven’t tried it personally, but there’s a database function that lets you set titles for games that should show instead of the ROM name in RGUI. To use a database, add a database folder and make sure content_database_path = in your config points to it. Then you can get the MAME database file from here and save it as MAME.dat in the database folder. Make sure you have an info file for the MAME core, since that’s what tells RetroArch what .dat file to load for it.
I’m trying every now and then with new nightlies but it never works. Has anyone had it working?
There is a MAME.rdb in the database/rdb/ folder, is that different from the MAME.dat? (I tried to point the path to both, none worked)
[QUOTE=hunterk;21288]No. We use single, combined shader files while MAME uses essentially the same code but broken into separate vertex (vsh) and fragment (fsh) files. It’s possible to separate ours into those separate files, but it’s a hassle, particularly since our programatically converted GLSL shaders are hideous from a code-clarity standpoint. This also complicates the other necessary part of the process, which is converting the various uniforms (for things like input texture sizes, framecounters, etc.) from RetroArch’s nomenclature to that of MAME. In this case, it’s probably easier just to convert them by hand from Cg format, since Cg and GLSL aren’t wildly different in syntax, anyway.
So, tl;dr: no, it’s not super-difficult to convert them to the format, but it’s not something that’s automatic or that’s already been done.[/QUOTE]
I am also very interested in this “conversion”, however i have no clue how to do what you described here. I found this thread: http://libretro.com/forums/showthread.php?t=2623 where someone allready converted most of the shaders to GLSL, but I still dont know how to use them??? Because I dont know how I get those “vsh” and “fsh” files out of them? You or anyone who can do this, would do the MAME community a very big favor, if you could convert these shaders… mostly important are the “CRT” and “NTSC” stuff. What is needed, that this dream would come true? I mean, please I bag you, this would be really a step forward and reading your words, it doesnt sound like it is something very hard to do.
At least let me know what is needed to do this. Please consider that I am not the “pro” like you, i definetily need a better description how this can be done.
PS: Your Filthy Pants Blog is awesome … but i am really surprised and sad (a little), that nobody till today didnt convert any of the shaders for usage with official MAME.
Well MAME doesn’t really likes libretro… so why would we convert the shaders back for them to use? Anyway, the script can do most but it doesn’t support shader parameters, and I think it doesn’t copy the LUTs either.
I haven’t packaged GLSL shaders separately but you may be able to get the GLSL shaders from the android builds to get started.
[QUOTE=Radius;21469]Well MAME doesn’t really likes libretro… so why would we convert the shaders back for them to use? Anyway, the script can do most but it doesn’t support shader parameters, and I think it doesn’t copy the LUTs either.
I haven’t packaged GLSL shaders separately but you may be able to get the GLSL shaders from the android builds to get started.[/QUOTE]
Well, i can understand this, but the MAME devs are the devs and they have nothing to do with the community, or better said, their opinion doesnt represent the opinion of the community. I know that the devs are little stubborn bitches, i experienced them myself, especially MooglyGuy is insane in the brain. So if you would convert the shaders, then you wouldnt do this for them, you would do it for the community .
By script, you mean the cg2glsl script ? What would that mean if the LUTs arent copied? With shader parameters you mean the sliders in official MAME? I wouldnt care, because the Timothy Lotte shader also doesnt have any sliders, it is like it is. If you want to change some stuff, you need to alter the code, but I didnt have any problems with it, as long as I can use the shader.
I have those GLSL shaders from the android build allready, if you mean those from my link, but I still have the problem that I cant use them, as I dont know how to create those “vsh” and “fsh” files. Would that be so much of work, to convert 3-4 shaders into those “vsh” and “fsh” files???
Like I said, this would be a very nice step forward for the community, if that would happen.
thanks in advance, u-man
Glad you like my blog
There’s already a SDLMAME-compatible version of Lottes’ shader: http://www.mameworld.info/ubbthreads/showflat.php?Cat=&Board=mamechat&Number=331809
For crt-geom, the easiest course of action would be to take this old XML version: and copy/paste the stuff between “<vertex><![CDATA[” and “]]></vertex>” into a separate file and save it as crt-geom.vsh, then grab the stuff between “<fragment><![CDATA[” and “]]></fragment>” and save it as crt-geom.fsh. You’ll still have to change the ruby* uniforms to whatever SDLMAME uses, but the code itself shouldn’t require any more changes.
Converting crt-easymode would be a bit harder because you’d have to convert from Cg to GLSL in addition to separating the files out and changing the uniforms, and maister’s NTSC would be harder still because I don’t know how/if SDLMAME handles multipass shaders, particularly when things like floating-point framebuffers are involved. Again, starting from our cg2glsl-converted shaders is probably a bad idea because they’re essentially unreadable.
Your Blog brought me to Retroarch or good shaders in general.
To be honest, I was the one, who supported mamesick (creator of MAMEUIFX) to implement Lotte´s shader into MAMEUIFX. He did the coding and I did the permissions and beta-testings. In the next UIFX release, there will be also a new HLSL version included (done by Jezze), that has many bugfixes from official HLSL (better bloom with no offset, better defocus and better post.fx) and two new parameters like vignette and reflection.
is your linked shader this one: http://www.mameau.com/mame-glsl-shaders-setup/ because I allready have it. my aim is to collect some more opengl shaders for UIFX, just to give the users more options to choose from. Big thanks for the explanation, on how to create those vsh and fsh files. at least a starting point.
From what I understand, I can handle up to 10 shaders with OpenGL in mame now, so my guess is that this will not be the problem. If I understand you correctly, the allready converted shaders are unusable and I should better use the original Cg files… right?
At the end, I will show you, how far UIFX has come:
Lotte´s shader (OpenGL):
Jezze´s shader (new HLSL):
Yeah, that’s the same one I linked.
Another resource for you: https://github.com/hizzlekizzle/quark-shaders. These are shaders that Hyllian, aliaspider and I already ported from Cg to Higan’s somewhat odd flavor of GLSL with the files already separated into individual vertex and fragment shaders. Between these and the Cg versions, it shouldn’t be too hard to figure out what’s going on and port them over to MAME’s format.
I’ve never understood why MAMEdev went with HLSL in the first place. Of the 3 major shader languages, HLSL is the only one that’s unabashedly single-platform…
Oh, nice… I will look at those too. I converted your linked shader allready, however i dont know how it looks in original form. In my conversion, there are only curvature and scanlines and the shader looks like this:
It seems that this shader doesnt use a shadowmask .
The reason why they went HLSL is MooglyGuy, cause he created it. But since 2 years nothing is happening and the code is basically a mess. Due to the nature how it is composed, someone who wants to contribute needed to reverse engineer many stuff in c+ inside of the HLSL. Now they realized, that if something new should happen, only MooglyGuy can do, they decided
a.) to include SDL into the windows source (or official build) and b.) it is planned to include BGFX (whatever language this is), but they have to start from scratch.
As MooglyGuy is a really annoying personality, no one did anything usefull to HLSL over the years. He quitted now the further development of HLSL and maybe things will change now.
Jezze and myself even offered help, but the response was 20x fuck in a post with 7 sentences, so you maybe can imagine that our intentions to coorporate with the mame devs went to zero. At that point i found mamesick… he is the opposite of the mamedevs and a really nice person. Together we try to open new possibilities to the mame community with his GUI version of MAME and the main aim to LCDs. Yeah thats it, thats why i am in search to collect more shaders, for UIFX.
I am happy, that you all here, are way more friendly and a project can only be better through synergy… something that the mamedevs need to learn.
greets, u-man
It looks like a few things are missing, actually. The corners should be rounded (unless you turned that down/off) and the oversampling function should help with the moire pattern caused by the screen curvature. The shadowmask part is right at the end:
// dot-mask emulation:
// Output pixels are alternately tinted green and magenta.
vec3 dotMaskWeights = mix(
vec3(1.0, 0.7, 1.0),
vec3(0.7, 1.0, 0.7),
floor(mod(mod_factor, 2.0))
);
mul_res *= dotMaskWeights;
It just breaks the pixels into 3 parts and tints one part pink and part green.
As for MooglyGuy, I’ve never had any interaction with him, but I know some other folks who have had a similar experience as yours
The only stuff, I turned off, was the tilt (useless and wrong in vertical games) and the overscan (games got cropped). I dont have a moire pattern, maybe you didnt see the picture at full size? I guess, the oversampling works. I would like to have rounded corners, but I just dont know how I could get them working.
I attached you my files, maybe you see something that is wrong, what I dont see. I am really new into this and I wish I could do more.
As for the mamedevs, I am really done with them. Some of the guys are cool, but most of them, are not worth to mention. I really didnt understand the team, how they can keep such a toxic person into their forums. In any other forum, a person like MooglyGuy would be kicked and banned permanently.
cheers, u-man
PS EDIT: I got rounded corners, it was just a issue with wonderboy… dont know why, but in other games i have rounded corners
Ok, i got everything working, thanks to your nice tutorial here: http://filthypants.blogspot.de/2012/07/customizing-cgwgs-crt-pixel-shader.html
it looks like this now: http://i60.tinypic.com/2aaawrd.jpg
but the slotmask is still missing
I bag you, please help me with this…
That code looks right to me. Not sure what could be going wrong. Does anything happen if you comment out the ‘mul_res *= dotMaskWeights;’ line? If not, try changing it to: mul_res = mul(mul_res, dotMaskWeights);
You might also try breaking that dotmask stuff into its own pass.
The process is not invoked… i tried it and left out semicolon or changed the names to whatever sounds ridicilous… nothing happened, not even a error popped out. So i guess, the whole process is not invoked or recognized by MAME… there is something that must defined prior this lines i guess. I am really new to it and just dont know it better. How would I do that “own pass”? I am so close and would be really happy, if this puzzle could be solved .