In the previous post, we rendered a glass sphere. In this part, we venture into the world of camera positions.
Simple Code
We added several key parameters to our Camera struct to manage positions:
- look_from – the point from which the camera looks.
- look_at – the point the camera is pointing towards.
- vert_up – the roll or sideways tilt of the camera around the look_from – look_at axis.
- vert_field_of_view – the vertical aspect ratio.
We also consolidated the remainder of the camera code and moved it from main.rs into the camera.rs file. Check out a few of the options this code gives us:
Wide Angle

Rotation at a Distance

Zooming In

Up Next, Defocusing
Now that we’ve tightened up our camera code, there’s one more piece to address – defocus blur, otherwise known as depth of field. That’s next time. Until then, feel free to peek at the code and follow along with the online book I’m using for this project, Ray Tracing In One Weekend.
Tags: coding rust software