crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come)
-
@rsn8887 said in crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come):
Are the scanlines guaranteed to be always aligned with the games original pixels, regardless of my scaling settings? E.g. if the game is low-res and fullscreen, and the pixels are large, the scanlines are also thicker?
there are two separate resolutions at play with scanline shaders:
-
the original game's original resolution. this is typically 240 pixels high. a black scanline will be inserted between every vertical pixel. this rule always applies, no matter your render resolution:
-
your render resolution (by default in retropie this is your display's resolution). on an HDTV this would be 1080 pixels high. this determines the quality of the image, but it has no effect on the thickness (other than via scaling artefacts, which my script aims to eliminate) or number of scanlines.
whilst a game with a higher original resolution (eg, tekken 3 on the psx is 480 pixels high) will have more scanlines, you have to consider that this isn't a real world situation. CRTs have scanlines when running progressive scan, low resolution games. tekken 3 would be running in an interlaced (non-progressive) mode, so would NOT have scanlines. the shader isn't able to figure this out, so still injects scanlines regardless, but they are so thin they end up looking like a sort of 'haze' on the screen.
to answer your question specifically:
Are the scanlines guaranteed to be always aligned with the games original pixels, regardless of my scaling settings?
the shader guarantees that there will be a scanline between every vertical pixel (1) of the original game. if you upscale this to a different resolution (2), you will get scaling artefacts unless the new resolution (2) is a factor of the original resolution (1). this script aims to mitigate those artefacts - i explain how in the first post.
-
-
Interesting.
I wonder then why are there so many versions? There should be only one shader that adapts itself automatically and generates the masks etc. on the fly for whatever input and output resolutions are used.
For example why is there not a check inside the vertex shader to pass a variable to the fragment shader that disables scanlines if the game resolution is larger than 240p?
Also the vertical vs horizontal thing bothers me, this should be automatically checked within the vertex shader and the result passed to the fragment shader.
The vertex shader is only executed four or six times or so per frame for a 2d game. So the slowdown of these automatic checks should be negligible.
I read somewhere that making the shader more automatic would cause slowdown but that makes no sense to me, if these things are only done in the vertex shader.
-
@rsn8887 said in crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come):
Interesting.
I wonder then why are there so many versions? There should be only one shader that adapts itself automatically and generates the masks etc. on the fly for whatever input and output resolutions are used.
what do you mean many versions? there's not.
For example why is there not a check inside the vertex shader to pass a variable to the fragment shader that disables scanlines if the game resolution is larger than 240p?
Also the vertical vs horizontal thing bothers me, this should be automatically checked within the vertex shader and the result passed to the fragment shader.
The vertex shader is only executed four or six times or so per frame for a 2d game. So the slowdown of these automatic checks should be negligible.
I read somewhere that making the shader more automatic would cause slowdown but that makes no sense to me, if these things are only done in the vertex shader.
i mean, if you know better than the shader authors, why not do it yourself? :) i think zfast shader doesn't have a vertical variant, so maybe the issue is solved there, or maybe it doesn't have a shadow mask. i haven't tested it yet...
-
@dankcushions said in crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come):
i think zfast shader doesn't have a vertical variant,
No, there is a vertical variant of zfast too. Actually, there are four variants to cover the standard, vertical, and both again with curvature.
@rsn8887 it as been stated by davej and possibly others that, although it is possible to do some detection on the front-end to avoid the variants, this alone can have an adverse affect on performance. The point being, we all want these shaders to run as lean as possible and have as little effect on performance as necessary to achieve the visual results. The variants are really the same shader repeated, only with different configuration settings embedded so that we as users don't have to dive into the shader files and change the settings. In other words, it is simply easier to make a duplicate with adjustments and cycle through shaders to use them than it is to edit the files themselves. You also can specify which variant in rom-specific configs.
-
I understand. I didn't mean that we need extra options or anything done in the front-end. I mean that the vertex shader itself should set those options automatically internally. For example, the vertex shader can do a check if lines>rows to see if it is a vertical or horizontal game. It can also check what the output resolution is and adjust its behavior.
All of these checks are trivial and have to be done only per vertex, not per pixel. So these checks have to be done only once per frame. Well, technically four or six times, because the screen has four or six vertices.
-
@rsn8887 we are on the same page with the checks. You can probably find the discussion thread back when davej released the crt-pi shaders. This idea came up back then, and he explained how doing detection would affect performance.
-
@rsn8887 said in crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come):
I understand. I didn't mean that we need extra options or anything done in the front-end. I mean that the vertex shader itself should set those options automatically internally. For example, the vertex shader can do a check if lines>rows to see if it is a vertical or horizontal game. It can also check what the output resolution is and adjust its behavior.
All of these checks are trivial and have to be done only per vertex, not per pixel. So these checks have to be done only once per frame. Well, technically four or six times, because the screen has four or six vertices.
The issue isn't so much with the checks themselves, which are trivial even if done in the fragment shader, but the branching down different code paths based on the results of the checks - which you'd still have even if the fragment shader just tested a flag set in the vertex shader. crt-pi has to do as much of its configuration as compile time checks as possible to avoid those branches.
It's also worth pointing out that for some checks the information available isn't sufficient.. Your horizontal or vertical game check is a case in point.. What happens when a game is displayed on a screen that is in portrait orientation (because someone mainly plays vertical games)? The shadow mask emulation needs to be the opposite of what it is for landscape orientation and that information isn't provided to shaders by the libretro library.
-
@dankcushions Are the cfg files for FB Alpha still based on 0.2.97.39 or the latest 0.2.97.43?
-
no these are still .39. any updates will be announced here, but i’ve no plans for that.
-
Dankcusions, im lost when it comes to linux etc, can you please create some shaders (H & V) for my 1600x1200 display?
-
just to flag that i'm aware that these configs don't work with current retropie/retroarch, due to
aspect_ratio_index=22
no longer being the right setting for the 'custom' aspect ratio than the configs require. this is due to a change at retroarch's end: https://github.com/libretro/RetroArch/commit/8a63ace201233256672241346b2a67a7c0d372f8#commentsi'm currently in discussions regarding this, and will update my script when a resolution (hah!) is reached: https://github.com/libretro/RetroArch/issues/7536
i would also like to support the latest fbalpha version properly, but i think i need @UDb23 for the appropriate resolution-db file ;) i can vaguely remember how to generated the db for mame2003 (via parsing the driver source code) but not fbalpha.
-
@dankcushions they also changed the expected directory for the configs - it’s now MAME 2003 (0.78) , rather than MAME 2003
-
@AndrewH yep! spotted that also. slightly annoying that things like that get changed as it breaks all overrides. i might flag that with them also.
-
@dankcushions said in crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come):
appropriate resolution-db file
Concerning ROMS resolution in FBA I used multiple overlays made for mame2003 without any issue. That likely means FBA uses the same resolutions as mame; so no new resolution DB needed.
If you have different evidence just let me know and I'll try to build a FBA dedicated DB. -
@UDb23 i think the issue is that fbalpha has a different romset. it certainly has a bunch of games that mame 0.78 doesn't have, like cps3, and a bunch of unofficial hacks that mame doesn't seem to care about.
-
@dankcushions Right, didn't think of the wider romset.
Just need to find some spare time to and I'll create the FBA rez DB ;-) -
@dankcushions As it seems a new FBA version will come out soon, maybe it makes sense to wait and directly make the DB for that new version specific romset.
-
@UDb23 said in crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come):
that new version specific romset.
By that statement, I take it that the FBA ROM set is expected to change again soon?
-
@mediamogul According to FBA's forum development progress posts many additional roms are supported. This includes vector games: it will be interesting to see if quality/performance is better than the recent mame2003 vector resolution enhancement.
Not sure if it just adds new roms or also some roms from previous romset need to be changed. -
@mediamogul said in crt-pi shader users - reduce scaling artifacts with these configs in lr-mame2003, lr-fbalpha, lr-nestopia (and more to come):
By that statement, I take it that the FBA ROM set is expected to change again soon?
It has already changed - https://retropie.org.uk/forum/topic/19741/new-fb-alpha-libretro-pre-v0-2-97-44 . The new repository has already new DAT files added - https://github.com/libretro/fbalpha/commit/4e5aeeeef7730fa4f5b17dae6f8e1b90829c9029.
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.