1

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.

geometrian
  • 3,036
  • Ooops, you should have mentioned that before I write my answer! :D – Hosein Rahnama Oct 16 '15 at 22:58
  • @H.R. I assume you mean the part about $m<0$. This was in the question 15 minutes before your answer appeared, but I did edit afterward to make it more prominent. :D – geometrian Oct 16 '15 at 23:16
  • You can check my new answer now. – Hosein Rahnama Oct 17 '15 at 11:54
  • @H.R. Unfortunately, $|m|$ can be up to $\approx 10^5$, $\approx 10^6$, so doing a brute force partial fraction expansion isn't really practical. I've been trying different approaches myself before I decide what to do. Have a +1 for your work so far, though. – geometrian Oct 17 '15 at 16:35
  • I will think through other methods and let you know if any comes to mind. :) – Hosein Rahnama Oct 17 '15 at 17:02

1 Answers1

1

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! :)

  • I think partial fractions here are more complicated than you think. Also, this substitution is problematic because it integrates over two discontinuities in $tan$. Try subbing the limits of integration, for example. – geometrian Oct 17 '15 at 19:40
  • You are right! :) – Hosein Rahnama Oct 17 '15 at 19:59
  • Is the constant $D$ restricted in any ways? :) I am trying to figure another strategy of solution. – Hosein Rahnama Oct 17 '15 at 20:31
  • $D:=(\cos(a)\cos(p)+1)/(\sin(p)\sin(a))$, where $0<a,p<\pi/2$. Therefore, $D$ must be a positive real number. – geometrian Oct 17 '15 at 21:38
  • and also greater than one! right? I think I am close to find some closed form solution. – Hosein Rahnama Oct 17 '15 at 22:16
  • Huh yeah, I guess you're right $D>1$. :) Be ye warned, I've thought I was close on this problem several times before too. But 9 pages of work and I still don't have it, so . . . – geometrian Oct 17 '15 at 22:20
  • See the new answer. :) – Hosein Rahnama Oct 17 '15 at 23:06
  • What is your idea about the new answer? :) – Hosein Rahnama Oct 18 '15 at 08:21
  • 1
    I'll take it, since it's better than what Mathematica produces (and contrastingly I know how this one works). The cosine integral isn't really easy, though. N.B. I have posted a bounty (real money!) for a fully closed-form solution. Perhaps considering it in the context of the original problem makes it easier. – geometrian Oct 18 '15 at 16:48
  • You can find cosine integral in books like Mathematical Hand Book of Formulas and Tables by Spiegel. Good Luck! :) Let me know if any other things appeared as the solution. :) – Hosein Rahnama Oct 18 '15 at 16:53