Distance to bounding_box in Metal ray tracing

I wonder if there is an easy way of getting the distance to ‘bounding_box’ primitive from ‘raytracing::intersector’ function.

As I figured (though this is not very clear from the docs) if you provide no intersection function for ‘intersector.intersect’ it won’t detect any intersections even with opaque primitives or ‘force_opacity(opaque)’.

So if you need to just get a distance to a bounding box primitive in your scene, you have to implement some intersection logic in an intersection function since ‘distance’ parameter is only available for ‘triangle’ primitive. And this is not very cheap.

Am I getting it right and there is no way of getting the distance to a bounding box primitive directly from Metal?

Distance to bounding_box in Metal ray tracing
 
 
Q