R_ComputeFogNum in F#. (not tested)