Defining a View Transformation

Right now, all of your rendered images have been painted on a fixed “screen” that you’ve cast rays at. This works, as you’ve seen, but it’s very difficult to move that screen around. Suppose you wanted to render a picture from some point above and to the right of an object. How would you orient the screen so you could still look at that object?

This is what a view transformation will do for you. It’s a transformation matrix—like scaling, rotation, and translation—that orients the world relative to your eye, thus allowing you to line everything up and get exactly the shot that you need.

Now, although the transformation actually orients the world, it’s often far easier to imagine that it moves the eye. Moving a ...

Get The Ray Tracer Challenge now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.