Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am adding 3D affine transformations to my ray tracer, and it seems all the literature on the web recommend inverse transforming the ray instead of transforming the 3D objects.

Why is that? There are a lot more rays than objects in a typical ray tracing scene, so wouldn't it be more efficient to transform the objects themselves?

share|improve this question
up vote 7 down vote accepted

In a typical raytracer, you are not just raytracing triangles and vertices, but various implicit surfaces. Each has their own associated hit test. In general, it's a lot easier to just inverse transform the ray than to modify every specific hit test.

share|improve this answer

The number of vertices that would require transforming may be higher than the number of rays. I haven't written a raytracer so I wouldn't know, but all I'm saying is that the number of distinct objects is irrelevant- only the number of verts.

share|improve this answer

Another point to mention, is that sometimes complex objects have much more than just geometry. They could also have spatial partitioning data such as kd-trees or bsp-trees for accelerating intersection tests. Imagine a high polygon spaceship fying through space. The spatial partitioning data is constant in the local frame, but not in world space. Transforming rays to object space means that these extra data do not need to be precomputed every frame.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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