\subsection{Differentiating Pixel Intensities}
\label{ssec:pixel}
%
Physics-based renderers typically output entire images instead of individual radiance values, and differentiating rendered images requires calculating scene derivatives of pixel intensities.

Specifically, the intensity of each pixel is typically modeled as a radiometric measurement given by the inner product between the radiance~$\Lv$ and some (normalized) reconstruction kernel~$K$:
%
\begin{equation}
	\label{eqn:rte3d_pixel}
	I = \tint_{[0, 1)^2} \Lv(\bx(\bm{u}), \bom(\bm{u})) \, K(\bm{u}) \,\D\bu,
\end{equation}
%
where $\bx : [0, 1)^2 \to \pixel$ maps $[0, 1)^2$ to the pixel footprint $\pixel$ on the image plane in 3D, and $\bom(\bu)$ depends on the camera model and equals $\bx(\bu) \to \pcam$ for a perspective camera centered at $\pcam$.

When $K$ is independent of the scene parameter $\param$ and continuous in $\bu$, Eq.~\eqref{eqn:rte3d_pixel} can be differentiated via
%
\begin{equation}
	\label{eqn:rte3d_pixel_diff}
	\begin{split}
		\dot{I} =\;& \tint_{[0, 1)^2} \dLv(\bx(\bu), \bom(\bu)) \, K(\bu) \,\D\bu \;+\\
		& \tint_{\partial[0, 1)^2} \langle \gnorm, \dbx(\bu) \rangle \,\Delta\Lv(\bx(\bu), \bom(\bu)) \,K(\bu) \,\D\ell(\bu),
	\end{split}
\end{equation}
%
where $\partial[0, 1)^2$ denotes all boundary curves representing discontinuities of $\Lv$ (in $\bu$).
Further, $\gnorm$ and $\dbx$ capture the normal and change rate of these curves.

Notice that, when the camera's location, orientation, or field of view depends on $\param$ (which is required for optimizing camera parameters), so do the corresponding $\bx(\bu)$ and $\bom(\bu)$ in Eqs.~\eqref{eqn:rte3d_pixel} and \eqref{eqn:rte3d_pixel_diff}.
This necessitates our derivations of $\dLv(\bx, \bom)$ in \S\ref{sec:diff_rte} with $\bx$ and $\bom$ being $\param$-dependent.

To estimate $\dot{I}$, we draw $\bu_1$ uniformly from $[0, 1)^2$ and $\bu_2$ from $\partial[0, 1)^2$ with probability density $p(\bu_2)$.
Then,
%
\begin{equation}
\langle \dot{I} \rangle = \dLv(\bx(\bu_1), \bom(\bu_1)) \,K(\bu_1) + \frac{\langle \gnorm, \dbx(\bu_2) \rangle \Delta\Lv(\bx(\bu_2), \bom(\bu_2)) \,K(\bu_2)}{p(\bu_2)},
\end{equation}
%
where the first term on the RHS can be estimated using Algorithm~\ref{alg:diffRadiances} while the second can be handled by tracing side paths (similar to the primary edge sampling process in Li~et~al.'s work~\shortcite{Li:2018:DMC}).
