Author Topic: Showing off GLSL Mame.  (Read 20368 times)

Luke_Nukem

  • Sr. Member
  • ****
  • Posts: 111
    • View Profile
    • GarageArcades
Showing off GLSL Mame.
« on: June 09, 2015, 03:33:12 PM »
Hi all. Been a while since I've been on here.
I have a couple of videos to show off;

GLSL Mame;
https://youtu.be/AJD8qB1nofU
Running under Linux. Front end is AttractMode of course. Runs very slick.

Booting from USB to AttractMode;
https://youtu.be/E6s3h3q8o5A
This is running a custom build of Arch, basically an ISO built around a very stripped down version of Arch, and booting straight into X with AttractMode running once loaded.
Takes around 35 seconds. Slightly less once installed to HDD.
The source to the build will be available on GitHub soon, and you require an Arch system to build it.  ;D

And a quick play test;
https://youtu.be/8furOI4b4DM
At the end, it takes about 2 seconds to shutdown  :D

The AM theme is one I built a while ago, called swapper. I plan to update it soon.
Twitter: @garagearcades Facebook: GarageArcades

raygun

  • Administrator
  • Sr. Member
  • *****
  • Posts: 355
    • View Profile
Re: Showing off GLSL Mame.
« Reply #1 on: June 10, 2015, 12:23:25 AM »
Hey long time no see Luke, welcome back!

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 703
    • View Profile
    • new projects
Re: Showing off GLSL Mame.
« Reply #2 on: June 10, 2015, 12:40:59 AM »
Finally! Someone with working GLSL shaders with scanlines.
I couldn't find any GLSL CRT-geom related post that aren't 1 or 2 years old :D

---

Can you describe your GLSL config? Or better - can you upload your shaders and mame.ini config?

---

I'm interested in CRT-Geom like shader effect (like Timoty Lothes scanline for GLSL)
The best I could achieve is CRT-Geom.vsh (http://www.mameau.com/mame-glsl-shaders-setup/)
Well... frankly, this is the best because... it is the only one that I've manage to work :)

You can chceck it out on video https://youtu.be/gFrgUmpRzSc

This a big step, but it is less than perfect. It is lacking something that is called "halation" or "phosphor glow" on various forums.
Without it the scanlines "gaps" are too dark and too much prominent.

---

Maybe Lottes-crt shader is my answer.
This is a Lottes HLSL conversion for GLSL (http://www.mameworld.info/ubbthreads/showflat.php?Cat=&Board=mamechat&Number=332320)

I've downloaded it, but it is not working in my setup (SDLmame 0.149) - failed to process shader

---

SDLmame is using shaders in format:

shader_name.vsh
shader_name_idx16_lut.fsh
shader_name_rgb32_dir.fsh
shader_name_rgb32_lut.fsh

Luke_Nukem

  • Sr. Member
  • ****
  • Posts: 111
    • View Profile
    • GarageArcades
Re: Showing off GLSL Mame.
« Reply #3 on: June 10, 2015, 03:14:50 AM »
Hey long time no see Luke, welcome back!

Thanks man. I've been pretty darn busy the last year. Quit work to become a full time student (Computer Science, Major in Software Dev).
And! Started a small biz, http://garagearcades.co.nz

Finally! Someone with working GLSL shaders with scanlines.
I couldn't find any GLSL CRT-geom related post that aren't 1 or 2 years old :D
**SNIP**

Here's what I've got so far. https://drive.google.com/file/d/0B9pq0zhpogv2SDNjdXF5VGNrclE/view?usp=sharing
I've included my mame.ini, just look at the glsl section to see how to enable it.

I'd love to dig into the Mame source and start building in menu functionality to change the shader parameters from within Mame. Maybe one day..
Twitter: @garagearcades Facebook: GarageArcades

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 703
    • View Profile
    • new projects
Re: Showing off GLSL Mame.
« Reply #4 on: June 10, 2015, 03:42:36 AM »
Thanks, but it is the same shader that I'm using. :(
And your settings are more or less the same as mine.

I'm attaching a screenshot how it could look with "halation" enabled - whatever it means.
But what it does is more important - it just "leaks" color of adjacent lines over the scanline dark lines.
Just like on CRT screen where every line "glows" and that blends the lines together nicely.

You can read more about this in this article - http://filthypants.blogspot.com/2012/07/customizing-cgwgs-crt-pixel-shader.html

---

That Lottes GLSL shader (link in prev. post) supposed to do that - judging from the screenshots in the thread (here - http://tinyurl.com/lottes-crt-GLSL).
But it is not working - and I don't have a clue how(if) this could be fixed.

---

If someone wants to play with that Lottes Shader I can upload it here - since you have to register in that other forum to download it.
« Last Edit: June 10, 2015, 03:48:38 AM by verion »

nitrogen_widget

  • Sr. Member
  • ****
  • Posts: 295
    • View Profile
Re: Showing off GLSL Mame.
« Reply #5 on: June 10, 2015, 09:51:26 AM »
Verion,

What video card do you have?
Which drivers for the card?

when I first tried GLSL on my setup it wouldn't work with the proprietary AMD drivers but worked with the opensource drivers.
Also, I found if your card doesn't support the proper shader model mame ignores the glsl settings.
Unless you have an AMD apu onboard graphics probably wont work.

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 703
    • View Profile
    • new projects
Re: Showing off GLSL Mame.
« Reply #6 on: June 10, 2015, 09:56:20 AM »
Intel HD Graphics 5000 with system provided drivers.
I'm on mac (OS X) - so probably no opensource drivers ;)
it's the last column - https://developer.apple.com/opengl/capabilities/
Almost all OpenGL functions are supported.

Code: [Select]
SDL/OpenGL defines: SDL_COMPILEDVERSION=1215 USE_OPENGL=1 USE_DISPATCH_GL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=2 __GNUC_PATCHLEVEL__=1 __VERSION__="4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)"
Compiler defines B: __amd64__=1 __x86_64__=1
Compiler defines C: _FORTIFY_SOURCE=2
SDL Device Driver     : Mac OS X display
SDL Monitor Dimensions: 1920 x 1200
Enter sdlwindow_init
Using SDL single-window OpenGL driver (SDL 1.2)
Leave sdlwindow_init
Loaded opengl shared library: /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib
OpenGL: Intel Inc.
OpenGL: Intel HD Graphics 5000 OpenGL Engine
OpenGL: 2.1 INTEL-10.6.20
OpenGL: forcing power-of-2 textures (creation, not copy)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: framebuffer object supported
OpenGL: GLSL supported
OpenGL: max texture size 16384 x 16384



But GLSL is working - with certain shaders (like the one that Luke_Nukem is using). But I want that halation/phosphor glow - and that particular shader doesn't provide it (I suppose).
« Last Edit: June 10, 2015, 10:00:28 AM by verion »

liquid8d

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
    • View Profile
Re: Showing off GLSL Mame.
« Reply #7 on: June 10, 2015, 10:30:57 AM »
So the CRT-Geom linked in http://filthypants.blogspot.com/2012/07/customizing-cgwgs-crt-pixel-shader.html is different from Lottes shader, right? I tried Lottes and that looked really nice but since the machine in my current arcade setup can't handle them, I haven't gotten around to really fine tuning it.

Did you try the CRT-Geom one and does that not do what you want with the halation, or is Lottes just better and you want to use that?

Also, who wants to get these converted over to shaders to be used directly in AM? I tried at one point and it was a bit too complex for me :)

Here is Lottes code:
https://www.shadertoy.com/view/XsjSzR#

And you can read about it here:
http://timothylottes.blogspot.com/2014/08/scanlines.html
« Last Edit: June 10, 2015, 10:38:34 AM by liquid8d »

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 703
    • View Profile
    • new projects
Re: Showing off GLSL Mame.
« Reply #8 on: June 10, 2015, 10:43:20 AM »
Quote
Did you try the CRT-Geom one and does that not do what you want with the halation

Exactly - CRT-Geom works and looks good, but I'm hoping for even better look with that "glow".

I don't know if Lotte would be better - I just can't see any other options.

-----

I've made a quick fake effect in photoshop.
On the left CRT-Geom how it is now, on the right with halation/glow.


The scanlines gets little less dark.

----

I can have similar effect with adding gaussian blur shader as next shader, but the effect is more, well... blurry, and that's not my goal.

============

RE: link to Lotte code

Some guy went a litte further and actually converted this to GLSL
I posted the link in my first post
Quote
This is a Lottes HLSL conversion for GLSL (http://www.mameworld.info/ubbthreads/showflat.php?Cat=&Board=mamechat&Number=332320)

The problem is - everybody in that thread were bursting with joy, but I can't get it to work :(
Well... Everything I did was - download the shader, put it in shader dir, and change mame.ini.
There is nothing more I can do - maybe except reading -verbose output.

Maybe I should upgrade SDLmame - since I have older version, that is using older (1.2) SDL libraries and there are newer to download (2.0).
But I have to upgrade my roms in a process - and you now how pleasant it is :)
But I doubt if it will help - because my SDLmame version was the current one when they were posting that Lottes GLSL shaders.
« Last Edit: June 10, 2015, 05:53:36 PM by verion »

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 703
    • View Profile
    • new projects
Re: Showing off GLSL Mame.
« Reply #9 on: June 10, 2015, 12:34:00 PM »
@Luke_Nukem

Seems like I'm slowly overtaking your post - sorry about that.
Maybe Omegaman could move my ramblings to separate thread - please.

nitrogen_widget

  • Sr. Member
  • ****
  • Posts: 295
    • View Profile
Re: Showing off GLSL Mame.
« Reply #10 on: June 10, 2015, 02:03:47 PM »
Intel HD Graphics 5000 with system provided drivers.
I'm on mac (OS X) - so probably no opensource drivers ;)
it's the last column - https://developer.apple.com/opengl/capabilities/
Almost all OpenGL functions are supported.

Code: [Select]
SDL/OpenGL defines: SDL_COMPILEDVERSION=1215 USE_OPENGL=1 USE_DISPATCH_GL=1
Compiler defines A: __GNUC__=4 __GNUC_MINOR__=2 __GNUC_PATCHLEVEL__=1 __VERSION__="4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)"
Compiler defines B: __amd64__=1 __x86_64__=1
Compiler defines C: _FORTIFY_SOURCE=2
SDL Device Driver     : Mac OS X display
SDL Monitor Dimensions: 1920 x 1200
Enter sdlwindow_init
Using SDL single-window OpenGL driver (SDL 1.2)
Leave sdlwindow_init
Loaded opengl shared library: /System/Library/Frameworks/OpenGL.framework/Libraries/libGL.dylib
OpenGL: Intel Inc.
OpenGL: Intel HD Graphics 5000 OpenGL Engine
OpenGL: 2.1 INTEL-10.6.20
OpenGL: forcing power-of-2 textures (creation, not copy)
OpenGL: vertex buffer supported
OpenGL: pixel buffers supported
OpenGL: framebuffer object supported
OpenGL: GLSL supported
OpenGL: max texture size 16384 x 16384



But GLSL is working - with certain shaders (like the one that Luke_Nukem is using). But I want that halation/phosphor glow - and that particular shader doesn't provide it (I suppose).

when I hear GLSL I think Linux. :)
your on-die graphics might not cut it.
Also, SDL 2.0 may be required so you may be onto something there.

I've only used sdl 2.0 mame with linux and GLSL.

Luke_Nukem

  • Sr. Member
  • ****
  • Posts: 111
    • View Profile
    • GarageArcades
Re: Showing off GLSL Mame.
« Reply #11 on: June 10, 2015, 05:11:50 PM »
@Luke_Nukem

Seems like I'm slowly overtaking your post - sorry about that.
Maybe Omegaman could move my ramblings to separate thread - please.

Na leave them all here.
Also, your GPU supports OpenGL 4.0, so it shouldn't have any problems.

I see what you mean by the effects now. Going to look into it. Just finished final exam and have a bit of spare time.
Twitter: @garagearcades Facebook: GarageArcades

verion

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 703
    • View Profile
    • new projects
Re: Showing off GLSL Mame.
« Reply #12 on: June 10, 2015, 05:23:06 PM »
Great!

You can emulate similar effect with enabling bilinear shader (the one that was in your shader folder).
Not exactly the same, because everything starts to look blurry (especially the fonts/scores).

glsl_shader_mame0         /Applications/MAME/SLDmame0149-64bit/shader/shader/glsl_bilinear
glsl_shader_mame1         /Applications/MAME/SLDmame0149-64bit/shader/CRT-geom

My photoshop fake was constructed with CTR-geom "pass" on 80% opacity and the same image with heavy blur put underneath.

I'm also attaching Lottes shader - maybe you can try it and let me know if it works on your system.

Luke_Nukem

  • Sr. Member
  • ****
  • Posts: 111
    • View Profile
    • GarageArcades
Re: Showing off GLSL Mame.
« Reply #13 on: June 10, 2015, 08:22:25 PM »
Try the two shaders attached. Mish-mash of others like Lottes.

The order you enable them in has a big effect on the picture. I'm still playing around with them to see what is going on.

edit: Added shadowmask to the CRT-geom shader. Seems okay.
Still working on pixel bleed. And mask size

Position of Mask multiplier has a profound effect.
« Last Edit: June 10, 2015, 08:58:12 PM by Luke_Nukem »
Twitter: @garagearcades Facebook: GarageArcades

Luke_Nukem

  • Sr. Member
  • ****
  • Posts: 111
    • View Profile
    • GarageArcades
Re: Showing off GLSL Mame.
« Reply #14 on: June 10, 2015, 09:45:31 PM »
About as good as I can get it without writing my own. (Which I sort of started).
Twitter: @garagearcades Facebook: GarageArcades