r/shittyprogramming • • Jul 18 '20

super approved Raytracer written in bbc basic

380 Upvotes

21 comments sorted by

View all comments

Show parent comment

14

u/quadrillio Jul 18 '20

So I’m actually a chemistry student with no background in computer graphics, but about 10 years experience writing code in basic. but being a gamer I became very interested in how cgi is done and with covid sweeping the world I suddenly had weeks to kill. I spent a lot of time researching and teaching myself how raytracing works and the maths behind it. Quite simply the program fires vectors into the scene and computes their intersection with objects. It then sends out new vectors towards light sources and if those vectors intersect more objects then the original point is in shadow. It sends ‘rays’ for every pixel and after a few minutes you get an image.