I think you can use the “normal” and “incoming” outputs of the geometry node for this:
Apparently, this is the formula for the “facing” output: