Brandon Eleuterio

Tag: software

Learning Rust – Part 13: The Final Render

Random Spheres

In the last post, we added the last feature of the series – defocus blur or depth of field. In this final post of the series, we’ll render a random scene that fully demonstrates the features of our ray tracer. The Masterpiece Behold! A randomly generated scene of spheres with a variety of sizes and […]

Learning Rust – Part 12: Depth of Field

depth of field

In the last post, we added the ability to position our camera. This time we’ll add code for focus, or rather the ability to blur objects that are not in focus. Here we go In order to handle “depth of field”, we need to pass two more parameters into our Camera constructor: aperture – the […]

Learning Rust – Part 11: Positionable Camera

Zooming In

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 […]

Learning Rust – Part 10: Dielectrics

Glass Sphere

In the previous post, we implemented a trait called Material which we used to render metallic spheres. This time, we’ll create a new struct called Dielectrics which implements the Material trait and renders glass spheres. Fairly Straightforward…Sort Of Nothing too tricky with this concept, we just had to implement a refract() function as opposed to […]

Learning Rust – Part 9: Metal Spheres

Shiny Metal Spheres

In the previous part, we covered diffuse materials and lighting for our spheres. Now we take it a step further by adding a metallic look. Traits and Reference Counting Pointers I’m starting to get more comfy with inheritance and shared pointers in Rust. Using a trait called Material, a struct can be created that implements […]

Learning Rust – Part 8: Diffuse Materials

Lambertian Diffuse

In Part 7, we smoothed out the edges of our spheres using antialiasing. In this chapter, we start making these spheres look a little more realistic. Speed Bump After adding initial diffuse properties to the spheres I noticed a severe slowdown in execution time. I mean we’re talking over 5 minutes to complete the render […]

Learning Rust – Part 7: Antialiasing


In Part 6, we drew two spheres on the screen, but the edges of the images were rough and jagged. In this part, we’ll smooth out the edges with some antialiasing. Zoom In It might be hard to notice the jagged edges from the image we rendered in Part 6, so let’s zoom in and […]

Learning Rust – Part 6: Multiple Spheres

A two sphere world

Last time we added some dimension to a sphere. In this go around, we’ll add support for multiple spheres and lay the groundwork for supporting glass spheres. A Bigger World So far our one-sphere world is boring. In order to spice things up, we need a way to draw multiple spheres. In order to do […]

Learning Rust – Part 5: Sphere Surfaces

3D sphere

In Part 4 we drew a sphere. This time we’re giving the sphere surface normals. Normals are things like shading and lighting that make the object look more three-dimensional. Bug in a Hay Stack This one was a doozy! After I whizzed through coding everything in this chapter, I realized in my haste I had […]

Learning Rust – Part 4: Drawing a Sphere

Red sphere

In the last post, we drew a blue and white blended rectangle. In this post, we’re continuing our focus on foundational steps by adding a sphere to that rectangle. A Sphere! Admittedly, it sort of resembles the flag of Japan, but it’s actually great progress. Drawing a single object with our ray tracer demonstrates how […]

Back to top