I'd like to simulate the magnification of very distant objects by the lensing effect of a less distant galaxy. Will I need to model large numbers of point masses or can I get away with just a single average point mass?

I can see how to raytrace using hyperbolae for the rays influenced by a single point mass, but I wouldn't know where to begin with multiple point masses. So before I attempt to build this raytracer I'd like to know whether I'm going to be able to avoid multiple masses, and still have believable results.

  • 2
    $\begingroup$ This might be a better question for Physics.SE or Astronomy.SE. I know a point mass does produce lensing effects (see e.g. this) but no idea if a galaxy can be well-approximated by a point mass for something like this. $\endgroup$ Aug 28, 2015 at 5:40

1 Answer 1


As you have probably observed, in general, you cannot solve in closed-form the equations for ray trajectories around multiple distorting objects.

The standard approach for such things is just to discretize it. This looks like Eulerian integration. Just step your ray a little bit toward the object, calculate gravity from all sources and bend it, then step it more, und so weiter. This is called raymarching.

Since you're interested in problems on an astrophysical scale, you can assume the ray is linear far enough away from the object, with minimal error.

Here's a scene I rendered a while ago using a homebrew photonmapper (no QMC) using this raymarching technique.

I present: relativistic photon mapping: black hole in a Cornell box! black hole in a Cornell box


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.