dosbox-staging icon indicating copy to clipboard operation
dosbox-staging copied to clipboard

Add CRT afterglow/ghosting for older monochrome CRT monitors

Open msikma opened this issue 9 months ago • 6 comments

Are you using the latest DOSBox Staging version?

  • [x] I have checked and I'm using the latest release.

Different version than latest?

No response

What operating system are you using?

macOS (Intel)

If other OS or Linux, please describe

No response

Are you running DOSBox Staging on a native OS?

  • [x] I am running Staging on a native OS

Is your feature request related to a problem? Please describe.

First of all, I have to say that the DOSBox Staging CRT effect is extremely nice. It's very subtle and I especially like how it's set up to automatically change based on what machine is being emulated.

I would like to suggest adding an optional afterglow effect. I realize this is easier said than done, but I'm hoping at least this would be considered a valid idea.

Older monitors, especially older monochrome monitors, would sometimes have very bright and intense phosphors which could leave a ghosting or afterglow effect.

Here's an example from Youtube that neatly demonstrates the effect. There's a longer example of how afterglow affects green CRT display here.

I realize this might be kind of difficult to implement, especially since the afterglow effect is a function of phosphor persistence. Per this wikipedia list, it depends a lot on the type of phosphor used. The most common phosphor types for monochrome CRT monitors were P1, P3 and P4 (green, amber and white), with P1 typically having a longer persistence.

Personally I grew up with two computers that both had really lengthy phosphor persistence, one slightly longer than the other, so it would be awesome if this could be emulated in some way alongside the already extremely good CRT emulation.

Describe the solution you'd like

Add an optional afterglow effect, with a configurable decay rate.

Describe alternatives you've considered

I'm not very familiar in the world of CRT shaders, but I don't actually recall ever seeing anything like this implemented. Possibly because as far as I know it's solely a function of monochrome CRT monitors and stopped being common by the turn of the 90s.

Add any other context or screenshots about the feature request here

Same videos as above.

Code of conduct and contributing guidelines

  • [x] Yes, I agree.

msikma avatar Mar 20 '25 11:03 msikma

Yes, I'm planning to implement this in the future multi-pass shader pipeline (it needs multi-pass). There are lots of existing implementations floating around; the better ones do the separate falloff thing for the R/G/B channels individually. Yeah, you'll be able to select presets for Hercules monitors where the persistence is long, short subtle persistence for VGA, etc.

Blur and glow will be emulated too, but those also needs multi-pass.

For the record, the CRT shaders will evolve into a full analog monitor emulation including:

  • Brightness, contrast and saturation adjustmens
  • Gamma adjustment
  • White balance adjustment
  • Horiz/vert stretch and position adjustments
  • Phosphor persistence emulation (afterglow/ghosting)
  • Phosphor glow emulation (related to afterglow)

All adjustments would be real-time, of course. Then you'd have Hercules, CGA, EGA, VGA monitor presets or "auto" which matches your monitor to the machine type.

johnnovak avatar Mar 20 '25 12:03 johnnovak

That sounds really amazing. I look forward to seeing the first few builds of this when that becomes a thing.

I actually had a setup back in the day that's not directly emulated by DOSBox Staging (or any other version I know), which basically had a CGA card outputting the canonical 4 color palette (in 320x200 mode), but the monitor was monochrome, so the cyan/magenta shades were interpreted as the exact same shade of green. In fact, all palettes looked identical even in brightness—I'm not sure if that was the monitor's doing or the card's.

I think this was fairly rare and probably a cost saving measure (I had a Tulip PC Compact, an IBM clone). That would be neat to be able to emulate with a future setup.

msikma avatar Mar 24 '25 15:03 msikma

I actually had a setup back in the day that's not directly emulated by DOSBox Staging (or any other version I know), which basically had a CGA card outputting the canonical 4 color palette (in 320x200 mode), but the monitor was monochrome, so the cyan/magenta shades were interpreted as the exact same shade of green. In fact, all palettes looked identical even in brightness—I'm not sure if that was the monitor's doing or the card's.

This your happy day, @msikma we already emulate CGA mono monitors! :sunglasses: Just set machine = cga_mono in the config.

Our front page even features a screenshot of the CGA mono version of Rockford, and the feature highlights section mentions that too with a link to the relevant release notes section:

https://www.dosbox-staging.org/releases/release-notes/0.75.0/#cga-monochrome-mode

So yeah, we added support for it a long time ago. Check out the feature highlights and the past release notes; thst's a good way to learn about our cool advanced features.

johnnovak avatar Mar 24 '25 22:03 johnnovak

This your happy day, @msikma we already emulate CGA mono monitors! 😎 Just set machine = cga_mono in the config.

I appreciate what you're saying, but I need to clarify. The setup I had was a little different. And I understand that what I'm saying seems strange, because I've been trying to find more information on it but I can't quite find it easily.

Basically I had a computer with a CGA card, but the monitor would show only one shade of white, one shade of green, and black. Cyan/magenta were merged to the exact same green. So imagine regular, canonical CGA with cyan/magenta/white as emulated on VGA, but cyan/magenta are one color and it's displayed in monochrome.

So taking Dave as example, here's a facsimile I made:

Image

Image

In fact, it wasn't until I first opened a DOSBox with monochrome CGA emulation that I realized the level progression hallway in Dave was supposed to have different brightness shades.

Today I understand this wasn't standard at all, but I believe there should be some information on it somewhere about how this technically worked and why. I'll try to find it. I think it was probably a cost cutting measure, or something to do with the fact that the Tulip PC Compact that I had was an IBM clone and not officially licensed.

msikma avatar Mar 27 '25 11:03 msikma

Just found this thread—lol, are you the same guy? 😆 https://www.vogons.org/viewtopic.php?t=85827

This is the answer, btw:

In CGA mode, the card is providing RGBI colours on the video connector, but the monochrome CRT is translating them into 16 shades of grey. So it's up to the display as to how it maps each CGA colour to a monochrome shade.

So maybe it was a weird monitor that did something slightly "non-standard". Staging already allows you to remap the CGA palette to any 16 colours (see cga_colors), so I guess we could extend that so it works with cga_mono as well. It would be a pretty niche ask, but hey, you could get purple or neon-pink CGA displays that way, so why not 😂

Also related: https://github.com/dosbox-staging/dosbox-staging/pull/2769

johnnovak avatar Mar 28 '25 01:03 johnnovak