Check if the camera can see the frontside of a mesh

Hello, I’m looking for a way to check if the camera sees the front or the back face of a mesh.

I know that I can set materials to DoubleSide and make the mesh visible from both sides but I’m working with the USDZ exporter and USDZ doesn’t support back faces so I would like check if faces are visible before exporting and flip them if necessary.

I did try the solution suggested in this thread but it doesn’t quite work. From some angles the approach doesn’t return the correct value for me.

Thanks in advance!