I am trying to make the Blinn-Phong BRDF conserve energy exactly. During the course of this, I have reduced part of the problem to the following integral ($D$ and $m<0$ are constants w.r.t. the variable of integration):$$
I = \int_0^{2 \pi} (cos(\theta)+D)^m d \theta
$$This turns out to be a surprisingly difficult integral. WolframAlpha, for example, gives a mess for the indefinite integral, and doesn't even output anything for the definite integral.
How can I solve this?
Please note: as above, $m<0$. Also, while ideally $m$ is a real number, making $m$ an integer is an acceptable restriction.
Answer
In my calculations, I replaced $m$ by $\alpha $ since it is more like a real number! We have these assumptions only
$$\begin{align}
& D,\alpha \in \mathbb{R} \\
& D>1 \\
\end{align}$$
First of all you can simplify your integral a little
$$\eqalign{
& I = \int_0^{2\pi } {{{\left( {\cos \theta + D} \right)}^\alpha }d\theta } = \int_{ - \pi }^\pi {{{\left( {\cos \theta + D} \right)}^\alpha }d\theta } \cr
& \,\,\, = 2\int_0^\pi {{{\left( {\cos \theta + D} \right)}^\alpha }d\theta } = 2{D^\alpha }\int_0^\pi {{{\left( {1 + {{\cos \theta } \over D}} \right)}^\alpha }d\theta } \cr}\tag{1} $$
Now I make use of the binomial series
$$\begin{array}{l}
{\left( {1 + x} \right)^\alpha } = \sum\limits_{n = 0}^\infty {\left( {\begin{array}{*{20}{c}}
\alpha \\
n
\end{array}} \right)} {x^n}\,\,\,\text{which uniformly converges when}\,\,\,\,\left| x \right| < 1\\
\left( {\begin{array}{*{20}{c}}
\alpha \\
n
\end{array}} \right) = \frac{{\prod\limits_{i = 0}^{n - 1} {\left( {\alpha - i} \right)} }}{{n!}} = \frac{{\alpha \left( {\alpha - 1} \right)...\left( {\alpha - n + 1} \right)}}{{n!}}
\end{array}\tag{2}$$
considering this we can write
$${\left( {1 + \frac{{\cos \theta }}{D}} \right)^\alpha } = \sum\limits_{n = 0}^\infty {\left( {\begin{array}{*{20}{c}}
\alpha \\
n
\end{array}} \right)} {\left( {\frac{{\cos \theta }}{D}} \right)^n}\tag{3}$$
but (3) converges uniformly for all $\theta $ since $D>1$ and hence the condition for uniform convergence $\left| {\frac{{\cos \theta }}{D}} \right| < 1$ is satisfied identically. Uniform convergence of (3) let us to integrate it term by term. Accordingly, we can write
$$I = 2{D^\alpha }\int_0^\pi {\left[ {\sum\limits_{n = 0}^\infty {\left( {\begin{array}{*{20}{c}}
\alpha \\
n
\end{array}} \right){{\left( {\frac{{\cos \theta }}{D}} \right)}^n}} } \right]d\theta } = 2\sum\limits_{n = 0}^\infty {\left[ {\left( {\begin{array}{*{20}{c}}
\alpha \\
n
\end{array}} \right){D^{\alpha - n}}\left( {\int_0^\pi {{{\cos }^n}\theta d\theta } } \right)} \right]}\tag{4}$$
Again I repeat that interchanging summation and integration in (4) holds due to the uniform convergence of the binomial series. I just leave the computation of ${\int_0^\pi {{{\cos }^n}\theta d\theta } }$ for you which is not a hard task to carry out. I think it is the best you can obtain for this!
Cheers! :)
No comments:
Post a Comment