Thygrion sphere ray-casting is damn simple, and the u0=255 and u1=0 case will induce a cascade of subsampling that will solve the pb.
I've not checked if you posted your code, and never touched FreeBasic, but the sub-sampling should test ONLY the primitives found at the 4 corners so it should be pretty fast.
FWIW, I made some RTRT in C/C++ back in the days, around 98, but that was just a bunch of spheres, planes, cylinders and cones