3 ms·
Over decades I've written a scanline renderer, a ray tracer, a radiosity renderer, and a DirectX game engine. Both ray tracers and the related ray-based radios
by jiggawatts 4y ago
Over decades I've written a scanline renderer, a ray tracer, a radiosity renderer, and a DirectX game engine.
Both ray tracers and the related ray-based radiosity renderers are so simple that I wrote one of the latter for fun in a mandatory IT training class using JavaScript in a browser because the locked-down training PCs had no dev tools. I used literally Windows Notepad and got a nice looking Cornell box within a few hours.
However, what bugs me to a visceral level is how "against the grain" the performance of random sampling is. It's mathematically beautiful, a simple application of Monte Carlo integration, but from a computer engineering perspective it is hideous. Random unbiased sampling produces "reference grade" images but only through tremendous brute force to suppress noise from things like caustics or textured reflective materials. Biased sampling always introduces complex, unpredictable errors into the final render, which makes me feel "itchy" for the want of a better word.
Then to layer insult onto injury, random memory access patterns are murder to every modern CPU and GPU cache hierarchy design. You get the worst case performance of uncached RAM reads for every sample. Working around this takes heroic effort of complex acceleration data structures, "sorting & bundling" of rays, and more. To this day, it is effectively an unsolved problem, albeit NVIDIA has had some really impressive progress lately.
E.g.: https://www.youtube.com/watch?v=MUDveGZIRaM https://www.youtube.com/watch?v=MUDveGZIRaM
Some examples of how there's still a lot of fundamental research being done in the 2020s for rendering caustics efficiently: https://www.youtube.com/watch?v=2qqDwaZlkE0 https://www.youtube.com/watch?v=2qqDwaZlkE0