2 ms·
Well, that's the best part of it: the underlying physics model is really easy! A pinhole camera requires zero additional physics, just a simulation of light ra
by crote 3y ago
Well, that's the best part of it: the underlying physics model is really easy!
A pinhole camera requires zero additional physics, just a simulation of light rays passing through a small hole. A lens just requires Snell's Law - which is pretty much trivial. Adding dispersion is just a matter of using a formula instead of a constant for the refractive index of the lens, and doing the raytracing using random wavelengths instead of a single "composite" one.
Raytracers capable of doing this are implemented in a few hundred lines of code as a toy project. The difficult part is getting it to render quickly - and of course modeling the scene properly.