Advanced Computer Graphics: Difference between revisions
No edit summary |
|||
(21 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Classnotes for CMSC740 taught by Matthias Zwicker | Classnotes for CMSC740 taught by Matthias Zwicker (Spring 2020).<br> | ||
This first portion of the class focuses on ray tracing (specifically, path tracing) and is based on the [https://www.pbrt.org/ PBRT book]<br> | |||
The second portion of the class introduces deep learning approaches to computer graphics. | |||
==Acceleration== | ==Acceleration== | ||
Line 16: | Line 18: | ||
==Radiometry== | ==Radiometry== | ||
{{main | Wikipedia: Radiometry}} | |||
===Geometrical Optics=== | ===Geometrical Optics=== | ||
{{main | Wikipedia: Geometrical Optics}} | |||
* Light are rays which reflect, refract, and scatter | * Light are rays which reflect, refract, and scatter | ||
===Solid Angle=== | ===Solid Angle=== | ||
* Solid angle = area / radius^2 on a sphere | * Solid angle = area / radius^2 on a sphere | ||
===Spectral Radiance=== | |||
{{main | Wikipedia: Radiance}} | |||
* Spectral radiance is energy per time per wavelength per solid angle per area | |||
* <math>L(t, \lambda, \omega, \mathbf{x})=\frac{d^4 Q(t, \lambda, \omega, \mathbf{x})}{dt d\lambda d\omega dA^\perp}</math> | |||
: where energy is <math>Q(t, \lambda, \omega, \mathbf{x})</math> | |||
===Radiance=== | |||
{{main | Wikipedia: Radiance}} | |||
* power per solid angle per area | |||
* <math>L(\omega, \mathbf{x}) = \frac{d^2 \Phi(\omega, \mathbf{x})}{d\omega dA^\perp}</math> | |||
===Irradiance=== | |||
===Radiant Intensity=== | |||
==BRDF, Reflection Integral== | ==BRDF, Reflection Integral== | ||
Line 30: | Line 49: | ||
This is because <math>E\left[\frac{b-a}{N}\sum f(X_i)\right] = \frac{b-a}{N}\sum E[f(X_i)] = \frac{1}{N}\sum \int_{a}^{b}(b-a)f(x)(1/(b-a))dx = \int_{a}^{b}f(x)dx</math><br> | This is because <math>E\left[\frac{b-a}{N}\sum f(X_i)\right] = \frac{b-a}{N}\sum E[f(X_i)] = \frac{1}{N}\sum \int_{a}^{b}(b-a)f(x)(1/(b-a))dx = \int_{a}^{b}f(x)dx</math><br> | ||
Note that in general, if we can sample from some distribution with pdf <math>p(x)</math> then we use the estimator: | Note that in general, if we can sample from some distribution with pdf <math>p(x)</math> then we use the estimator: | ||
* <math> | * <math>\hat{I} = \frac{1}{N} \sum \frac{f(X_i)}{p(X_i)}</math> | ||
===Importance Sampling=== | ===Importance Sampling=== | ||
Line 37: | Line 56: | ||
Then apply the above equation. | Then apply the above equation. | ||
===Integration=== | |||
Some notes about integration | |||
* Hemisphere: <math>d\omega = \sin \theta d\theta d\phi</math> where <math>\theta \in [0, \pi/2)</math> and <math>\phi \in [0, 2\pi)</math> | |||
==Path Tracing== | |||
===PDF for sampling light sources=== | |||
<math>p_{\omega}(x) = \frac{1}{\# lights} * \frac{1}{area of light} * conversion</math> | |||
===Refractive objects=== | |||
;For mirrors: | |||
In practice, refractive objects are handled as a distinct case.<br> | |||
You do not need to sample a direction. | |||
;For glass: | |||
* Randomly sample either reflected or refracted ray with given probability. | |||
* Typically produces a lot of noice | |||
===Emitting surfaces=== | |||
* If a ray accidentally hits emitting surface, don't add emission | |||
** Exception: If eye ray hits emitting surface | |||
** Exception: If ray is generated from a refractive surface | |||
==Advanced Sampling Techniques== | |||
===Multiple Importance Sampling=== | |||
Weighted sampling between <math>F_a</math> <math>F_d</math> | |||
* Take <math>N</math> samples from each technique (j=1,...,N) | |||
* <math>F=\frac{1}{N} \sum_{j=1}^{N} \sum_{i=1}^{n} w_i(X_{i,j}) \frac{f(X_{i,j})}{p_i(X_{i,j})}</math> | |||
** Make sure <math>\sum_{i=1}^{n}w_i(x) = 1</math> | |||
* Weights for provable variance reduction | |||
** Balance heuristics: <math>w_i(x)=\frac{p_i(x)}{\sum_{k=1}^{n}p_k(x)}</math> | |||
** Power heuristics: <math>w_i(x)=\frac{p_i^2(x)}{\sum_{k=1}^{n}p_k^2(x)}</math> | |||
===Stratified Sampling=== | |||
* Intuition: clumping of samples is bad | |||
* Instead of canonic uniform random variables, generate variables in strata | |||
* Also known as "Jittered sampling" | |||
Other stratified sampling patterns | |||
* N-rooks (Latin hypercube) | |||
* Quasi Monte Carlo | |||
===Bidirectional Path Tracing=== | |||
Trace path from eye and light<br> | |||
Example: | |||
* from eye we get path <math>z_0, z_1, z_2</math><br> | |||
* from light we get <math>y_0, y_1</math><br> | |||
* Then make shadow rays from every pair of z, y<br> | |||
Path of length k with k+1 vertices | |||
* s vertices from light, t from eye | |||
* Path denoted <math>\bar{X}^{s,t}</math> (e.g. <math>\bar{X}^{2,3}</math>) | |||
* We also get probability density for this path <math>p_{s,t}</math> | |||
==Participating Media== | |||
===Transmittance=== | |||
* Multiplicative property | |||
** <math>T(s)=T(s_0) * T(s_1)</math> | |||
* Beer's law <math>T(s)=e^{-sigma_t s}</math> | |||
** For homogenous media where <math>\sigma(x) = \sigma</math> is constant | |||
===Phase Functions=== | |||
====Henyey-Greenstein phase function==== | |||
* <math>p(\cos \theta) = \frac{1-g^2}{4\pi(1+g^2-2g\cos \theta)^{1.5}}</math> | |||
====Properties==== | |||
* Unitless | |||
* Reciprocity | |||
** <math>p(\omega' \rightarrow \omega) = p(\omega \rightarrow \omega')</math> | |||
* Energy conservation | |||
** Integrates to 1 | |||
* Average phase angle determined by g | |||
===Volume Rendering Equation=== | |||
====Integro-integral form==== | |||
* <math>L(\mathbf{x}, \omega) = \int_{0}^{\infty}\exp(-\int_{0}^{s'}\sigma_t(\mathbf{x}-s''\omega)ds'')S(\mathbf{x}-s'\omega, \omega)ds</math> | |||
** <math>\exp(-\int_{0}^{s'}\sigma_t(\mathbf{x}-s''\omega)ds'')</math> is Transmittance <math>T(s')</math> due to extinction | |||
** <math>S(\mathbf{x}-s'\omega, \omega)</math> is source (emission, in-scattering) | |||
===Subsurface Scattering=== | |||
====BSSRDF==== | |||
bidirectional surface scattering reflectance distribution function | |||
* <math>S(\mathbf{x}_i, \omega_i, \mathbf{x}_o, \omega_o)</math> | |||
==Surface Reconstruction== | |||
[ | ===Crust Technique=== | ||
[https://www.cs.ubc.ca/~sheffa/dgp/ppts/crust.pdf Crust Slides from Univ. BC] |