How to obtain whether the current 3D object is blocked by other 3D objects

How to obtain whether the current 3D object is blocked by other 3D objects

When the current 3D object is occluded, I will hide its corresponding CSSLabel

like this:

https://drei.pmnd.rs/?path=/story/misc-html--html-raycast-occluder-st

raycasting is one way, this is what <Html /> does. the code is here: drei/Html.tsx at 26a2d273b1d945e7a5645aaddac4da392007fa97 · pmndrs/drei · GitHub

Determining occlusion [ true, false, partially ] of a 3DObject is not a simple task, certainly not a cheap one. I see in the picture, there 2 spheres. That should make it easy to come up with a function to handle the job.

How the movement of spheres and camera are handled?