# Ask for detailed derivation of a formula in “Advanced Global Illumination”

Attached is page 34 of "Advanced Global Illumination", 2nd edition, by Dutre et al. I don't understand how (2.22) is derived from (2.21) and the given incident radiance distribution $$L(x\leftarrow\Psi)=L_{in}\delta(\Psi-\Theta)$$. Could you please give me a detailed derivation? Thanks a lot!

The only thing you really need to know in order to derive (2.22) from (2.21) is that the $$\delta$$-distribution satisfies

$$\int \delta(x) f(x)\,\text{d}x = f(0).$$

(The $$\delta$$-distribution is not a function in the common sense, so the above integral is merely a useful notation and not to be read as e.g. a Lebesgue or Riemann integral.)

Unfortunately, the notation that the authors use for the substitution of the incident radiance distribution is misleading. The $$\Theta$$ in $$L(x\leftarrow\Psi) = L_{in}\delta(\Psi-\Theta)$$ is completely unrelated to the integration variable $$\omega_\Theta$$, so I chose to denote it by $$\tilde\Psi$$ instead.

Here is the derivation of (2.22) from (2.21):

1. Substitute $$L(x\leftarrow\Psi) = L_{in}\delta(\Psi-\tilde\Psi)$$:

$$\frac{\int_{\Omega_x} \int_{\Omega_x} f_r(x, \Psi \rightarrow \Theta) L_{in}\delta(\Psi-\tilde\Psi)\cos(N_x,\Theta)\cos(N_x,\Psi)\,\text{d}\omega_\Psi\,\text{d}\omega_\Theta}{\int_{\Omega_x}L_{in}\delta(\Psi-\tilde\Psi)\cos(N_x,\Psi)\,\text{d}\omega_\Psi}$$

1. Substitute $$\Psi$$ with $$\Psi+\tilde\Psi$$:

$$\frac{\int_{\Omega_x} \int_{\Omega_x-\tilde\Psi} f_r(x, \Psi+\tilde\Psi \rightarrow \Theta) L_{in}\delta(\Psi)\cos(N_x,\Theta)\cos(N_x,\Psi+\tilde\Psi)\,\text{d}\omega_\Psi\,\text{d}\omega_\Theta}{\int_{\Omega_x-\tilde\Psi}L_{in}\delta(\Psi)\cos(N_x,\Psi+\tilde\Psi)\,\text{d}\omega_\Psi}$$

1. Use the above property of the $$\delta$$-distribution:

$$\frac{\int_{\Omega_x} f_r(x, \tilde\Psi \rightarrow \Theta) L_{in}\cos(N_x,\Theta)\cos(N_x,\tilde\Psi)\,\text{d}\omega_\Theta}{L_{in}\cos(N_x,\tilde\Psi)}$$

1. Simplify:

$$\int_{\Omega_x} f_r(x, \tilde\Psi \rightarrow \Theta) \cos(N_x,\Theta)\,\text{d}\omega_\Theta$$

Now you only need to notice that we want equation (2.21) to be true for all such "test functions" $$L_{in}\delta(\Psi-\tilde\Psi)$$ for the incident radiance, i.e. for all possible values of $$\tilde\Psi$$.