New demo uploaded: Basic Raytracer
Posted: Thu Dec 10, 2020 6:42 pm
Basic Raytracer
View File
Raytracer in Basic with a sphere and its shadow, and a plane with a pattern.
Originally written for C64 with Simon's Basic and published 1986 in german magazine c't (issue 1, page 104).
According to the article it took 3 to 4 hours on a c64. It's much faster on a x16, but nevertheless use warp mode.
I changed the following compared to the original code:
I added alternative plane pattern formulas in the lines 110 to 220 (4 patterns; just [un]comment the according lines)
I added lines 1205, 1206 and 1615 to read the input from data statements instead of user input
I changed the graphic commands (screen, line, pset)
from line 2000 and on I added the data for the objects
line 2010: the sphere (x, y, z, radius) and the position of the lamp (x, y, z); same for all pictures
followed by individual data per picture (5 pictures; just [un]comment the according lines for the others)
coordinates of camera (x, y, z) and viewing vector (x, y, z); e.g. lines 2064 and 2065
aperture angles (horizontal, vertical); aspect ratio already adapted to X16; e.g. line 2066
line 2080: data for the view; same for all pictures;
coordinates of top right corner (x, y)
coordinates of bottom left corner (x, y)
view window size (width, height)
Press "S" for a quick sketch or "D" for the real stuff ...
On demand I could share more info from the article content.
Tested with R38
Enjoy!
Submitter
Submitted
12/10/20
Category