pseudo scanlines

discuss bbc micro and electron emulators (including mame) here!
Post Reply
garfield
Posts: 547
Joined: Mon Jan 03, 2005 1:38 am
Contact:

pseudo scanlines

Post by garfield »

Anyone have a hankering to enhance a BBC Micro emulator with pseudo "scanline" effect?

In lieu of a sophisticated "CRT filter emulation" graphical layer, one conceptually easy way is:

A. Use a line-doubling approach.
B. Apply a percentage bias with the "raster" displayed line, that is averaged with the "blank" scanline below it.
C. The emulator UI could allow the user to control the percentage of simple "scanline effect".



I think the effect is a good starting point, and the maths are simple. The effect should be kept to fixed multiples (e.g. 2x or 4x) of the BBC screen, since we're dealing with integer presentation here, and therefore the UI should probably disallow it in "free resizing" mode.

See image below for the idea. Any thoughts?
average_scan_stryker.png
Coeus
Posts: 3557
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: pseudo scanlines

Post by Coeus »

B-Em currently has a scanlines mode, though it is not as advanced as you describe here. To try it: Settings->Video->Display Type->Scanlines
User avatar
BeebMaster
Posts: 7379
Joined: Sun Aug 02, 2009 5:59 pm
Location: Lost in the BeebVault!
Contact:

Re: pseudo scanlines

Post by BeebMaster »

Perhaps I don't understand the terminology, but why does the higher percentage dark scanline produce a lighter scanline?
Image
garfield
Posts: 547
Joined: Mon Jan 03, 2005 1:38 am
Contact:

Re: pseudo scanlines

Post by garfield »

BeebMaster wrote: Thu Nov 16, 2023 10:43 pm Perhaps I don't understand the terminology, but why does the higher percentage dark scanline produce a lighter scanline?
Perfectly good question. It's arguably just as valid to invert the percentage. Swings and roundabouts!
garfield
Posts: 547
Joined: Mon Jan 03, 2005 1:38 am
Contact:

Re: pseudo scanlines

Post by garfield »

Coeus wrote: Thu Nov 16, 2023 10:25 pm B-Em currently has a scanlines mode, though it is not as advanced as you describe here. To try it: Settings->Video->Display Type->Scanlines
Yeah - a controllable percentage would be nicer, since I think a "full" black scanline is overly harsh in appearance. But thanks for pointing me to that feature of B-Em.
User avatar
tricky
Posts: 7691
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: pseudo scanlines

Post by tricky »

I would have thought pulling in a hardware based shader effect from another source would be fairly simple, but I don't know SDL!

Doesn't MAME support various effects and as it now supports the beeb except a few 6845 issues, it might be good to experiment with.
garfield
Posts: 547
Joined: Mon Jan 03, 2005 1:38 am
Contact:

Re: pseudo scanlines

Post by garfield »

tricky wrote: Fri Nov 17, 2023 7:46 am I would have thought pulling in a hardware based shader effect from another source would be fairly simple, but I don't know SDL!

Doesn't MAME support various effects and as it now supports the beeb except a few 6845 issues, it might be good to experiment with.
Ultimately, Tricky, yes a proper shader is the route to go. My suggestion above is merely a "good enough" quick win, so to speak.
User avatar
tricky
Posts: 7691
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: pseudo scanlines

Post by tricky »

Fair enough.
I don't know what the excellent virtual beeb https://virtual.bbcmic.ro/ does, but it looks like it has some horizontal noise and looks a bit like scan lines from the right distance, but it doesn't support interlaced mode ;)
Coeus
Posts: 3557
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: pseudo scanlines

Post by Coeus »

I think one of the issues with emulating this kind of thing is it may be a bit of variable target. In the case of CRTs, does a shadow mask tube (most of them) look different from an aperture grille tube (Trinitron and clones)? For shadow mask, were there different placements of the colour phosphors - I think I remember precision in-line being different from some others? Then, monochrome displays (green, amber etc) would not have had any mask at all.

With no mask, I would expect each line to have a brighter area in the middle and fade towards the edges but just how the brightness is distributed across the width would surely depend on how well focused the beam is - there is an electrode specifically to do this. Then brightness will presumably have an effect, especially as the phosphor presumably also has a saturation point, though I have no idea if real CRTs were capable of reaching it. If you were designing/adjusting a CRT, the ideal, surely, would be for the beam width to be such that the point midway between two lines is getting 50% from the beam above and 50% from the one below so the illumination is actually completely even. Could this be done on an aperture grille tube?
User avatar
tricky
Posts: 7691
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: pseudo scanlines

Post by tricky »

I know we are going a little off topic here!

It is optical illusion, or is more phosphor excited in brighter areas, meaning that 50/50 would only be at some "brightness" level?
This might be fine for the beeb with each gun being max or min, but would be different for a NULA.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: pseudo scanlines

Post by BigEd »

It might be good to have some photos of actual CRTs (whether televisions or monitors, whether monochrome or colour) to see what kinds of visibility might be apparent. I have a feeling that some scanlines effects might be slightly overdoing the retro reality. What they do do is make something visually distinctive - it looks "retro" even if not authentic.
User avatar
tricky
Posts: 7691
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: pseudo scanlines

Post by tricky »

On the portable that I have to hand, even with interlave turned off, there are no scan lines visible!
The mask is arranged:

Code: Select all

||||||/\/\/\||||||
\/\/\/||||||\/\/\/
/\/\/\||||||/\/\/\
||||||\/\/\/||||||
||||||/\/\/\||||||
\/\/\/||||||\/\/\/
/\/\/\||||||/\/\/\
||||||\/\/\/||||||
That is, roughly a square consisting of three columns, one each of red, green and blue with each square offset vertically by half a square from the previous one.
I wonder if the whole scan line thing comes from the arcades and NTSC resolutions where the gaps between scan lines are wider.

It may be that the focus not very focused or that the beeb colours saturate the guns, meaning that the scan lines merge perfectly or possibly some magic that the TV is doing with my RGB to SCART signal.

None of this means that if you want scan lines you shouldn't have them, or that a quick cheap alternative isn't a good start :)
I'll try and get some CUB photos when I am feeling better.
User avatar
BigEd
Posts: 6261
Joined: Sun Jan 24, 2010 10:24 am
Location: West Country
Contact:

Re: pseudo scanlines

Post by BigEd »

Fair point, if people want scanlines that's fine! I think perhaps NTSC on a large tube could well be where you'd be more likely to see the lines. (Hmm, sometimes the tube is vertical so for those games a recreation would need scanlines running the other way...)

I'm sure brightness, focus, and image contrast will all play into it.
gfoot
Posts: 987
Joined: Tue Apr 14, 2020 9:05 pm
Contact:

Re: pseudo scanlines

Post by gfoot »

Scanlines are quite visible to my eye on a Cub monitor with interlacing disabled. With interlacing on I instead seem to see divisions between the RGB phosphor dots.

Here's an old photo taken probably with interlacing enabled and a long enough exposure to not show scanlines, but it does show the phosphor pattern. A lot will depend on camera settings, and I don't think the naked eye is quite as good at seeing this fine detail.
Attachments
20230215_003943.jpg
User avatar
tricky
Posts: 7691
Joined: Tue Jun 21, 2011 9:25 am
Contact:

Re: pseudo scanlines

Post by tricky »

Certainly a single frame capture would be interesting, I wonder if the slowmo guys filmed it as well as the vector displays, I'm sure that I've seen a video somewhere.

I can't see any scan lines in that image, but they would be much less visible and jumping up and down in interlaced mode.
The only thing that I can see in that image is the shadow mask and even squinting, I don't see where the scan lines would be, only the shadow mask pattern which will practically never match the scan lines.
gfoot
Posts: 987
Joined: Tue Apr 14, 2020 9:05 pm
Contact:

Re: pseudo scanlines

Post by gfoot »

Coincidentally this just popped up today: https://hackaday.com/2023/11/18/bringin ... -software/
garfield
Posts: 547
Joined: Mon Jan 03, 2005 1:38 am
Contact:

Re: pseudo scanlines

Post by garfield »

gfoot wrote: Sat Nov 18, 2023 10:53 pm Coincidentally this just popped up today: https://hackaday.com/2023/11/18/bringin ... -software/
Cool. Seems to be a nice CRT shader library, albeit NTSC focused.
Post Reply

Return to “8-bit acorn emulators”