Skip to content
0:00 / 0:00

#raytracing#dithering#dos

I wrote a Raytracer for DOS, 16 VGA colors

Bisqwit

147K subscribers • 9 videos on Hallway

YouTube
  • Recommended by 2 people: 2 on Hacker News.
  • Presented by Bisqwit

Advanced. Deep dive for people who know the field.

905K views15 years ago2 recommendations

Graphics and audioSystems programmingRenderingC++Retro computing

Bisqwit writes a C++ raytracer from scratch for DOS, rendering in a 16-color VGA palette using ordered dithering.

In this tool-assisted education video I create a raytracer from scratch. The raytracer renders in 16-color VGA palette at 640x480 resolution. Twitter: twitter.com/RealBisqwit Patreon: patreon.com/Bisqwit (alternatives at iki.fi/bisqwit/donate.html) Twitch: twitch.tv/RealBisqwit Homepage: iki.fi/bisqwit/ Source code: ‣ 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) ‣ bisqwit.iki.fi/jkp/raytrace2.cpp (runs on most OSes, uses OpenMP thread-parallelism) ‣ bisqwit.iki.fi/jkp/raytrace3.cpp (runs on most OSes, uses CUDA for GPU parallelism, depends on this header file: 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 to , 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 (Vi

Why it's here

2 people recommend this

What people say. Highly recommended as a masterclass in retro programming, graphics rendering, and dithering techniques.

petercooperon Hacker News • Recommends

On “Let’s Create a Speech Synthesizer in C++17 [video]”

Agreed. My favourite programming YouTuber by a long stretch. If anyone is unfamiliar with him and wants to watch some of the "classics" I'd recommend these: His "cracking videogame passwords" series: link Creating a Doom-style 3D engine in C: link Creating a Rogue-like game in C++11: link Creating a PIC16 emulator and NES music player: link Creating a NES emulator: link Creating a DOS VGA raytracer: link to this video

pdkl95on Hacker News • Recommends

On “Ditherpunk: The article I wish I had about monochrome image dithering”

…oll-Yliluom positional dithering" changed my understanding of what was possible with a 256 color palette. The animation even looks decent2 dithered all the way down to a 16 color palette! If that wasn't crazy enough, he also "live codes" a raytracer3 in DOS that "renders in 16-color VGA palette at 640x480 resolution." 1 link 2 link 3 link to this video…

themodelplumberon Hacker News • Mentions

On “Show HN: E3Dos – A 3D engine I wrote when I was a teen”

Wow that's really cool. I liked the structure you added to the Martian landscape. It was funny to wake up and see this on HN, as I was watching something DOS and 3D-related on Bisqwit's channel last night. link to this video