Scanlines in Libretro AdvMAME and FBA
-
@caver01 said in Scanlines in Libretro AdvMAME and FBA:
I want EVERY emulator to be a libretro core. I love the CRT effect.
Ok, this is sounds pretty exciting. I'm really looking forward to trying it.
Do you run a specific resolution too by chance?
-
@Riverstorm Yeah, and that probably makes a lot of difference. In order to successfully display scanlines that look good, you need to run a resolution higher than the games you play. I run a 1280x1024 19-inch display. That's enough magnification to allow the shaders to do their thing. Folks running HDTVs will have me beat at 1080, but I like not worrying about widescreen aspect ratio. In any case, this is a magnification that easily accommodates nice simulated rgb pixel triads.
It's possible to see some moire patterns with the curvature turned on, but it's rare at this resolution. The problems with the curvature are more pronounced when I run a vertical game rotated to fit into a horizontally-oriented display. In other words, a game like 1941 which has side-by-side controls needs to be played in landscape position on my cabinet. That means I am running in "pillar" mode (like letterbox, but on the sides) with black borders on the left and right. This effectively cuts down my resolution to 768x1024, and the resulting shader scanlines (which conveniently orient themselves vertically like they should) end up creating a lot of moire patterns--the curvature artifacts really show at this resolution.
So, curvature isn't for everyone, but if you have a high enough resolution like many do on their TVs, it can be pretty fun to turn this on.
I don't run any overlay to simulate an old TV bezel--just black for me.
-
I should add that I usually disable the curvature on games setup like 1941 using a per-rom .cfg file. This is also where some folks get really specific about their aspect ratio index. By using aspect_ratio_index = "22", you can specify a custom viewport width, height, and where it starts in the x and y coordinates. It seems like a lot of work, but if you do this, especially on lower resolution displays, you can effectively generate your video at exact integers of magnification from the original game and when you apply scanlines, you won't see any weird visual effects where one line seems thicker than the next.
Configs like these have to be done per-ROM I imagine because each title might have a different original resolution. You end up with some black borders, but it's a good compromise to get better looking CRT effects. For me, it wasn't worth it since my resolution is high enough (some may disagree) but also because I am running the curvature shader and that messes with perfect integer magnification anyway.
Here's my shader configs inside /opt/retropie/configs/mame-libretro/:
video_shader = /opt/retropie/emulators/retroarch/shader/crt-pi.glslp
video_shader_enable = true -
@caver01 said in Scanlines in Libretro AdvMAME and FBA:
Here's my shader configs inside /opt/retropie/configs/mame-libretro/:
video_shader = /opt/retropie/emulators/retroarch/shader/crt-pi.glslp
video_shader_enable = truethis is what i use also. looks great. i believe by default the curvature is not turned on, but the scanlines etc are. there is a slight issue with vertical games and this shader - the colour mask is not properly orientated so it does some corruption. you can follow the progress of that issue/get an alternative here: http://libretro.com/forums/showthread.php?t=4937
here's an example of the shader in action (won't look right apart from in full screen)
-
@dankcushions Thanks for posting that link! I am absolutely blown away by the work being done here to to create a realistic shader that doesn't sacrifice performance. The attention to detail regarding rotated images for vertical game is especially nice.
It looks like some work is ongoing which is great to read. I love seeing that I can make some tweaks to get rotated vertical games looking better. For many of them, I can simply use controls at the sides of my cabinet (4-player cocktail) and not rotate anything. These obviously look perfect, but occasionally, I need to rotate the image as described above. I expect most folks are in that situation, so it's great to see such attention to details.
It's maybe a topic for another thread, but have you seen any libretro shaders that add bloom effects to vector games? If we could get MAME2003 to play Asteroids and have it come close to the old AAE look, well, I might be done building a retro-arcade! (ok, it will never be 'done', but my wife would feel better if I stopped tinkering with it!).
-
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
@caver01 said in Scanlines in Libretro AdvMAME and FBA:
Here's my shader configs inside /opt/retropie/configs/mame-libretro/:
video_shader = /opt/retropie/emulators/retroarch/shader/crt-pi.glslp
video_shader_enable = truethis is what i use also. looks great. i believe by default the curvature is not turned on, but the scanlines etc are. there is a slight issue with vertical games and this shader - the colour mask is not properly orientated so it does some corruption. you can follow the progress of that issue/get an alternative here: http://libretro.com/forums/showthread.php?t=4937
here's an example of the shader in action (won't look right apart from in full screen)
Can this be used for Advmame as well? It looks far better than the built in scanlines by the looks of it.
-
@caver01 said in Scanlines in Libretro AdvMAME and FBA:
I should add that I usually disable the curvature on games setup like 1941 using a per-rom .cfg file. This is also where some folks get really specific about their aspect ratio index. By using aspect_ratio_index = "22", you can specify a custom viewport width, height, and where it starts in the x and y coordinates.
The scanlines look great! I downloaded the tool but it seems to update all retroarch.cfg files in one sweep which is ok. I didn't see individual emulator updates. It does add these lines to the retroarch.cfg with the CRT option.
video_shader = /opt/retropie/emulators/retroarch/shader/crt-pi.glslp video_shader_enable = true
Smoothing is off by default (Configuration Editor) which I think Floob said looks a bit better in his opinion but you could try it on too as I suppose it's subjective.
I had trouble finding Floob's tool but here's a link:
Floob's Shader ToolOr from command line. The current version is "v1.0" used to replace {release-number}.
wget https://github.com/biscuits99/rp-video-manager/releases/download/{release-number}/rp-video-manager.zip unzip -o rp-video-manager.zip rm rp-video-manager.zip cd /home/pi/rp-video-manager chmod 755 videomanager.sh ./videomanager.sh
@caver01
Could you explain or link to the aspect_ratio_index = "22"? Also I was curious how you do this on a per ROM basis with .cfg, if I am saying that correctly?@dankcushions
Yeah curvature is turned off by default.@Finhead
I agree these are much nicer then the 2xhorizontal in AdvMAME I had set.Dang, I really like the look of it. Caver I might be a convert yet to the MAME Libretro core. I am just being lazy as I usually use the built-in DAT and create a non-merged set then hand pick the version of the games which takes some time but I think these scanlines are worth it! :)
-
@Finhead said in Scanlines in Libretro AdvMAME and FBA:
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
@caver01 said in Scanlines in Libretro AdvMAME and FBA:
Here's my shader configs inside /opt/retropie/configs/mame-libretro/:
video_shader = /opt/retropie/emulators/retroarch/shader/crt-pi.glslp
video_shader_enable = truethis is what i use also. looks great. i believe by default the curvature is not turned on, but the scanlines etc are. there is a slight issue with vertical games and this shader - the colour mask is not properly orientated so it does some corruption. you can follow the progress of that issue/get an alternative here: http://libretro.com/forums/showthread.php?t=4937
here's an example of the shader in action (won't look right apart from in full screen)
Can this be used for Advmame as well? It looks far better than the built in scanlines by the looks of it.
it can't. libretro only i'm afraid.
-
@caver01 said in Scanlines in Libretro AdvMAME and FBA:
@dankcushions Thanks for posting that link! I am absolutely blown away by the work being done here to to create a realistic shader that doesn't sacrifice performance. The attention to detail regarding rotated images for vertical game is especially nice.
It looks like some work is ongoing which is great to read. I love seeing that I can make some tweaks to get rotated vertical games looking better. For many of them, I can simply use controls at the sides of my cabinet (4-player cocktail) and not rotate anything. These obviously look perfect, but occasionally, I need to rotate the image as described above. I expect most folks are in that situation, so it's great to see such attention to details.
It's maybe a topic for another thread, but have you seen any libretro shaders that add bloom effects to vector games? If we could get MAME2003 to play Asteroids and have it come close to the old AAE look, well, I might be done building a retro-arcade! (ok, it will never be 'done', but my wife would feel better if I stopped tinkering with it!).
:) all i could find is this, which looks like a no: http://libretro.com/forums/showthread.php?t=3815
there are a bunch of vector settings (flicker, intensity, etc) that are available on mame2003, but they need to be exposed to the front-end as a libretro core option. i might try that soon! it also needs to use the full screen resolution, as right now it's stuck at 640x480 default, i believe.
-
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
it can't. libretro only i'm afraid.
Well shoot. I am really impressed. The scanlines in FBA are really sharp. I will probably convert to the MAME Libretro core vs. MAME4ALL but it will take some time.
I have a "portable" setup that I use to hookup to TV's at friends and family. When it's a case like do you guys leave the default resolution or change on the fly? I noticed on certain resolutions in FBA it would stretch to fill the screen but if I left it blank it seems the correct proportions but of course had black around the borders usually left and right sides.
-
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
there are a bunch of vector settings (flicker, intensity, etc) that are available on mame2003, but they need to be exposed to the front-end as a libretro core option. i might try that soon!
That would be the cat's meow! I can't help to think of Omega Race with a nice bloom effect. It was a great game! ;)
-
@Riverstorm said in Scanlines in Libretro AdvMAME and FBA:
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
it can't. libretro only i'm afraid.
Well shoot. I am really impressed. The scanlines in FBA are really sharp. I will probably convert to the MAME Libretro core vs. MAME4ALL but it will take some time.
they will work on lr-imame4all also, which uses the same romset as mame4all-pi.
I have a "portable" setup that I use to hookup to TV's at friends and family. When it's a case like do you guys leave the default resolution or change on the fly? I noticed on certain resolutions in FBA it would stretch to fill the screen but if I left it blank it seems the correct proportions but of course had black around the borders usually left and right sides.
not sure i understand :) i use the default 'video-output' retroarch resolution (which is whatever your connected TV is - in my case, 1080p). the borders on the left/right depend on what aspect ratio you have set. the default should mean that it fills the vertical space, but (for me) has borders on the left + right, as very few arcade games are natively widescreen. i never mess with the resolution or aspect ratio as i want it to look true to life.
-
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
:) all i could find is this, which looks like a no: http://libretro.com/forums/showthread.php?t=3815
there are a bunch of vector settings (flicker, intensity, etc) that are available on mame2003, but they need to be exposed to the front-end as a libretro core option. i might try that soon! it also needs to use the full screen resolution, as right now it's stuck at 640x480 default, i believe.
Yeah, I found that thread a while back too. I am tempted to load/compile experimental MAME (current? I guess) and try using it JUST for vector titles to see if I can pull off some fancy bloom which it supposedly can do now. Might be a complete waste of time if performance is an issue, but if it works for old vector titles it would be beautiful.
As for vector in 2003, I haven't really tried it, but won't bother if it is locked to a max res of 640x480. Buzz updated AdvanceMAME code to allow specifying a vector resolution in the config so that's what I use for all vector games right now, and I get crisp lines at 1280x1024. I have a slight flicker enabled as well as anti-aliasing. The only thing I am missing is the bloom effects, but it's a "best so far" situation with vector.
There are really just 3 reasons I still need AdvanceMAME: 1. Vector resolution, 2. Analog controls (spinners, trackballs), 3. Boolean "not" controls mapping (used to exclude direction combinations to make a single joystick act as a tankstick).
-
@Riverstorm said in Scanlines in Libretro AdvMAME and FBA:
@caver01
Could you explain or link to the aspect_ratio_index = "22"? Also I was curious how you do this on a per ROM basis with .cfg, if I am saying that correctly?Here's the thread where I picked up on this idea.
The basic idea is that with a given display resolution, what is the best way to have consistent scanlines? The answer is integer scaling. The way to achieve this is to know your game's native resolution and calculate the largest scale that will fit inside your own display using integer multipliers. For example, if a vertical game is to be displayed in rotated fashion (with black pillars on the left and right) what's the largest rectangle you could use that would fit in a 1280x1024 monitor by scaling the game with an exact integer magnification of 240x320 (wxh)?
The answer is a 3x scale, at 720x960. If you go 4x it would be too tall to fit (320 times 4 = 1280 and that won't fit into 1024). Follow me so far? We could just let it do it's thing automatically and fill to 1024, but that would be a fractional scale, not an integer, and some pixels would have to be 3 high, and others (other rows) would be 4 high. This would make scanlines inconsistent. Some might appear lighter or darker, or more accurately, some would appear thicker or thinner. This problem goes away with high-res displays, but with older hardware like I have, it makes scanlines look messy.But if we go with 3x magnification, every scanline will be equal. So, how do we tell RetroArch to render the game at EXACTLY 3x resolution? We need to build a .cfg file that contains the right parameters to force it. Maybe there are easier ways to do it, but you can go totally manual and specify every detail for a ROM inside a config saved right next to it (name it "rom.zip.cfg). In this example, you might specify the following:
aspect_ratio_index = "22"
custom_viewport_width = "720"
custom_viewport_height = "960"
custom_viewport_x = "280"
custom_viewport_y = "32"Don't get too wrapped up in the aspect ratio index 22 thing. It is apparently number setting that tells RetroArch that you are specifying a custom viewport in the following lines.
The width and height are easy enough to understand, as these are the 3x magnification for our example game, But the x and y are interesting. They come from a calculation of the available screen area. If we are only rendering 720 pixels horizontally, and we have 1280, we have 560 unused pixels that will be our black borders. To get the image centered, we start the viewport at half of that--at 280. Then, for the 960 vertical, we have a slight black border at the top and bottom because we are not all the way to 1024. We have 64 pixels leftover, so to center the image, we start a half of that--32.That's my understanding of it. Custom viewports like this give you complete control over your rendered image, and as a result, allow you to calculate integer scaling if you want consistently shaped pixels. Note that some games don't have 1:1 Pixel Aspect Ratios (PAR). They expect stretching of the image. I am thinking of a game like Blasteroids. If that were the case, it would be obvious and you would be multiplying by a different value, maybe doubling the vertical or something. Anyway, it can get complicated.
I don't actually do this per ROM. I do some rotation per ROM, and a few ROMs I drop the curvature because of moire patterns (and I will be exploring @dankcushions link to further improve these titles), but I have enough resolution going for me that the curvature looks good and most vertical games play sideways on my cabinet at fullscreen.
-
@caver01
i think you're incredibly overcomplicating integer scaling :) if you simple do
video_scale_integer = true
(which you can do via the retropie config editor, rather than editing files), then it will automatically use the largest integer scale that fits into your resolution. you don't need to calculate or tweak anything. -
@dankcushions Ha ha ha! Yeah, you are right! This would be WAY easier.
Thanks for pointing that out. If that works, and it centers and so on. . . no need to do a custom viewport at all. I guess the tool is there if you need it. Maybe for games that have odd PAR that are typically stretched with CRT hardware adjustments? It has been fun to discover that RetroArch can accommodate just about any need.
-
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
they will work on lr-imame4all also, which uses the same romset as mame4all-pi.
Thanks Dank! :) I have about 250 ROMS all non-merged for use with MAME4ALL. I'll be flipping over until I can rebuild a set for lr-2003. Would it be forward thinking to make lr-2010 set or is that jumping the gun? When lr-2010 goes official will have the same features as 03? I think lr-2003 is .78 and lr-2010 is .139 about 7 years difference.
Also thanks on the resolution. I always left things at the default or I end up removing them from the game launch menu as every time I set something it just didn't look right. That will be a nice simplification, leaving the settings at default that is.
@caver01
Thanks for the explanation the really nice thing is I will have some idea of why I am turning on video_scale_integer = true instead of just doing it so I don't think the explanation was in vain by no means. :)Does video_scale_integer center up the image too then? A nice feature for sure.
-
@Riverstorm said in Scanlines in Libretro AdvMAME and FBA:
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
they will work on lr-imame4all also, which uses the same romset as mame4all-pi.
Thanks Dank! :) I have about 250 ROMS all non-merged for use with MAME4ALL. I'll be flipping over until I can rebuild a set for lr-2003. Would it be forward thinking to make lr-2010 set or is that jumping the gun? When lr-2010 goes official will have the same features as 03? I think lr-2003 is .78 and lr-2010 is .139 about 7 years difference.
this thread pretty much sumarises my thoughts on mame2010: https://retropie.org.uk/forum/topic/490/mame-2010-cfg-save-files
-
@dankcushions said in Scanlines in Libretro AdvMAME and FBA:
this thread pretty much sumarises my thoughts on mame2010: https://retropie.org.uk/forum/topic/490/mame-2010-cfg-save-files
Thanks Dank, 2003 it is! :)
-
I see a crt-pi1.zip is at both of these locations and they have differences. The Petroblock has additional shaders and the Libretro has only one, the crt-pi shader, but it is a large increase of about 3k to the file in the shaders folder. Is there a link for an up-to-date file or would combining the Libretro file with the Petroblock be the way to go?
http://blog.petrockblock.com/forums/topic/crt-pi-a-pi2-friendly-crt-shader/
http://libretro.com/forums/showthread.php?t=4937
Also Dank so you did create a vertical version of the shader? I was reading through the thread. Can you apply the shaders on a per ROM basis to take advantage of that?
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.