Is there a blazingly fast library for ray object intersection? Ideally usable from python? As I understand, ShaderToy uses implicit object description, and calculates ray object intersection numerically. It is somewhat of a abuse of OpenGL, since a scene in ShaderToy only has 2 triangles covering the screen, and the rest is calculated using pixel shader which calculates ray object intersections. I would like to have result of this intermediate calculation (point of ray object intersection).
NVidia's Optix has very fast ray-object intersection via GPU. I don't think there are python bindings though, it's C++ and CUDA.
ShaderToy doesn't come with object descriptions, nor with any specific intersection routines. This is just arbitrary glsl (GPU) code that people are doing cool tricks with. You can do regular ray tracing in ShaderToy, for example here's one of mine ray tracing (not ray marching) spheres: https://www.shadertoy.com/view/XllBRf
You don't get a BVH with ShaderToy, unless you manually write something clever yourself. You need a BVH to make blazingly fast ray object intersections, in general.
That said, it's worth understanding the ray marching algorithm that many folks on ShaderToy are using, because it's very very fast, if you can accept the limitations it comes with, and it does give you the hit location in space.
There's Embree, but I don't know (or think) they would have thought to make Python bindings. I'm not sure how fast Mitsuba is, but since Wenzel wrote his own C++ to Python wrapper I'd wager that there are Python bindings for that.
I have to second the mention of Embree. Intel poured several man years of optimization into this code. As long as you are fine with being restricted to x86 platforms, you won't find faster open source code for general ray/triangle intersection.
I want to make simple FDTD mesher, maybe with non rectangular grid. For this I would need ray-object intersections and point to object shortest distance. Thanks for pointing out Embree, I was not familiar with that library.
I don't know if you can consider it blazingly fast, but Blender has ray intersections from Python, and IIRC it was fast enough to make a 256x256x256 voxel grid in a couple of seconds with raycasts.