CRT screen imitation in DOSBox

General discussion for all topics related to DOS, Windows, Linux, consoles, etc. Anything to do with games.
Post Reply
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

CRT screen imitation in DOSBox

Post 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
Last edited by MrFlibble on Mon Apr 07, 2014 9:16 am, edited 1 time in total.
User avatar
dosraider
Admin
Admin
Posts: 9243
Joined: Tue Mar 15, 2005 2:06 pm
Location: ROTFLMAO in Belgium.

Post 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.
wardrich wrote:The contrasts in personalities will deliver some SERIOUS lulz. I can't wait.
User avatar
Quadko
Darklander
Darklander
Posts: 2092
Joined: Fri Jun 24, 2011 10:07 am

Post 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.
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Post 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.
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Post 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;
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Post 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.
User avatar
dosraider
Admin
Admin
Posts: 9243
Joined: Tue Mar 15, 2005 2:06 pm
Location: ROTFLMAO in Belgium.

Post 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:
wardrich wrote:The contrasts in personalities will deliver some SERIOUS lulz. I can't wait.
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Post 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
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Post 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)
User avatar
dosraider
Admin
Admin
Posts: 9243
Joined: Tue Mar 15, 2005 2:06 pm
Location: ROTFLMAO in Belgium.

Post 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 .....
wardrich wrote:The contrasts in personalities will deliver some SERIOUS lulz. I can't wait.
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Post 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.
User avatar
dosraider
Admin
Admin
Posts: 9243
Joined: Tue Mar 15, 2005 2:06 pm
Location: ROTFLMAO in Belgium.

Post 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:
wardrich wrote:The contrasts in personalities will deliver some SERIOUS lulz. I can't wait.
User avatar
MrFlibble
Demoniac Demo maniac
Demoniac Demo maniac
Posts: 3792
Joined: Sun Dec 05, 2010 11:39 am

Post by MrFlibble »

Heh, I was never really into the tech side of computer stuff, so it's nice to learn something new :)
Post Reply