Control Keys

move to next slide (also Enter or Spacebar).
move to previous slide.
 d  enable/disable drawing on slides
 p  toggles between print and presentation view
CTRL  +  zoom in
CTRL  -  zoom out
CTRL  0  reset zoom

Slides can also be advanced by clicking on the left or right border of the slide.

Notation

Type Font Examples
Variables (scalars) italics $a, b, x, y$
Functions upright $\mathrm{f}, \mathrm{g}(x), \mathrm{max}(x)$
Vectors bold, elements row-wise $\mathbf{a}, \mathbf{b}= \begin{pmatrix}x\\y\end{pmatrix} = (x, y)^\top,$ $\mathbf{B}=(x, y, z)^\top$
Matrices Typewriter $\mathtt{A}, \mathtt{B}= \begin{bmatrix}a & b\\c & d\end{bmatrix}$
Sets calligraphic $\mathcal{A}, B=\{a, b\}, b \in \mathcal{B}$
Number systems, Coordinate spaces double-struck $\mathbb{N}, \mathbb{Z}, \mathbb{R}^2, \mathbb{R}^3$

Goal: Solving the Rendering Equation

  • The rendering equation calculates the outgoing radiance $L_o(\mathbf{v})$ for the surface point $\mathbf{x}$ with normal $\mathbf{n}$ in the direction $\mathbf{v}$ by integrating over the contributions of all incoming radiances $L_i(\mathbf{l})$ of the hemisphere above the surface

    $L_o(\mathbf{v}) = L_e(\mathbf{v}) + \int\limits_\Omega \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, \, \underbrace{L_i(\mathbf{l}) \cos(\theta) \, d\omega}_{dE(\mathbf{l})}$

render_eqn
$\mathbf{x}$
$\theta$
$L_i(\mathbf{l})$
$L_o(\mathbf{v})$
$\Omega$
$\mathbf{n}$
  • $L_o(\mathbf{v})$ outgoing radiance
  • $L_e(\mathbf{v})$ is the radiance emitted by the surface itself
  • $L_i(\mathbf{l})$ incoming radiance
  • $E(\mathbf{l})$ irradiance
  • $\mathrm{f}_r(\mathbf{v}, \mathbf{l})$ is the so-called "Bidirectional Reflection Distribution Function" (BRDF)
  • $\Omega$ is the solid angle of the hemisphere above the surface

Evaluating the Rendering Equation

  • The approximation of the rendering equation with the Riemann sum gives:
    $\begin{align}L_o(\mathbf{v}) &= L_e(\mathbf{v}) + \int\limits_\Omega \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, L_i(\mathbf{l}) \cos(\theta) \, d\omega\\ &= L_e(\mathbf{v}) + \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi/2} \mathrm{f}_r(\mathbf{v}, \mathbf{l})\,L_i(\mathbf{l}) \cos(\theta) \sin(\theta) \, d\theta \, d\phi\\ &\approx L_e(\mathbf{v}) + \sum\limits_{1}^{K}\, \sum\limits_{1}^{J} \mathrm{f}_r(\mathbf{v}, \mathbf{l})\,L_i(\mathbf{l}) \cos(\theta) \sin(\theta) \underbrace{\Delta\theta}_{\frac{\pi/2}{J}} \, \underbrace{\Delta\phi}_{\frac{2\pi}{K}}\\ &= L_e(\mathbf{v}) + \frac{\pi^2}{K\,J} \sum\limits_{1}^{K}\, \sum\limits_{1}^{J} \mathrm{f}_r(\mathbf{v}, \mathbf{l})\,L_i(\mathbf{l}) \cos(\theta) \sin(\theta) \end{align}$

Evaluation of the Rendering Equation for a Diffuse BRDF

  • As an example, the rendering equation is now evaluated with a path tracer
  • In a first step, a perfectly diffuse BRDF is considered
    $\mathrm{f}_r(\mathbf{v}, \mathbf{l}) = k_d$
  • From the condition of energy conservation it follows:
    $\begin{align}\int\limits_\Omega \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, \cos(\theta) d\omega = \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi/2} k_d \cos(\theta) \sin(\theta) \, d\theta \, d\phi &= k_d \,2\pi \, \Bigg[\frac{-\cos^2(\theta)}{2}\Bigg]_{0}^{\pi/2} \\ &= k_d \, \pi = \rho_d \end{align}$
  • With $\rho_d ≤ 1$ the condition of energy conservation is fulfilled:
    $\mathrm{f}_r(\mathbf{v}, \mathbf{l}) = \frac{\rho_d}{\pi}\quad$ mit $\quad\rho_d \in [0, 1]$
  • Consequently, we get:
    $L_o(\mathbf{v}) \approx L_e(\mathbf{v}) + \rho_d \frac{\pi}{K\,J} \sum\limits_{1}^{K}\, \sum\limits_{1}^{J} L_i(\mathbf{l}) \cos(\theta) \sin(\theta)$

Example: Brute-Force Evaluation of the Rendering Equation

example_emissivesphere

Example: Brute-Force Evaluation of the Rendering Equation

struct RayPayloadType {
  vec3 radiance;
  vec3 nextRayOrigin;
  vec3 nextRayDirection;
  vec3 nextFactor;
  int level;
}; // type of the "payload" variable

...

void main() { /**** RAY GENERATION SHADER ****/

  // compute random pixel offset
  vec2 pixelOffset = hammersley(uint(frameID), uint(frameSize));
  
  // compute the texture coordinate for the output image in range [0.0, 1.0]
  vec2 texCoord = (vec2(gl_LaunchIDEXT.xy) + pixelOffset) / vec2(gl_LaunchSizeEXT.xy);

  // camera parameter
  float aspect = float(gl_LaunchSizeEXT.x) / float(gl_LaunchSizeEXT.y);
  vec3 rayOrigin = camPos;
  vec3 rayDirection = getCameraRayLookAt(30.0, aspect, camPos, camLookAt, camUp, texCoord);
  
  uint rayFlags = gl_RayFlagsNoneEXT; // no ray flags
  float rayMin = 0.001; // minimum ray distance for a hit
  float rayMax = 10000.0; // maximum ray distance for a hit  
  uint cullMask = 0xFFu; // no culling
  
  // init ray and payload
  payload.nextRayOrigin = rayOrigin;
  payload.nextRayDirection = rayDirection;
  payload.nextFactor = vec3(1.0);
  vec3 contribution = vec3(1.0);
  vec3 color = vec3(0.0, 0.0, 0.0);
  int level = 0;
  const int maxLevel = 5;
  
  // shot rays
  while(length(payload.nextRayDirection) > 0.1 &&
        level < maxLevel && length(contribution) > 0.001) {
    payload.level = level;
    // Submitting the camera ray to the acceleration structure traversal.
    // The last parameter is the index of the "payload" variable (always 0)
    traceRayEXT(topLevelAS, rayFlags, cullMask, 0u, 0u, 0u, 
            payload.nextRayOrigin, rayMin, payload.nextRayDirection, rayMax, 0);

    color += contribution * payload.radiance;
    contribution *= payload.nextFactor;
    level++;
  }

  if(frameID == 0) {
    gsnSetPixel(vec4(color, 1.0));
  } else {
    vec3 previousAverage = gsnGetPreviousPixel().rgb;
    previousAverage = pow(previousAverage, vec3(2.2)); // inverse gamma correction
    vec3 newAverage = (previousAverage.rgb * float(frameID) + color) / float(frameID + 1);
    newAverage = pow(newAverage, vec3(1.0 / 2.2)); // gamma correction
    gsnSetPixel(vec4(newAverage, 1.0));
  }
}

void  main() { /**** CLOSEST-HIT SHADER ****/
  
  // get mesh vertex data in object space
  vec3 p0, p1, p2;
  gsnGetPositions(gl_InstanceID, gl_PrimitiveID, p0, p1, p2);
  vec3 n0, n1, n2;
  gsnGetNormals(gl_InstanceID, gl_PrimitiveID, n0, n1, n2);
  vec2 t0, t1, t2;
  gsnGetTexCoords(gl_InstanceID, gl_PrimitiveID, t0, t1, t2);

  // interpolate with barycentric coordinate
  vec3 barys = vec3(1.0f - baryCoord.x - baryCoord.y, baryCoord.x, baryCoord.y);
  vec3 localNormal = normalize(n0 * barys.x + n1 * barys.y + n2 * barys.z);
  vec3 localPosition = p0 * barys.x + p1 * barys.y + p2 * barys.z;
  vec2 texCoords = t0 * barys.x + t1 * barys.y + t2 * barys.z;

  // transform to world space
  mat3 normalMat;
  gsnGetNormal3x3Matrix(gl_InstanceID, normalMat);
  vec3 normal = normalize(normalMat * localNormal);
  vec3 position = gl_ObjectToWorldEXT * vec4(localPosition, 1.0);

  // assign materials
  // Cornell Box
  vec3 baseColor = cornellWhite;
  vec3 emission = vec3(0.0);
  if(gl_InstanceID == 2 && texCoords.x < 0.25) {
    baseColor = cornellRed;
  } 
  if(gl_InstanceID == 2 && texCoords.x >= 0.5 && texCoords.x < 0.75) {
    baseColor = cornellGreen;
  }
  // light sphere
  if(gl_InstanceID == 1) {
    baseColor = vec3(0.0);
    emission = vec3(20.0);
  }
  
  // different random value for each pixel, each level, and each frame
  vec3 random = random_pcg3d(uvec3(gl_LaunchIDEXT.xy, frameID + payload.level));
  
  // uniform sampling of hemisphere
  float theta = 0.5 * PI * random.y;
  float phi = 2.0 * PI * random.x;
  
  payload.radiance = emission;
  
  // sampled indirect diffuse direction in normal space
  vec3 localDiffuseDir = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
  vec3 diffuseDir = getNormalSpace(normal) * localDiffuseDir;
  payload.nextRayOrigin = position;
  payload.nextRayDirection = diffuseDir;
  payload.nextFactor = baseColor * PI * cos(theta) * sin(theta);
}

void main() { /**** MISS SHADER ****/
  // set color to black
  payload.radiance = vec3(0.0, 0.0, 0.0);
  // no more reflections
  payload.nextRayOrigin = vec3(0.0, 0.0, 0.0);
  payload.nextRayDirection = vec3(0.0, 0.0, 0.0);
}

Importance Sampling

  • The Riemann sum is usually not a very efficient solution because the function is sampled uniformly
  • Using the theory of importance sampling, we can also approximate any integral by a sum:
    $\int\limits_a^b \mathrm{f}(x) \,dx \approx \frac{1}{N} \sum\limits_{n=1}^{N} \frac{\mathrm{f}(x_n)}{\mathrm{p}(x_n)}$
    where $p(x)$ is some arbitrary probability density function (PDF) that must fulfill the condition:
    $\int\limits_a^b \mathrm{p}(x) \, dx = 1$
  • In theory, the best PDF (with the smallest variance) would be
    $\mathrm{p}(x) = \frac{\mathrm{f}(x)}{ \int_a^b \mathrm{f}(x)}$
    which means the PDF should follow the shape of the function (i.e., the sampling density should be higher if the function values are higher).

Important Sampling

  • Transferred to the rendering equation, we get:
    $\begin{align}L_o(\mathbf{v}) &= L_e(\mathbf{v}) + \int\limits_\Omega \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, L_i(\mathbf{l}) \cos(\theta) \, d\omega\\ &= L_e(\mathbf{v}) + \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi/2}\underbrace{ \mathrm{f}_r(\mathbf{v}, \mathbf{l})\,L_i(\mathbf{l}) \cos(\theta) \sin(\theta)}_{\mathrm{f}(\theta_n, \phi_n)} \, d\theta \, d\phi\\ &\approx L_e(\mathbf{v}) + \frac{1}{N} \sum_{n=1}^{N} \frac{\mathrm{f}(\theta_n, \phi_n)}{\mathrm{p}(\theta_n, \phi_n)} \end{align}$

Inverse Transform Sampling

  • The probability density function (PDF) $\mathrm{p}(x)$ can be chosen arbitrarily
  • In order to get the best possible result after few samples, the PDF should follow the shape of the function
  • But how can we generate sampling positions with a specific PDF?
    • Many programming languages provide functions to generate uniform distributed samples
    • With inverse transform sampling it is possible to transform uniformly generated random numbers to random numbers with other PDFs

Inverse Transform Sampling

  1. Compute the cumulative distribution function (CDF) from the probability density function (PDF):
    $\mathrm{P}(x) = \int\limits_{-\infty}^x p(\tilde{x}) \,d\tilde{x}$
  2. Compute the inverse of the CDF $\,\mathrm{P}^{-1}(u)$
  3. Generate uniformly distributed random values $u \in [0, 1]$
  4. Compute random numbers $x$ according to $\mathrm{p}(x)$ using the inverse of the CDF
    $x = \mathrm{P}^{-1}_x(u)$

Inverse Transform Sampl.: Example 1 (Discrete Distribution)

inversion_method
$p(x_n)$
$x_n$
$x_n$
$P_x(x)$
$u$
  • Eight random events $x_n$ with $n = 1,\dots,8$ with given $p(x_n)$
  • Sum over all $p(x_n)$ must be 1
    $\sum\limits_{n=1}^8 p(x_n) = 1$
  • The CDF is calculated as
    $P_x(x) = \sum\limits_{n=1}^x p(x_n)$
  • Inverse CDF
    $x = \mathrm{P}^{-1}_x(u)$
  • If $u$ is uniformly distributed, then the event $x_n$ occurs according to $p(x_n)$

Inverse Transform Sampling: Example 2

inversion_example
$p(x)$
$x$
$P_x(x)$
$0$
$\pi$
$0$
$\pi$
$\frac{1}{2}$
  • Task:
    Generate random numbers with the PDF
    $p(x) = c \,\sin(x) \quad \quad x \in [0, \pi]$
  • The integral over the entire domain of the PDF must be 1:
    $\int\limits_{0}^{\pi} c \sin(x) \,dx = c\,\bigg[-\cos(x)\bigg]_{0}^{\pi} = 2 \,c = 1 \,\, \Rightarrow \,\, c = \frac{1}{2}$
  • The CDF is calculated as
    $\mathrm{P}_x(x) = \int\limits_{0}^x \frac{1}{2} \sin(\tilde{x}) \,d\tilde{x} = \frac{1}{2} \bigg[-\cos(\tilde{x})\bigg]_{0}^{x} = \frac{1}{2} (1 - \cos(x)) $
  • Inverse CDF
    $u = \frac{1}{2} (1 - \cos(x)) \Leftrightarrow x = \arccos(1 - 2\, u)$
  • Solution:
    If $u$ has a uniform distribution, $x = \arccos(1 - 2\, u)$ has a PDF of $p(x) = \frac{1}{2} \sin(x)$

Inverse Transform Sampling for a 2D PDF

  • The inverse transform sampling can also be used for a two-dimensional PDF $p(x, y)$
  • To do this, first calculate the marginal distribution for one dimension, e.g. for $x$:
    $p(x) = \int p(x, y) \,dy$
  • If $x$ is generated according to this PDF, the conditional probability density function of $y$ is
    $p(y | x) = \frac{p(x, y)}{p(x)}$
  • Now use the known inverse transform sampling for the two PDFs $p(x)$ and $p(y | x)$
  • Obviously, as an alternative, $p(y)$ and $p(x | y)$ can be used as well

Sampling of a Hemisphere

  • Now back to the important sampling of the rendering equation:
    $\begin{align}L_o(\mathbf{v}) &= L_e(\mathbf{v}) + \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi/2}\underbrace{ \mathrm{f}_r(\mathbf{v}, \mathbf{l})\,L_i(\mathbf{l}) \cos(\theta) \sin(\theta)}_{\mathrm{f}(\theta_n, \phi_n)} \, d\theta \, d\phi\\ &\approx L_e(\mathbf{v}) + \frac{1}{N} \sum_{n=1}^{N} \frac{\mathrm{f}(\theta_n, \phi_n)}{\mathrm{p}(\theta_n, \phi_n)} \end{align}$
  • The PDF $\mathrm{p}(\theta, \phi)$ can be chosen arbitrarily
  • For the sampling of a hemisphere, the tables on the next slides show formulas for computing azimuth angle $\phi$ and polar angle $\theta$ of a spherical coordinate system from two uniformly distributed random variables $u$ and $v$ in range [0.0, 1.0]
  • The corresponding mathematical derivations can be found here:
    Importance Sampling of a Hemisphere
  • Interactive demonstrator:
    Importance Sampling of a Hemisphere

Sampling of a Hemisphere

PDF / MappingTop viewSide view
Uniform sampling of polar angles
$\mathrm{p}(\theta, \phi) = \frac{1}{2\pi} \frac{1}{\pi/2}$
$\phi = 2 \pi \,u$
$\theta = \frac{\pi}{2}\, v$
(corresponds to the Riemann sum)
uniform_theta_phi_top uniform_theta_phi_front
Uniform sampling of a hemisphere
$\mathrm{p}(\theta, \phi) = \frac{1}{2\pi} \,\sin(\theta)$
$\phi = 2 \pi \,u$
$\theta = \arccos(1 - v)$
uniform_hemi_top uniform_hemi_front

Sampling of a Hemisphere

PDF / MappingTop viewSide view
Phong BRDF (diffuse part)
$\mathrm{p}(\theta, \phi) = \frac{1}{\pi} \, \cos(\theta) \,\sin(\theta)$
$\phi = 2 \pi \,u$
$\theta = \arcsin(\sqrt{v})$
cosine_hemi_top cosine_hemi_front
Phong BRDF (specualar part)
$\mathrm{p}(\theta, \phi) = \frac{n_s + 1}{2 \pi} \, \cos(\theta)^{n_s} \,\sin(\theta)$
$\phi = 2 \pi \,u$
$\theta = \arccos\left((1-v)^{\frac{1}{n_s+1}}\right)$
phong_n40_top phong_n40_front

Sampling of a Hemisphere

PDF / MappingTop viewSide view
Microfacet GGX distribution with
$r_p = 0.5$ und $\alpha = r_p^2$
$\mathrm{D}_{\tiny \mbox{GGX}}(\theta) = \frac{\alpha^2}{\pi \left(\cos^2(\theta) (\alpha^2-1)+1\right)^2}$
$\mathrm{p}(\theta, \phi) = \mathrm{D}_{\tiny \mbox{GGX}}(\theta)\cos(\theta)\sin(\theta)$
$\phi = 2 \pi \,u$
$\theta = \arccos\left(\sqrt{\frac{1 - v}{v (\alpha^2-1) + 1} }\right)$
ggx_050_top ggx_050_front
Microfacet GGX distribution with
$r_p = 0.25$
ggx_025_top ggx_025_front

Example: Important Sampling a of diffuse BRDF

  • Diffuse BRDF:
    $\mathrm{f}_r(\mathbf{v}, \mathbf{l}) = \frac{\rho_d}{\pi}\quad$ with $\quad\rho_d \in [0, 1]$
  • Selected PDF:
    $\mathrm{p}(\theta, \phi) = \frac{1}{\pi} \, \cos(\theta) \,\sin(\theta)$
  • Consequently, the approximation of the integral for a diffuse BRDF is given by:
    $\begin{align}L_o(\mathbf{v}) &= L_e(\mathbf{v}) + \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi/2}\underbrace{ \mathrm{f}_r(\mathbf{v}, \mathbf{l})\,L_i(\mathbf{l}) \cos(\theta) \sin(\theta)}_{\mathrm{f}(\theta_n, \phi_n)} \, d\theta \, d\phi\\ &\approx L_e(\mathbf{v}) + \frac{1}{N} \sum_{n=1}^{N} \frac{\mathrm{f}(\theta_n, \phi_n)}{\mathrm{p}(\theta_n, \phi_n)}\\ &= L_e(\mathbf{v}) + \frac{\rho_d}{N} \sum_{n=1}^{N} L_i(\mathbf{l}(\theta_n, \phi_n)) \end{align}$
    with $\phi_n = 2 \pi \,u$ and $\theta_n = \arcsin(\sqrt{v})$

Example: Important Sampling a diffuse BRDF

Example: Important Sampling a diffuse BRDF

  • Without important sampling (Riemann sum):
  • float theta = 0.5 * PI * random.y;
    float phi = 2.0 * PI * random.x;
    vec3 localDiffuseDir = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
    vec3 diffuseDir = getNormalSpace(normal) * localDiffuseDir;
    payload.nextRayOrigin = position;
    payload.nextRayDirection = diffuseDir;
    payload.nextFactor = baseColor * PI * cos(theta) * sin(theta);
  • With important sampling:
  • float theta = asin(sqrt(random.y));
    float phi = 2.0 * PI * random.x;
    vec3 localDiffuseDir = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));
    vec3 diffuseDir = getNormalSpace(normal) * localDiffuseDir;
    payload.nextRayOrigin = position;
    payload.nextRayDirection = diffuseDir;
    payload.nextFactor = baseColor;  
    

Evaluating the Rendering Equation

  • The example shows that the rendering equation can be implemented very easily
  • Problem:
    • With recursive ray tracing from the camera's point of view, there is only a contribution to the radiance if (by chance) the ray hits the light source during the traveral. If the light source is large, this is not a problem, but if it becomes smaller, the simple implementation becomes more and more inefficient
    • In the case of a diffuse BRDF, the BRDF's important sampling only results in slight speed-ups
example_emissivesphere2
256 samples per pixel were used in all scenes

Evaluating the Rendering Equation

  • Therefore, in path tracing, the rendering equation is split into two parts
    • Direct part
    • Indirect part
  • For the direct part, the direct contribution of the light sources is evaluated. The visibility is checked by a shadow ray. For extended light sources, the position on the light source must be varied.
  • The indirect part is evaluated, as before, by following a random direction of the hemisphere. However, the light sources must not be evaluated twice, so that now a hit on a light source does not contribute to the indirect part.
  • The splited rendering equation:
    $L_o(\mathbf{v}) = \underbrace{\int\limits_\Omega \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, \, L_i(\mathbf{l}) \cos(\theta) \, d\omega}_{\small\mbox{direct part}} + \underbrace{\int\limits_\Omega \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, \, L_i(\mathbf{l}) \cos(\theta) \, d\omega}_{\small\mbox{indirect part}}$

Evaluating the Rendering Equation

dwdA
$d\omega$
$dA$
$\theta_e$
$\theta$
$\mathbf{n}$
$\mathbf{n}_e$
$r_e$
Element of the light source
Element of the surface
  • For the direct part, it is no longer necessary to integrate over the hemisphere, but only over the solid angle from which the direct light hits the surface.
  • To this end, an infinitesimal area element $dA$ of the respective light source is converted into an infinitesimal solid angle element $d\omega$
    $d\omega = \frac{cos(\theta_e)\, dA}{r_e^2}$
  • The integral of the direct part can then be evaluated over the area of the light source
    $L_o(\mathbf{v}) = \underbrace{\int\limits_A \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, \, L_i(\mathbf{l}) \, \frac{\cos(\theta) cos(\theta_e)\, }{r_e^2} V_e\,dA}_{\small\mbox{direct part}} + \underbrace{\int\limits_\Omega \mathrm{f}_r(\mathbf{v}, \mathbf{l})\, \, L_i(\mathbf{l}) \cos(\theta) \, d\omega}_{\small\mbox{indirect part}}$
  • The visibility $V_e$ of the area element is either 0 or 1 and is determined by the shadow ray to the light source

Example: Sphere as an Area Light

  • Let us consider the example of a sphere with radius $r_s$ as an area light
  • The integral for the direct part can be solved by importance sampling:
    $\int\limits_A \underbrace{\mathrm{f}_r(\mathbf{v}, \mathbf{l})\, \, L_i(\mathbf{l}) \, \frac{\cos(\theta) cos(\theta_e)\, }{r_e^2} \,V_e}_{\mathrm{f}(x)}\,dA \approx \frac{1}{N} \sum\limits_{n=1}^{N} \frac{\mathrm{f}(x_n)}{\mathrm{p}(x_n)}$
  • When the sphere is uniformly sampled, the sampling points on the surface of the sphere must be chosen as follows (see inverse transform sampling, example 2)::
    $\theta_n = \arccos(1 - 2\,u)$ und $\phi_n = 2 \pi \,v$
  • Thus, the PDF $\mathrm{p}(x)$ is constant and it must hold:
    $\int_A \mathrm{p}(x) \, dx = 1$
    Since the total surface area of a sphere with radius $r_s$ is $4 \pi \,r_s^2$, we get:
    $\mathrm{p}(x) = \frac{1}{4 \pi\, r_s^2}$

Example: Sphere as an Area Light

0.3 0.15 0.075 0.0375
compare_direct_indirect
256 samples per pixel (top without and bottom with sampling of the direct part)

Point Light Source

pointlight
  • Sending evenly in all directions (isotropic)
  • No expansion (infinitesimal small)
  • Simplified mathematical model, not exactly physical
  • Typical parameters
    • 3D position
    • Radiant flux $\Phi$ in watt $[\mathrm{W}]$

Point Light Source

pointlight
$\mathbf{n}$
$-\mathbf{l}$
$-\mathbf{l}$
$\cos(\theta)dA$
$\theta$
$\theta$
$E_\perp$
$dA$
$dA$
  • For a solid angle element it applies that
    $d\omega = \frac{cos(0) dA}{r^2} = \frac{dA}{r^2}$.
    A point light source with
    luminous intensity $I$ at distance $r$ produces a perpendicular irradiance of
    $E_\perp = \frac{d\Phi}{dA} = \frac{d\Phi}{d\omega \,r^2} = \frac{I}{r^2}$
  • At an angle of incidence $\theta$, the area is reduced by $\cos(\theta)$. Therefore, we have:
    $E = E_\perp \cos(\theta) = \frac{I}{r^2} \cos(\theta) = \frac{I}{r^2} \langle\mathbf{n} \cdot \mathbf{l}\rangle$

Point Light Source

  • Since the point light source sends uniformly in all directions, the relationship between the light intensity $I$ and the radiant flux $\Phi$ is given by:
    $\begin{align} &\Phi = \int\limits_{\Omega} I \, d\omega = \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi} I\, \sin(\theta) \, d\theta \, d\phi = I \Bigg[-\cos(\theta)\Bigg]_{0}^{\pi} \left(\int\limits_{0}^{2\pi}d\phi\right) = 4\pi \, I\\ \Leftrightarrow & I = \frac{\Phi}{4\pi} \end{align} $
  • Consequently, the irradiance from a perpendicular direction at a distance $r$ is:
    $E_\perp = \frac{I}{r^2} = \frac{\Phi}{4\pi \,r^2}$
  • Or at angle of incidence $\theta$:
    $E = E_\perp \cos(\theta) = \frac{\Phi}{4\pi \,r^2} \cos(\theta) = \frac{\Phi}{4\pi \,r^2} \langle\mathbf{n} \cdot \mathbf{l}\rangle$

Relationship between a Point Light Source and Sphere as an Area Light

  • A sphere with radius $r_s$ should emit the same radiant flux $\Phi$ as a point light source. What must be the emitted radiance on the surface of the sphere?
  • Radiance is defined as
    $L = \frac{d^2\Phi}{d\omega\, \cos(\theta) \,dA} = \frac{dI}{\cos(\theta) \,dA} \Leftrightarrow I = \int\limits_A L \cos(\theta) \,dA$
  • The visibility of the surface must be taken into account, therefore
    $\begin{align} I &= \int\limits_A L \cos(\theta) V(\theta) \,dA = \int\limits_\Omega L \cos(\theta) V(\theta) \, r_s^2 \,d\omega\\ &= \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi} L \cos(\theta) \sin(\theta) \, V(\theta) \, r_s^2 \, d\theta \, d\phi = L \,r_s^2 \int\limits_{0}^{2\pi}\, \int\limits_{0}^{\pi/2} \cos(\theta)\sin(\theta) \, d\theta \, d\phi = \\ &= L \,r_s^2\,\,2\pi \, \Bigg[\frac{-\cos^2(\theta)}{2}\Bigg]_{0}^{\pi/2} = L \,r_s^2\,\, \pi \Leftrightarrow L = \frac{I}{r_s^2\, \pi} = \frac{\Phi}{4 \pi \, \,r_s^2\, \pi} \end{align}$

Are there any questions?

questions

Please notify me by e-mail if you have questions, suggestions for improvement, or found typos: Contact

More lecture slides

Slides in German (Folien auf Deutsch)