Does Each Core Handle Scanline Filters Different?
-
I mentioned this on another forum but wanted to get the insight of folks here.
I'm a hardcore fan of the zFast scanline filters, and I have it applied to all my cores in Retroarch (on my Pi4 setup). However, I do notice on occasion that some systems seem to display the scanlines differently.
Has anyone else noticed that the scanlines are thicker or more pronounced on some consoles than others? I find the smaller/thinner they are, the more accurate it looks (90% of the time, this is how Retroarch displays them). Just a few wonky systems here and there make them look bigger or more bold for some reason.
-
@AlphaBetaPie Even if I am the 1st to answer -> I have no real knowledge about libretro shaders internals and others may void my assumption later on, but: I am inclined to guess that the source resolution ([sometimes "anamorph"] PAR resized to correct DAR) of the various systems/arcade-roms in regards to targeted displayed resolution of the retropie-system in use and whether the axis perpendicular to the screen orientation of the source (or are both needed?) is integer scaled or not, has a major influence of the resulting image with applied shaders. Maybe there is a reason why they are so "customizable" with settings as scale and such?
-
Systems may have had different vertical resolutions which could make the scanlines look different.
Scanline shaders will look best with integer scaling on and at least 4x resolution (means you need 1080p for best picture, 720 will only do 3x and will produce "banding" on most systems.)
-
real world CRT scanlines are a result of a ~240p (ie, 240 vertical pixels) signal on a consumer CRT designed for ~480i. it results in every other line being blank - these are the black lines we see.
a CRT filter/shader just generates a black line after each line of pixels in the current game running. it doesn't know if the content running is 240p, or even designed to be running a CRT in the first place. eg, if you select a CRT filter for all systems, it will incorrectly apply the black lines to gameboy.
it will also incorrectly apply the scanlines to content with too high resolution - for example, if you've set lr-pcsx_rearmed to the high/double resolution mode, the games will now be running at ~480 pixels high. the filter will then show 480 scanlines which will appear as an ugly haze on most displays, as well as being unrealistic. same deal if you apply them to 480p/480i dreamcast content.
personally i wouldn't apply a scanline shader to ALL systems, since for some it's just not appropriate. perhaps if you gave some specific examples we could explain why.
-
@sleve_mcdichael and @dankcushions
Thanks for the info from both of you. That does make sense, and I get that I'm trying to shove all systems into a one-size-fits-all scenario that is not likely to generate 100% accuracy. However, most of the systems I'm dealing with all were played on the old TVs with scanlines back in the day (mostly the 8bit and 16bit era), and I find this filter does some hardcore work to make them look and feel like the originals.
So here is a screenshot of the setting I use for almost all my emulators. These are the default scanline settings. What should I adjust to get the best overall quality across all the systems (assuming I'm on a 1080p HDTV). I know it won't be perfect for all, but I'd like to maximize the result overall.
-
@AlphaBetaPie if you aren't using integer-scaling already, that might help:
Test it with:
hotkey + X > quick menu << back one to main menu > settings > video > scaling > integer scale: on
If it looks like you want to keep it, don't save through the menu but add this line to your config (global, system, or game-override):
video_scale_integer = "true"
-
@sleve_mcdichael said in Does Each Core Handle Scanline Filters Different?:
integer scale: on
Very helpful, thanks for the info. I checked, and it wasn't turned on. However, when I do enable it, I open a new can of worms. Here is what I mean...
Currently, with Integer Scaling off, I have access to custom aspect ratio X/Y and width/height. So I can resize the video to a larger/smaller box, then move it around the screen to where it's needed using the X/Y values. This is useful when using a custom overlay, for example.
However, when I turn Integer Scale on, I lose my X/Y position values. So it just defaults the video to the center of the monitor by default.
Is there a way to turn Integer Scaling on and also assign it a custom locaiton on the screen?
-
@AlphaBetaPie i don’t recommend turning on integer scaling for that, and other reasons ;) instead i recommend what i said before - show us an example that looks bad. verbose log for said example also, since you’re using custom resolutions/overlays. then we can see what’s up.
there’s no catch all setting for this kind of scenario, because of the reasons i stated. some situations just wont look right with a scanline shader regardless.
-
@dankcushions said in Does Each Core Handle Scanline Filters Different?:
@AlphaBetaPie i don’t recommend turning on integer scaling for that, and other reasons ;)
So just to confirm, using integer scaling with custom overlay sizing/positioning is actually not an option then? Just making sure I understood you correctly here.
@dankcushions said in Does Each Core Handle Scanline Filters Different?:
@AlphaBetaPie ...show us an example that looks bad.
Well, here is an example of what I would consider perfect scanlines. And it's the same zFast filter I mentioned before (all at its default settings). I get the exact same results on other 16bit consoles as well (IE: SNES or Genesis). The forum image resizing is messing with it a bit, but it looks great on a Pie.
However, if you check out the PSX with the same filter, it definitely seems like the scan lines are a bit more prominent than they should be. Same in the white boot screen (the blocks in the white are twice the size as in the Mario example, and the middle orange triangle has some weird banding going on there).
But when you get over into the game (MK3 in this case), it seems fine again.
That's just some things I've noticed, at a glance.
-
@AlphaBetaPie said in Does Each Core Handle Scanline Filters Different?:
Is there a way to turn Integer Scaling on and also assign it a custom locaiton on the screen?
There is
custom_viewport_x
andcustom_viewport_y
to set the position. I don't know if it is compatible withvideo_scale_integer
but I could see why it might not be. In that case, you could set acustom_viewport_{height|width}
window at your desired position, manually-scaled to integer values. -
@sleve_mcdichael said in Does Each Core Handle Scanline Filters Different?:
@AlphaBetaPie said in Does Each Core Handle Scanline Filters Different?:
Is there a way to turn Integer Scaling on and also assign it a custom locaiton on the screen?
There is
custom_viewport_x
andcustom_viewport_y
to set the position. I don't know if it is compatible withvideo_scale_integer
but I could see why it might not be. In that case, you could set acustom_viewport_{height|width}
window at your desired position, manually-scaled to integer values.I actually have them set to custom values right now, but it's just so they fit the overlay graphic where there is a space cut out for it (the dimensions are kinda arbitrary).
But when you say "...manually-scaled to integer values," does that mean if I keep them at certain ratio, they will look better on various TVs? And if so, how do calculate my dimensions so they ended up as "integer values?"
-
@AlphaBetaPie said in Does Each Core Handle Scanline Filters Different?:
But when you say "...manually-scaled to integer values," does that mean if I keep them at certain ratio, they will look better on various TVs? And if so, how do calculate my dimensions so they ended up as "integer values?"
Example: NES games (NTSC format) were 256x240 pixels. If you upscale this by an integer value -- say 4x (1024x960) -- then each individual pixel gets scaled up to a 4x4 block of identically-colored pixels. But if you scale it by a non-integer value like 4.5 (1152x1080), then it is no longer possible for individual pixels to scale up into identically sized and colored blocks. Either some emulated pixels will be wider/taller than others, or some actual pixels will have to be an average of the two or four emulated pixels that intersect it, depicting colors that never existed in the original image.
Integer scaling will make all your pixel-art look better but it's especially noticeable with scanline shaders. The upscaled pixels need to have well-defined borders and be large enough to draw a scanline over part of each one without obscuring 50% of the image.
-
@sleve_mcdichael said in Does Each Core Handle Scanline Filters Different?:
@AlphaBetaPie said in Does Each Core Handle Scanline Filters Different?:
But when you say "...manually-scaled to integer values," does that mean if I keep them at certain ratio, they will look better on various TVs? And if so, how do calculate my dimensions so they ended up as "integer values?"
Example: NES games (NTSC format) were 256x240 pixels. If you upscale this by an integer value -- say 4x (1024x960) -- then each individual pixel gets scaled up to a 4x4 block of identically-colored pixels. But if you scale it by a non-integer value like 4.5 (1152x1080), then it is no longer possible for individual pixels to scale up into identically sized and colored blocks. Either some emulated pixels will be wider/taller than others, or some actual pixels will have to be an average of the two or four emulated pixels that intersect it, depicting colors that never existed in the original image.
Integer scaling will make all your pixel-art look better but it's especially noticeable with scanline shaders. The upscaled pixels need to have well-defined borders and be large enough to draw a scanline over part of each one without obscuring 50% of the image.
Thanks for all that info, makes a lot of sense.
However, since my setup greatly depends on the position/size of the screen in relation to how the overlay graphic is designed, it seems like integer scaling may not be compatible with my setup. I mean, it sounds like I have to size everything by exact factors for it to work. And many of my overlays are obscure sizes. So that breaks the integer scaling, right?
-
@AlphaBetaPie said in Does Each Core Handle Scanline Filters Different?:
However, since my setup greatly depends on the position/size of the screen in relation to how the overlay graphic is designed, it seems like integer scaling may not be compatible with my setup. I mean, it sounds like I have to size everything by exact factors for it to work. And many of my overlays are obscure sizes. So that breaks the integer scaling, right?
Right, it is only "integer scaling" at those exact scale factors which may not work well if your overlays aren't similarly-sized.
-
@AlphaBetaPie your psx logo example is interesting and shows what i was saying nicely. the psx boot sequence goes through some interesting resolutions - that psx logo is actually 480i interlaced output. since it is an (i)nterlaced output, it would not generate scanlines on a real CRT, but the shader doesn't know this and applies anyway. by applying to a high(er) vertical resolution the scanlines appear all blurred and weird.
once you get in game, most psx games are more standard progressive resolutions (320p, etc), but not always. some games switched temporarily to interlaced higher resolution modes in menus, etc. so shaders aren't always going to be appropriate, but there's nothing you can do, other than remove them completely (or turn the boot logo off in core options)
integer scaling is not the issue here. and yeah it can change the aspect ratio from 4:3 (massively in some cases) and will not fit into your overlays (without additional borders). if it was good it would be the default :)
-
@sleve_mcdichael said in Does Each Core Handle Scanline Filters Different?:
Right, it is only "integer scaling" at those exact scale factors which may not work well if your overlays aren't similarly-sized.
Makes sense, thanks for confirming. I thought it might be an extra thing I can do to improve things overall, but the overlays are a must for my setup. But I'm very satisfied with the results already, so no harm no foul!
@dankcushions said in Does Each Core Handle Scanline Filters Different?:
@AlphaBetaPie your psx logo example is interesting and shows what i was saying nicely. the psx boot sequence goes through some interesting resolutions - that psx logo is actually 480i interlaced output. since it is an (i)nterlaced output, it would not generate scanlines on a real CRT, but the shader doesn't know this and applies anyway. by applying to a high(er) vertical resolution the scanlines appear all blurred and weird.
once you get in game, most psx games are more standard progressive resolutions (320p, etc), but not always. some games switched temporarily to interlaced higher resolution modes in menus, etc. so shaders aren't always going to be appropriate, but there's nothing you can do, other than remove them completely (or turn the boot logo off in core options)
integer scaling is not the issue here. and yeah it can change the aspect ratio from 4:3 (massively in some cases) and will not fit into your overlays (without additional borders). if it was good it would be the default :)
Again, thanks for confirming. I suspected as much, but it's also nice to see that it's just the nature of the emulator beast and not necessarily my setup. And as you mentioned, if it's giving me fairly accurate (and overall good) results, I can overlook little inconsistency here and there, like the bootup screens. I think the overall benefit (for my setup anyway) is worth the few little hiccups. Maybe they'll figure out things a bit better as the cores advance. Thanks!
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.