Page 1 of 1

CRT screen imitation in DOSBox

Posted: Sat Apr 05, 2014 11:25 am
by MrFlibble
I was playing around with pixel shaders that are included with DOSBox SVN Daum when I realized that several of them alter the DOSBox output to make it look like an image on an authentic CRT screen. One of them even goes as far as to recreate the "fishbowl" distortion of an actual monitor:
Image

Image

Another shader creates a less distorted (but still not completely rectangular) image:
Image

In my opinion, this looks pretty awesome (especially the fishbowl effect one). To configure DOSBox SVN Daum to use this shader, you need to make the following changes in dosbox.conf:

Code: Select all

[sdl]
output=direct3d
pixelshader=CRT-geom-curved.fx

[render]
aspect=true
scaler=hardware2x
The CRT-geom-curved.fx shader will create the fishbowl effect. You can use are CRT.D3D.fx instead to get a less prominent surface distortion, and CRT.D3D.br.fx for a brighter version of CRT.D3D.fx.

This works both in the windowed and fullscreen modes.

You can also get higher resolution images by using hardware3x, hardware4x and hardware5x instead of hardware2x:
Image

Posted: Sat Apr 05, 2014 2:01 pm
by dosraider
....interesting screen setup.
For old times sake you could say. :laugh:

if it looks better in a fishbowl ...... dunno, not really I must say.

Posted: Sat Apr 05, 2014 3:04 pm
by Quadko
Sweet, that's fun. It's nice to see DosBox getting more and more of the advanced features that emulators of "simpler" systems have achieved.

Posted: Sun Apr 06, 2014 11:07 am
by MrFlibble
Quadko wrote:It's nice to see DosBox getting more and more of the advanced features that emulators of "simpler" systems have achieved.
Apparently lots of things can be accomplished with shaders (for comparison, the built-in DOSBox scalers that add scanlines look much worse than the shader CRT imitation). There's another one that can turn VGA output into EGA for example.

Posted: Mon Apr 07, 2014 9:26 am
by MrFlibble
I Googled information on the first shader (CRT-Geom), and it turns out that it can be customized to adjust screen curvature, gamma correction etc. by editing the shader file. Apparently this is initially a shader that was written for console emulators (and thus it supposedly imitates a CRT TV screen), and then ported to work with DOSBox.

A very detailed description of how to customize the console emulator version can be found here. It is possible to reduce the curvature of the screen, or disable it entirely if desired.

Without curvature emulation, screen output looks like this:
Image
This is enabled by commenting out (with //) the following line in CRT-geom-curved.fx:

Code: Select all

  // Enable screen curvature.
  //#define CURVATURE
And here's what the screen looks like with the shader set to imitate a less curved screen, with smaller rounded corners:
Image
To get this, just change the lines:

Code: Select all

  // aspect ratio
  float2 aspect = { 0.5, 0.5 };
and

Code: Select all

  // size of curved corners
  float cornersize = 0.02;

Posted: Mon Apr 28, 2014 5:14 am
by MrFlibble
I've asked the experts at VOGONS and it turns out that I made the mistake of taking screenshots in windowed mode, which does not do justice to the shaders' actual capabilities. leilei also suggested to use CRT.D3D.br.fx as the preferred shader.

Here's a comparison of all three shaders in fullscreen mode (1600x900): CRT-geom.curved.fx, CRT.D3D.fx, CRT.D3D.br.fx.

Posted: Mon Apr 28, 2014 10:22 am
by dosraider
MrFlibble wrote:.... CRT.D3D.br.fx.
Looks indeed pretty good I must say. I could be looking at one of my old CRTs .... :)

minus the heat of the ol'tubes and minus radiation ..... :laugh:

Posted: Mon Apr 28, 2014 12:23 pm
by MrFlibble
dosraider wrote:I could be looking at one of my old CRTs .... :)

minus the heat of the ol'tubes and minus radiation ..... :laugh:
:D

In the meantime, the VOGONS guys have posted some photos of what actual CRT TVs and monitors look like.

I guess I'll have to read up some stuff on how CRT TV screens and CRT computer monitors work, like this:
http://www.ehow.com/info_7783410_do-dif ... tubes.html
http://www.scholarshipsinindia.com/answ ... ision.html
http://www.hitequest.com/Kiss/TV.htm

Posted: Tue Apr 29, 2014 9:20 am
by MrFlibble
Apparently the normal2x scaler produces a better result compared to hardware2x. Here's a comparison of all three CRT imitation shaders:

CRT-geom-curved (hardware2x)
CRT-geom-curved (normal2x)
CRT.D3D (hardware2x)
CRT.D3D (normal2x)
CRT.D3D.br (hardware2x)
CRT.D3D.br (normal2x)

Posted: Tue Apr 29, 2014 10:48 am
by dosraider
You're really bitten by this, ain't you?

Indeed, normal2x scaler looks slightly better.

One point however, whilst it's true that all older CRTs had a fishbowl effect, some more than others, the latter CRTs (and not the cheapest of them meheh) had an almost flat screen, and the latest ones ( again not the cheapest ones ...) had even a perfect flat tube surface.
Same goes for TV sets. I remember the trinitron tubes, some could (*almost*) compete with PC LCD monitors, certainly the latter 27" tubes. (and weighted a 100 kgs lmao)
Just to say that talking about CRTs and fishbowl effect isn't always 100% correct .....

Posted: Wed Apr 30, 2014 5:28 am
by MrFlibble
I used to have a 17" almost-flat CRT monitor in the late 90s/early 2000s. The thing was huge. Also when it got worn a bit it would sometimes get noticeable framerate drops after screen resolution changes (e.g. when you quit a game that runs in a lower resolution back to the desktop).

While not 100% accurate, these shaders are certainly a nice retro gimmick anyway :)

BTW, it is my understanding that normal2x provides a more accurate result for VGA (leilei says EGA and CGA should use hardware2x anyway) because VGA doubles the number of lines:
320x200 @ 70 Hz, the most common mode for VGA-era PC games, uses exactly the same timings as the 640x400 mode, just halving the dot clock and displaying each line of pixels twice. [source]
Conversely, hardware2x apparently just uses the 320x200 image that gets stretched over the entire screen.

Posted: Wed Apr 30, 2014 11:17 am
by dosraider
... I will assume that by now after digging into those matters you'll comprehend it's a complicated and vast tech area you're playing in.

It's almost not to grasp all those modes for every step the computer graphical hardware made in the past. And add the tricks software devs sometimes applied ....

Headache alley here we come :laugh:

Have you ever tried to follow what the newer graphical cards can do ....??? I pass, really, pffffffffffffffffffffffffffffffffffff :shifty:

Posted: Wed Apr 30, 2014 12:05 pm
by MrFlibble
Heh, I was never really into the tech side of computer stuff, so it's nice to learn something new :)