# How does a path tracer capture light falloff if it deals exclusively with radiance?

My understanding is that path tracers deal with radiance because radiance is constant along a ray. You simply go through and evaluate the light transport equation:

$$L_o(p, \omega_o) = L_e(p,\omega_o) + \int_S f(p,\omega_o,\omega_i)L_i(p,\omega_i) | \cos{\theta_i}| \ d\omega_i$$

with the goal of tracing a path through the scene and calculating the total radiance contributed to that path. My confusion comes from the following:

Say I have a spherical light, that has a radius of $$1m$$, and has a total radiant power of $$100W$$. Assuming the light is isotropic, I can calculate the radiant exitance from this light by dividing the total radiant power, by its surface area, giving:

$$M_e = \frac{100 W}{4\pi(1m)^2} = 7.9577 \frac{W}{m^2}$$

Using the following relations:

\begin{align} M_e &= \frac{\partial \Phi_e}{\partial A} \\ L_{e,\Omega} &= \frac{\partial^2 \Phi_e}{\partial\Omega \partial (A\cos{\theta})}\\ \end{align}

I can calculate the emitted radiance from its surface by the following:

\begin{align} L_{e,\Omega} &= \frac{\partial M_e}{\partial \Omega} \frac{1}{\cos{\theta}}\\ \int_SL_{e,\Omega} \cos{\theta} \ d\Omega &= M_e\\ \int_0^{2\pi}\int_0^{\pi/2} L_{e,\Omega}\cos{\theta}\sin{\theta} \ d\theta \ d\phi &= M_e\\ L_{e,\Omega} \pi &= M_e\\ L_{e,\Omega} &= \frac{M_e}{\pi}\\ \boxed{L_{e,\Omega} = 2.533 \frac{W}{sr \cdot m^2}} \end{align}

Now if I cast two rays into the scene, one which lands 100m from the light, and the other which lands 10m from the light, they should be illuminated very differently. Yet, when I sample the light source, I'll obtain a ray which carries a radiance of $$2.533 \frac{W}{sr \cdot m^2}$$. How is the fact that less total energy (and thus less "illumination") makes it to the further away spot, accounted for in this process?

My first thought would be to account for the angular size of the light. That is to say, for a point $$100m$$ away ($$d$$) I can calculate the solid angle subtended by the light with respect to the point I'm evaluating using:

\begin{align} \Omega &= 2\pi\left(1 - \frac{\sqrt{d^2 - R^2}}{d}\right)\\ &= 3.1417\times10^{-4} \ sr \end{align}

I can use this to get the irradiance by multiplying this solid angle by the previously calculated radiance, I get:

\begin{aligned} E_e &= \Omega\cdot L_{e,\Omega}\\ &= (3.1417\times10^-4 \ sr) \cdot (2.533 \frac{W}{sr \cdot m^2})\\ &= 7.9579\times 10^{-4} \frac{W}{m^2} \end{aligned}

This matches with the irradiance you'd calculate from a point light with a radiant power of $$100W$$, so it appears as if all has been calculated correctly.

But that quantity is irradiance, with units of $$\frac{W}{m^2}$$. And without multiplying by this solid angle, the radiance remains constant regardless of the distance to the light source. So how exactly does a path tracer accurately simulate light falloff, if it only tracks the radiance along the whole path?

Looking at PBR's section of Sampling Light Sources still leaves me confused. Part of it states:

The Light’s Pdf_Li() method returns the probability density with respect to solid angle for the light’s Sample_Li() method to sample the direction wi from the reference point ref.

This feels similar in spirit to what I have done. As the light is further away, it subtends a much smaller solid angle, and so conceivably you'd weight its radiance contribution less (as the further away the light gets, the less likely it is you'd intersect the light). But I'm struggling to see how this weighting process is different than simply multiplying the radiance by the solid angle subtended by the light, which would yield irradiance, thus breaking the whole path tracing concept of summing radiance along a path. And why do we even need to weight the ray this way? If a light is visible to a point, the radiance from that light is landing on the point. So I'm not following how to properly compute this kind of direction illumination

The inverse square law does not apply to radiance. We can compute irradiance as \begin{align} E(x, \Omega) &= \int_{\Omega} L_i(x, \omega_i) \underbrace{\cos\theta_x}_{N_x \cdot \omega_i} \, dA(\omega_i) \\ &= \int_{\Omega} L_o(\underbrace{r(x,\omega_i)}_{y}, \underbrace{-\omega_i}_{y\to x}) \cos\theta_x \, dA(\omega_i) \\ &= \int_{\Omega} L_o(y, y\to x) \cos\theta_x dA(\omega_i) \\ &= \int_{\Omega_M} L_o(y, y\to x) \cos\theta_x \underbrace{\cos\theta_y}_{N_y \cdot (y\to x)} \frac{1}{\|y-x\|^2_2} \, dA(\underbrace{y}_{r(x, \omega_i)}) \\ &= \int_{M} L_o(z, z\to x) \frac{\cos\theta_x \cos\theta_z}{\|z-x\|^2_2}V(x,z) \, dA(z) \\ &= \int_M L_o(z, z\to x) G(x,z) \,dA(z). \end{align}
Here $$\Omega$$ is some subset of the hemisphere at $$x$$ around the normal $$N_x$$. The term $$L_i(x, \omega_i)$$ is incident radiance at $$x$$ from direction $$\omega_i$$ (this direction points outwards from $$x$$). The $$dA(\omega_i)$$ is the differential area element on this hemisphere. In vacuum the incident radiance at $$x$$ along $$\omega_i$$ is equal to the outgoing radiance from $$y=r(x, \omega_i)$$ along $$-\omega_i$$, where $$r(x, \omega_i)$$ is the ray-tracing function and returns the first intersection $$y$$ along the ray from $$x$$ in direction $$\omega_i$$. The $$\cos\theta_x$$ is due to Lambert's law. In line four I have done a change of variables $$y=r(x, \omega_i)$$ - so now I integrate over the projection of $$\Omega$$ onto the scene surfaces: $$\Omega_M=\{r(x, \omega_i) \in M \, : \, \omega_i \in \Omega\}$$. This change of variables is accounted for by the factors $$\cos\theta_y$$ and $$\|y - x\|^{-2}_2$$. The $$\cos\theta_y$$ accounts for how slanted a small area around $$y$$ is wrt $$\omega_i$$, and $$\|y-x\|^{-2}_2$$ accounts for the fact that further away objects subtend a smaller solid angle. The step before last is just rewriting the integral over all scene points $$M$$ instead of just $$\Omega_M$$, by introducing a visibility function $$V(x,z)$$ which is one if $$r(x, x\to z) = z$$, and zero otherwise. That is what is typically termed the area formulation.
• I know the inverse square law does not apply to radiance, but I'm still confused as to how light falloff is captured. When I trace a ray from the camera to some point $x$, if that point $x$ is exposed to a light emitting radiance $L_o$, then (in vacuum) it doesn't matter how far $x$ is from the light, it will still always receive $L_o$. How do points further away from the light render as if they are darker, if they receive the same radiance? I brought irradiance into this only because in that context, it makes sense to me why they'd appear darker. But dealing purely with radiance, I am lost. Feb 16 at 15:33
• @ChrisGnam When you trace a ray from the camera to a point $x$, in order to tell how much light is scattered back to the camera you need to compute an integral. If the light source is further away the subtended solid angle is smaller, then the integral is non-zero over a solid angle that scales inversely quadratically with distance. Alternatively you could rewrite it as an integral over the surface of the light source, and then the inverse squared distance term becomes explicit as I noted. Feb 16 at 15:38
• I follow the intuition of that, however if I take the radiance (units of $W/(sr \cdot m^2)$), by the solid angle subtended by the light source, I'd end up with a value with units of $W/m^2$, which is irradiance, no? I think I'm getting tripped up on units and should probably just try to actually work out a simple example by hand to better grasp this Feb 16 at 15:50
• @ChrisGnam The rendering equation is: $$L_o = Le + \int_{\Omega} f L_i \cos\theta_i d\omega_i$$ Here $L_o$ is outgoing radiance, $L_e$ is emitted radiance, the integral is taken over solid angle so it would get rid of one $sr^{-1}$, but the brdf has units $sr^{-1}$ and the incident radiance has units $W m^{-2} sr^{-1}$, so you still get the correct units. Feb 16 at 16:01