For my undergrad optics class I am taking we have to select final projects to work on for second half of the semester. I have spent the last few weeks working on my own project which was a GPU accelerated Barnes-Hunt tree N-Body simulator. I was wondering if I could use a similar idea but for photons. I would put "light sources" in my simulation and emit "photon" particles. I would probably want to simulate billions of these photons. They could bounce off of mirrors and diffract through lenses and be absorbed by a screen.

I am fairly certain this would work well for plain geometric optics, however, I would like to find a way to incorporate the wave properties of light into this simulation so I can form interference and diffraction patterns. I think I can do the interference by having each photon keep track of its phase / path difference as it propagates since the length of the path is easy to track. Then all the photons which strike the same cell on the screen will have their electric fields added together so they interferer with each over. What I am wondering about is what would be a good way to model diffraction? I can't think of a way to generate realistic diffraction patterns given that I am modelling particles and not plane waves. Does anyone know of a method?

I would rather do something a little more physical though than just knowing what a diffraction pattern should look like forcing the rays to conform to that pattern. For instance in my gravitational N-Body sim I only use Newtonian gravity and I can get a galaxy without hard coding it so long as I have the correct initial conditions.

I am also open to other ideas than just random statistical photon ray tracing. I think it would be interesting if I could just straight up model the waves with Maxwell's equations. I looked into doing finite difference analysis but I think you would need a grid cell size on the order of optical wavelength, and for modelling large optical set-ups on the size of meters a 3D grid with nano-meter cells would consume peta-bytes of memory.

  • $\begingroup$ If you want to capture diffraction, then you have to model either the full set of Maxwell's equations, with is much harder than it sounds, or you have to do, at least, a Huygens-Fresnel approximation: en.wikipedia.org/wiki/Huygens%E2%80%93Fresnel_principle. Either way you are going to end up with a much more complex problem than for an n-body problem, so you should look at existing literature on how to implement scalable algorithms, otherwise you aren't going to get beyond trivial sized problems. $\endgroup$
    – CuriousOne
    Feb 24, 2016 at 6:02
  • $\begingroup$ it seems you are trying to do ray tracing. When you're done, you'll be ready for Pixar! $\endgroup$
    – scrx2
    Feb 27, 2016 at 21:21

1 Answer 1


Using an Eulerian simulation (i.e. grid) while nothing interesting happens in the free air would be overkill (+ the resolution required).

The particle based approach + phases looks more reasonnable, and is quite similar to what is done with the path tracing method in image synthesis (without phases). Still such a Monte-Carlo integration of the paths is ultra-slow to converge (i.e. to a not-noisy image). Suggestion: doing it in 2D, not in 3D.

If you really want to try a grid, why not simulation a water surface, or sound in 2D ? wavelengthes would be more tracktable.

  • $\begingroup$ Well it is for an optics course. I know I can handle all the geometric optics but I just wanted to support wave features. The project is somewhat open ended so I think I will start with geometric and work up to diffraction. $\endgroup$
    – chasep255
    Feb 24, 2016 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.