The Secret Life of Photons: Simulating 2D Light Transport
benedikt-bitterli.me
benedikt-bitterli.me
I saw a talk about four years ago on using one ray from the light source to a point (through a complicated scene) to efficiently find lots of nearby paths. The idea was to use 'fireflies' to find other rays and so light the whole area accurately. This allowed them to efficiently render scenes where the light source was very indirect, light the light in another room lights your dark room through the open doorway but most of the light from the source never makes it anywhere close to our scene. It was all a clever application of the inverse function theorem, in a sense.
I'm reminded of it mostly because they had a wonderful demonstration in 2D where you could drag a light path through a scene of a bunch of dielectric lenses, etc and have it find a nearby path matching how you dragged it. Was very fun to see the paths so clearly.
Wenzel was actually one of my thesis advisors, and his tool was the inspiration behind this project. :) I was writing an implementation of Manifold Walks out of personal interest and reproduced his 2D tool for debugging purposes. Eventually I realized that caustics in 2D actually look kinda neat, so I spent some time doing research and then fleshed it out into this article + demo.
Any way, great work, and beautiful demo! I've spent more time playing with it now than I should have, and work is suffering for it. I regret nothing! :o)
I wasn't able to implement an acceleration structure in WebGL, so the amount of primitives it can trace in real-time are quite limited, and all scenes had to be hardcoded in GLSL. This makes modifying scenes a real pain, since adding a new primitive amounts to generating and compiling new shader code.
The original C++ version just constructs the scene from very small (~1px long) line segments and then builds a BVH acceleration structure over them, so you have practically unlimited freedom in the type and number of primitives. Unfortunately traversing a BVH inside a shader in WebGL is almost not doable, so I had to improvise.
This is beautiful work. Especially the write-up. I think we all understand the urge to code, but your desire to take the next step and describe what you've done is fantastic. Thanks for the gift.
This reminds me of those optics tables you see in museums, in the hands-on section for kids. Where they'll have a table with a rectangular inset, and in it will be light sources and prismatic pieces of Plexiglas that you can move around. You see the light tracing paths and scattering.
I've played with these setups and find them disappointing. If these museums instead had tables with touch displays, they could run software like yours. Of course they could also run other apps and anything that runs on a phone, so maybe that ruins the whole "this is special because it's in a museum" feel.