If you want a deep-dive into the mathematics as well, I really liked Ray Tracing from the Ground Up by Kevin Suffern [1]. The book focuses on the theory and mathematics of ray tracing, and uses C++ to build a ray tracer. The code however is simple and explained really well so you could adapt it to the programming language of your choice.
[1] https://www.oreilly.com/library/view/ray-tracing-from/978149...