**Homework 3** Student name: Cedric Hölzl Sciper number: 257844 Monte Carlo Sampling (60 pts) ============================= Tent ---- $$ p(x, y)=(p_1(x)\text{,} p_1(y)) \\ p_1(t) = \begin{cases} 1-|t|, & -1\le t\le 1\\ 0,&\text{otherwise}\\ \end{cases} \\ P_1(t) = \begin{cases} 1, & t \gt 1\\ \frac{1}{2}(t+1)^2 + 1, & 0 \le t \le 1\\ \frac{1}{2}(t+1)^2, & -1 \le t \lt 0\\ 0, & -1 \gt t\\ \end{cases} \\ P_1^{-1}(t) = \begin{cases} \sqrt{2t}-1, & 0 \le t \lt 0.5\\ 1 - \sqrt{2(1-t)}, & 0.5 \le t \le 1\\ \end{cases} $$ Uniform disk ------------ $$ p(x, y)= (p_1(\sqrt{x}, 2\pi y)\text{,} p_2(\sqrt{x}, 2\pi y)) \\ p_i(r, \theta) = \begin{cases} r * \cos(\theta), & i = 1\\ r * \sin(\theta), & i = 2\\ \end{cases} \\ P_i^{-1}(x, y) = \begin{cases} 0, & x^2 + y^2 \gt 1\\ \frac{1}{\pi}, & otherwhise\\ \end{cases} $$ Uniform sphere -------------- $$ p(x, y)= (p_1(\arccos(1-2x), 2\pi y)\text{,} p_2(\arccos(1-2x), 2\pi y)\text{,} p_3(\arccos(1-2x), 2\pi y)) \\ p_i(\theta, \phi) = \begin{cases} \sin(\theta)\cos(\phi), & i = 1\\ \sin(\theta)\sin(\phi), & i = 2\\ \cos(\theta), & i = 3\\ \end{cases} \\ P_i^{-1}(x, y, z) = \frac{1}{4\pi} $$ Uniform hemisphere ------------------ $$ p(x, y) = (p_1(\arccos(1-x), 2\pi y)\text{,} p_2(\arccos(1-x), 2\pi y)\text{,} p_3(\arccos(1-x), 2\pi y)) \\ p_i(\theta, \phi) = \begin{cases} \sin(\theta)\cos(\phi), & i = 1\\ \sin(\theta)\sin(\phi), & i = 2\\ \cos(\theta), & i = 3\\ \end{cases} \\ P_i^{-1}(x, y, z) = \begin{cases} \frac{1}{2\pi}, & z \ge 0\\ 0, & otherwhise\\ \end{cases} $$ Cosine hemisphere ----------------- $$ p(x, y)= (p_1(\sqrt{x}, 2\pi y)\text{,} p_2(\sqrt{x}, 2\pi y)\text{,} p_3(\sqrt{x}, 2\pi y)) \\ p_i(r, \theta) = \begin{cases} r * \cos(\theta), & i = 1\\ r * \sin(\theta), & i = 2\\ \sqrt{1 - r^2(\cos^2(\theta)-\sin^2(\theta))}, & i = 3\\ \end{cases} \\ P_i^{-1}(x, y, z) = \begin{cases} \frac{z}{2\pi}, & z \ge 0\\ 0, & otherwhise\\ \end{cases} $$ Beckmann distribution --------------------- We start with de provided formulas and can build the PDF formula from it (thanks to the mapping hint): $$ D(\theta, \phi) = \frac{1}{2\pi}\ \cdot\ \frac{2 e^{\frac{-\tan^2{\theta}}{\alpha^2}}}{\alpha^2 \cos^3 \theta} \\ P_i^{-1}(x, y, z, a) = \frac{e^{\frac{-((x^2 + y^2)/(z^2))}{a^2}}}{\pi a^2 z^3} $$ To find the warp method, we multiply it by $2\pi$ (equivalent to integrating over $\phi$) and integrate it (as seen in the explanation) to find the following mappings for $\phi$ and $\theta$: $$ \theta = \arctan(\sqrt{(-a^2 \log(1-y))}) \\ \phi = 2\pi x $$ So finaly, we can build our warp using those new mappings: $$ p(x, y, a) = (p_1(\arctan(\sqrt{(-a^2 \log(1-y))}), 2\pi x)\text{,}\\ p_2(\arctan(\sqrt{(-a^2 \log(1-y))}), 2\pi x)\text{,}\\ p_3(\arctan(\sqrt{(-a^2 \log(1-y))}), 2\pi x)) \\ p_i(\theta, \phi) = \begin{cases} \sin(\theta)\cos(\phi), & i = 1\\ \sin(\theta)\sin(\phi), & i = 2\\ \cos(\theta), & i = 3\\ \end{cases} $$ Two simple rendering algorithms (40 pts) ======================================== Point lights ------------ Ajax bust illuminated by a point light source: