How to do integration over a unit sphere with 3 independent vectors? I got this equation I want to integrate over a sphere:
$min( max(-vSurfaceToCameraDir \cdot (vLight + vNormal * A), 0), 1 )^B$
A & B are constants and vSurfaceToCameraDir, vLight & vNormal are unit vectors that can point in any direction. If A=0 this could be expressed as $\int_{0}^{2π}{\int_{0}^{π/2} cosθ^Bsinθ \,dθ}\,dφ$ which would add up to π/(B + 1). However with vNormal there's a 3rd independent vector and I'm not sure how to proceed.
Is there some analytical way to compute this? If not I suppose I can do a numeric integration by making lots of random samples but I thought there might be some more elegant & faster way.
 A: Let $T \left(s\right) = \min  \left(1 , \max  \left(0 , s\right)\right)$ and $\overrightarrow{w} =-\left({\overrightarrow{v}}_{\text{light}}+A {\overrightarrow{v}}_{\text{normal}}\right)$. Assuming we want the integral
\begin{equation}
I = \int_{{S}^{2}}^{}T \left({\left(\overrightarrow{{\xi}} \cdot  \overrightarrow{w}\right)}^{B}\right) d \sigma(\overrightarrow{{\xi}}) = 2 {\pi} \int_{0}^{1}T \left({\left|w\right|}^{B} {s}^{B}\right) d s
\end{equation}
If $\left|w\right|  \leqslant  1$ we have
\begin{equation}
I = 2 {\pi} {\left|w\right|}^{B} \int_{0}^{1}{s}^{B} d s = \frac{2 {\pi} {\left|w\right|}^{B}}{B+1}
\end{equation}
If $\left|w\right|  \geqslant  1$ we have
\begin{equation}
\renewcommand{\arraystretch}{1.5}  \begin{array}{rcl}I&=&\displaystyle  2 {\pi} {\left|w\right|}^{B} \int_{0}^{1/\left|w\right|}{s}^{B} d s+2 {\pi} \int_{1/\left|w\right|}^{1}d s\\
&=&\displaystyle  \frac{2 {\pi}}{\left(B+1\right) \left|w\right|}+2 {\pi} \left(1-\frac{1}{\left|w\right|}\right)
\end{array}
\end{equation}
