Alan's 3D renderings!

These are some animations I made after reading The Ray Tracer Challenge. My code is in rust but the book is not language dependent.

Looping animations

Ball rolling down infinite quarter pipe

This uses Constructive Solid Geometry to create quarter pipe. It's one cylinder subtracted from a larger cylinder. Two cuboids at ±45° are subrated to keep just a quarter of the pipe. Then a sphere is subtracted to give that nice round edge. Each subtraction gives the oppotunity for a new material to be used which is how the different colors are achieved.

The trick here to make it loop perfectly was to calculate a progress in the range [0..1) like so; if you have 1-based frame numbers, frame_no - 1 / frame_count, and use this for anything that needs to loop its position.

Injection molded Chess Queen factory

This uses an Obj file for the Queen, and uses Constructive Solid Geometry to create the two halfs of the mold (the Queen is subtracted). The animation is actually 4 distinct stages repeated twice, black and then white; stages are fill, release, move accelerate, move decelerate and close mold. This allowed me to focus on each stage independantly and still render the whole thing in one go at the end.

Physics

Using the rust crate Rapier

The same scene plotting the linear velocities to a gradient scale.

< 1 m/s grey, 3 m/s green, > 10 m/s red