To atone for my sins, I also wrote a (free, online) 3D rendering textbook, half of it dedicated to raytracing: http://www.gabrielgambetta.com/computer-graphics-from-scratc...
https://twitter.com/Peter_shirley/status/1029342221139509249
var lightPoint = scene.lights[0];
this should be var lightPoint = scene.lights[i];For those interested in a gentle introduction to those underlying ideas, including a refresher on the required math, I taught a class on how to implement a ray tracer. All the materials are available: https://avik-das.github.io/build-your-own-raytracer/
I kept variable names roughly the same in order to make it easy to compare the JS version to the Python version. I also translated vector.js to python (for the same reasons), even though you could probably just use numpy directly.
Here are output images: http://renderer.ivank.net/balls.jpg http://renderer.ivank.net/cornell.jpg
I also made a version with triangle models: http://3dtool.ivank.net/ :)
https://www.pcper.com/reviews/Processors/Ray-Tracing-and-Gam...
And a bit more recent writeup:
https://pharr.org/matt/blog/2018/05/27/nvidia-bound.html
Many of the Demoscene demos today use ray marching. Here are some examples of ray marching in WebGL, to show what's possible (and probably inevitable) in the next 5-10 years:
However, they don’t allow you to structure the program however you might like independently the need order and _nesting_ of code. In a lot of cases you can get around this through appropriate design patterns.
I’ve recently taken a quite deep dive into possible tools for literate programming. I work with signal processing so code documentation is extremely important but also frustratingly challenging.
There are a lot of “old” tools for literate programming (noweb, FunnelWeb), and they all lack in platform support, but are exceptionally stable and quite pleasant to work with. The more modern “true” literate programming tools are typically using a form of markdown (no links since my notes are not at hand). The last group are the “coffee script style” tools and they seem to be quite popular and active.
It seems to be a case of natural selection for tooling: true literate programming is serverely disadvantaged in terms of IDE/editor support and the programming philosophy is, unfortunate, too different from the norm. Docco styles seems highly pragmatic in contrast.
One option I haven’t tried yet is Emacs’ org-mode which includes true literate programming support. I haven’t found much with regards to real-world usage.
I like that it is markdown and that it has a many-to-many mapping of input to output files.
Then, if desired, one could read the code and/or narrative straight through.
I think if I had better examples like this to follow I would've gotten a lot farther.