Skip to content

Implementation of the "Ray Tracer Challenge" in Rust, with additional parallelism

License

Notifications You must be signed in to change notification settings

64kramsystem/ray_tracer_challenge-completed

Repository files navigation

Ray Tracer Challenge Completed project (in Rust)

My completed Ray Tracer Challenge project, written in Rust.

Overall design

The project has been written with the intention to produce good code, so the design is overall clean and simple.

The APIs (and test suites) are similar, but not equal to the book ones; at the beginning, I thought refactoring made sense, although later I realized that for comparison purposes, matching the book structure would have made comparisons easier.

The most significant difference is that this project's renderer is parallel, therefore, significantly faster than the book reference.

Two functions are unsafe; this has been necessary in order to make the objects tree mutex-free (which allows full parallelism); this unsafe problem has been discussed on the Rust Programming Language Forum, and there is no trivial/safe solution.

A change that would simplify the design is to convert the Shape trait into a base class; this is discussed on the trait comment. Also, it would be more readable just to have the owned version of the Matrix/Tuple operations, with a borrowed one for the exceptional cases.

The project is divided in library, macros and practice.

Demo renderings (from the last chapters)

Chapters 1-13: Shapes and properties
Chapter 14: Groups
Chapter 15: Triangles/WaveFront OBJ format
Chapter 16: CSG

About

Implementation of the "Ray Tracer Challenge" in Rust, with additional parallelism

Topics

Resources

License

Stars

Watchers

Forks