4

I wrote a Raytracer for DOS, 16 VGA colors

 3 years ago
source link: https://www.youtube.com/watch?v=N8elxpSu9pw&lc=Ugw9uYtPMZ7t1-qfLr54AaABAg
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

I wrote a Raytracer for DOS, 16 VGA colors

812,666 views
•May 24, 2011

130K subscribers

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 https://iki.fi/bisqwit/donate.html) Twitch: https://twitch.tv/RealBisqwit Homepage: https://iki.fi/bisqwit/

Source code: ‣ https://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) ‣ https://bisqwit.iki.fi/jkp/raytrace2.cpp (runs on most OSes, uses OpenMP thread-parallelism) ‣ https://bisqwit.iki.fi/jkp/raytrace3.cpp (runs on most OSes, uses CUDA for GPU parallelism, depends on this header file: https://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: https://bisqwit.iki.fi/source/adlmidi... JAINPUT: https://bisqwit.iki.fi/source/jainput... Animmerger: https://bisqwit.iki.fi/source/animmer... Hudmaker: https://bisqwit.iki.fi/source/hudmake...

Show lessShow more


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK