Creating a raytracer for DOS, in 16 VGA colors





Rating is available when the video has been rented.
This feature is not available right now. Please try again later.
Uploaded on May 23, 2011

In this tool-assisted education video I create a raytracer from scratch.
The raytracer renders in 16-color VGA palette at 640x480 resolution.

Twitter: https://twitter.com/RealBisqwit
Patreon: https://patreon.com/Bisqwit (alternatives at http://iki.fi/bisqwit/donate.html)
Twitch: http://twitch.tv/RealBisqwit
Homepage: http://iki.fi/bisqwit/

Source code:
http://bisqwit.iki.fi/jkp/raytrace.cpp (only compiles in Borland C++ 3.1 and runs in DOS; this is verbatim the program that I wrote in this video)
http://bisqwit.iki.fi/jkp/raytrace2.cpp (runs on most OSes, uses OpenMP thread-parallelism)
http://bisqwit.iki.fi/jkp/raytrace3.cpp (runs on most OSes, uses CUDA for GPU parallelism, depends on this header file: http://bisqwit.iki.fi/jkp/helper_cuda.h)

List of programs written by me that made this video possible:
- ADLMIDI (This plays MIDI files through OPL3 emulation)
- JAINPUT (Japanese input editor)
- E.EXE (Full-screen DOS editor)
- SPCPLAY (This plays SPC files, which are SNES music), however see below
- New.php (With this I architected how exactly to input the code, where to resize the screen and where to scroll the window etc.)
- INPUTTER (This tool ensured that the plan is followed perfectly, given the time constraints)
- SPCtoMIDI (This converts log files created by SPCPLAY into MIDI files)
- Firstframe.php (This rendered the various effects at 11:10 to 11:54 , after which the real rendered frames were displayed verbatim. The slowness in the beginning was how the BC++ compiled program would have appeared, but it was simulated with this PHP program.)
- Animmerger (This ensured that the frames produced by Firstframe.php were indeed of the EGA palette and dithered the same way as the raytracing was)
- Hudmaker (This converts raw audio and video streams and overlays graphical items, like subtitles, into it, and sends result to encoder)
- Tile4 (This did the four-video inset at the end of the video. I got the idea from Freddy Wong (user:Freddiew).)

List of significant programs involved that were not written by me (all but BC++ are open-source):
- DOSBox and its associated utilities like "mount"
- FreeDOS command prompt
- Borland C++ compiler, Turbo Assembler, Turbo Link
- SNES9x (I used portions of SNES9x in SPCPLAY)
- MEncoder (Video+Audio Encoder; The video recorded by DOSBox was of varying FPS and of varying resolution, due to all the screenmode changes. With MEncoder I resampled them all into a common format, which was 3200x2400 120-fps RGB16 raw video.)
- Lzop (I compressed raw video streams with this for intermediate storage)
- GCC, GNU assembler, GNU gold (After verifying that the program _works_ on BC++, I compiled the _actual_ raytracer with this and did the actual rendering on a multicore Linux server, because raytracing is, well, quite slow)
- Imagemagick (This converted 16-bit PNGs into 8-bit ones)
- Audacity (I mixed audio tracks together with this tool)
- Sox (I may have used it to convert WAV from/to RAW)
- X264 (Video Encoder, used for the final encoding)
- Oggenc (Audio Encoder, used for the final encoding)
- MKVmerge (Video+Audio Multiplexer, used for the final encoding)
- HDPMI32 also makes an appearance in this video, but it's a decoy, as is ADLMIDI in this video. The audio produced within DOSBox was discarded, because it was choppy. I recorded and mixed the audio separately.

More source code links:
ADLMIDI: http://bisqwit.iki.fi/source/adlmidi....
JAINPUT: http://bisqwit.iki.fi/source/jainput....
Animmerger: http://bisqwit.iki.fi/source/animmerg...
Hudmaker: http://bisqwit.iki.fi/source/hudmaker...

  • Category

  • License

    • Standard YouTube License


When autoplay is enabled, a suggested video will automatically play next.

Up next

to add this to Watch Later

Add to

Loading playlists...