This is a simple brute force raytracer based on the excellent book "Ray Tracing in One Weekend" It will take approximately 2 hours to render the image in the preview! The slowness is mostly caused by there being no form of object hierarchy so every single sphere is being test for every single ray generated. There's a lot of sphere's so that's a lot of calculations.
The ray tracer produced by following Ray Tracing in One Weekend is really simple and straightfoward, as a result I think this is a great cart to look at if you want to get a handle on Ray Tracing. You probably don't want to run the cart as is but nick the code and play around with a scene yourself.
If you look at the end of the code it should be pretty clear how the scene is described (simply adding sphere's to the things table). There is also the "fast" option. If you set that to TRUE then the pico8 will switch to 64x64 mode and only do 1 sample per pixel. It's a great way of making sure you have setup a scene correctly before doing a longer render.
Finally I have also implemented checkerboard material as well called CHECK which does black and vec(r,g,b) colour of your choice squares.
I aim to improve this cart somewhat before moving into the next book (Ray Tracing the Next Week): the main thing is to improve the colour mapping. At the moment I simply map to the closest Pico8 colour from the default palette in RGB space. I'd quite like to pick a best possible monochrome (or at least two 8-colour monochrome palettes) to produce smoother images as some of the colour transitions are quite jarring at the moment
[Please log in to post a comment]