Nerd level is pretty high here, where Albert Szostkiewicz gives a detailed walkthrough of how to create a raytracer in Houdini using Vex Operation Networks or VOPs which can define a shader.
this may give you a very in-depth understanding on how raytracers works, and let you discover few tips and tricks in Houdini
Creating an Interactive ray tracer which is made completely out of VOP Nodes, with no scripting or coding Albert Szostkiewicz notes that he did this for fun and experimentation. Pretty cool stuff actually.
Albert has multiple posts on his blog covering the tutorial for creating a raytracer in Houdini using VOP nodes here.