Neat stuff! I was at a similar point in my career when I wrote my first raytracer. I'd been using povray for years, and used javascript (circa 2003, we didn't even have canvas yet) because it amused me. It took a couple of minutes to render a classic "sphere on checkerboard" scene.
Writing a raytracer is a great exercise for a keen algebra student with decent programming chops. But I'm even happier to see it as a personal project than as homework.
For the latter, I have made it a pretty good way through the book, implementing a functional (in the programming paradigm sense) version of the ray tracer in F#. It’s actually rather mind boggling how close the F# code and tests are to the psuedocode found in the book.
Nice work. If you want to get to the next level, I suggest reading the code for the 100 LoC path tracer at https://www.kevinbeason.com/smallpt/ and reimplementing it yourself. You can also read http://www.pbr-book.org/ for an in depth understanding of ray tracing.
I'm getting a bit bored of all the raytracer content on hn. I suppose my problem with it is none of it is especially creative, it's kinda the same maths rendering the same sort of things, except maybe in a different programming style or language.
6 comments
[ 3.2 ms ] story [ 19.7 ms ] threadWriting a raytracer is a great exercise for a keen algebra student with decent programming chops. But I'm even happier to see it as a personal project than as homework.
Ray Tracing in One Weekend: https://www.amazon.com/dp/B01B5AODD8/
The Ray Tracer Challenge: https://www.amazon.com/dp/1680502719/
For the latter, I have made it a pretty good way through the book, implementing a functional (in the programming paradigm sense) version of the ray tracer in F#. It’s actually rather mind boggling how close the F# code and tests are to the psuedocode found in the book.
https://github.com/bmitc/the-ray-tracer-challenge-fsharp
I implemented a ray tracer with Kotlin just to learn the language, and got to use many features and learn them by practice.
Even finding and fixing bugs were fun, as I had to guess where the physics of the light had gone wrong.
https://imgur.com/a/OuVrxbC