CRT Filtering for Chocolate Doom

Being over 20 years since the release of Doom, I guess it now qualifies as lo-tech, and so the subject of some attention here. I’ve never been much of a gamer – but Outrun, Doom and Lemmings are three titles I still enjoy today.

Having stumbled across Chocolate Doom recently, the problem is that on a nice clear LCD screen 320×200 looks rubbish, certainly more blocky that I remember it looking on my Ambra 386 back in the day. Then again our expectations were I guess lower.

Turns out there is though a solution – a filtering library by Blarrg developed for SNES games, which has various options to emulate how games looked through composite signals on a CRT. There are some example images on the slack.net site.

Adding CRT Filtering to Chocolate Doom

The results with Doom are, in my opinion, pretty good too (the difference is even more noticeable in-game, with moving images):

Native:Doom-title-no-filterFiltered:Doom-title-filteredNative:Doom-Start-Unfiltered

Filtered:Doom-Start-FilteredNative:Doom-Outside-UnfilteredFiltered:Doom-Outside-filteredWhilst I don’t claim to be a programmer, I’ve added the filtering code to chocolate doom and am making the entire code branch available for download right here. You’ll need to grab the Doom WAD file too (apt-get install doom-wad-shareware on Ubuntu).

To build the source (assuming it’s extracted to ~/chocolate-doom-filtered):

~$ cd ~/chocolate-doom-filtered
~/chocolate-doom-filtered$ ./autogen.sh
~/chocolate-doom-filtered$ make
~/chocolate-doom-filtered$ sudo make install

My coding is crude and so needs some specific settings in the config file (~/.chocolate-doom/chocolate-doom.cfg on Linux). Make this file by running chocolate-doom-setup, then edit it with a text editor to set:

autoadjust_video_settings 0
fullscreen 1
aspect_ratio_correct 0
startup_delay 1000
screen_width 320
screen_height 200
screen_bpp 32

I’ve changed the video initialisation code to start in full-screen, trying 1280×1024, 1024×768, 800×600 and finally 640×480 via standard SDL (1.x) calls. The game code renders via the configuration file settings (320×200) since that matches the original and minimised the CPU load of the filtering.

Once the game is running (chocolate-doom -iwad /usr/share/games/doom/doom1.wad on Ubuntu with the WAD files installed from doom-wad-shareware), a number of keys control the filtering:

  • f toggles the filter on-and-off
  • b reduces brightness, B to increase
  • c reduces contrast, C to increase
  • g reduces gamma, G to increase
  • h reduces hue, H to increase
  • i toggles interlacing effect
  • l reduces merging of frames (emulating CRT phosphor delay); L to increase
  • s reduces sharpness, S to increase
  • m cycles filter mode between composite, s-video, RGB and monochrome

It would be nice to use SDL 2 and hence offload the scaling to GPU via textures, however that’s beyond my skills. If you make any improvements to my code or port it to Android or IOS, please do post a comment and let me know!

Please note that the original game is Copyright © idSoftware, and Chocolate-Doom is distributed under GNU v2 License. Screenshots on this page are provided to show the technical impact of the filtering code as applied to the original Doom Shareware game.

2 Responses to CRT Filtering for Chocolate Doom

  1. Jim Leonard says:

    Nice integration! But you might want to have it default to RGB mode, since there were no composite or s-video artifacts on RGB monitors (and I see them in your screenshots).

Leave a Reply