\subsection{Differentiation of the In-Scattered Radiance}
\label{ssec:dLins}
%
\begin{figure}[t]
	\centering
	\addtolength{\tabcolsep}{-4pt}
	\begin{tabular}{cc}
		\includegraphics[height=0.85in]{sph_curve.pdf} &
		\includegraphics[height=0.975in]{change_of_measure.pdf}\\
		(a) & (b)
	\end{tabular}
	%
	\caption{\label{fig:sph_curves}
		(a) Definitions of $\bbS(\bx)$ and $\gedge(\bx)$.
		(b) Deriving the change-of-measure ratio $\sin\theta/\| \by - \bx\|$ in Eq.~\eqref{eqn:rte3d_Lins_edge} by projecting a differential curve $\D\by$ to the surface of a unit sphere around $\bx$.
	}
\end{figure}
%
Evaluating the RHS of Eq.~\eqref{eqn:rte3d_ind_diff} also requires the derivative of the in-scattered radiance~$\Lins$ of Eq.~\eqref{eqn:rte3d_Lins}.
Recall that $\Lins$ is expressed as an integral of $\phase(\bx, -\bom', \bom) \,\Lv(\bx, \bom')$ over directions $\bom'$.
Note that $\Lv(\bx, \bom')$ may have discontinuities in $\bom'$ (for fixed $\bx$) due to visibility changes.
Thus, to differentiate $\Lins$, we must consider how the discontinuities change with respect to the scene parameter $\param$.

Let $\bbS(\bx) \subset \Sph$ be a set of \emph{spherical curves} capturing all discontinuities of $\phase(\bx, -\bom', \bom) \,\Lv(\bx, \bom')$ with respect to $\bom'$ (see the red curves in Figure~\ref{fig:sph_curves}).
%
At an interior point $\bx \in \domain \setminus \boundary$ and direction $\bom \in \Sph$, the derivative of $\Lins$ can be expressed using \thmref{reynolds} as
%
\begin{myMathBox}
	\begin{align}
		\dLins(\bx, \bom) =\;
		& \tint_{\Sph} \sdev\left[\phase(\bx, -\bom', \bom) \,\Lv(\bx, \bom')\right] \D\bom' \;+ \label{eqn:rte3d_Lins_diff}\\
		& \underbrace{\tint_{\bbS(\bx)} \langle \gnormp, \dbom' \rangle \, \phase(\bx, -\bom', \bom) \, \Delta\Lv(\bx, \bom')  \,\D\ell(\bom')}_{=:\; \Bins(\bx, \bom)}. \nonumber
	\end{align}
\end{myMathBox}
%
\noindent
The first term on the RHS of this equation is an integral over the unit sphere $\Sph$, which is independent of the scene parameter $\param$, making the integral variable $\bom'$ also be $\param$-independent.
To evaluate this term, the derivative of the phase function~$\phase$ is needed.
In practice, $\phase$ usually has analytical expressions, allowing $\dphase(\bx, -\bom', \bom)$ to be obtained using symbolic differentiation.

The second term in Eq.~\eqref{eqn:rte3d_Lins_diff} arises from the boundary integral term in Eq.~\eqref{eqn:thm1} after \thmref{reynolds} is applied.
It emerges due to the discontinuities of $\phase(\bx, -\bom', \bom) \,\Lv(\bx, \bom')$ with respect to $\bom'$, corresponding to how the discontinuities ``move'' as the scene parameter $\param$ varies.
We denote this integral as $\Bins(\bx, \bom)$, wherein $\dbom'$ is the change rate (with respect to $\param$) of the discontinuity location $\bom'$, and $\ell(\bom')$ indicates the curve length measure.

In Eq.~\eqref{eqn:rte3d_Lins_diff}, $\gnormp$ is a vector in the tangent space of $\Sph$ at $\bom'$ perpendicular to the discontinuity curve (see Figure~\ref{fig:sph_curve_normal}).
Further, $\Delta\Lv$ is the radiance difference across a discontinuity curve in $\bbS(\bx)$.
We discuss both terms in more detail later in this subsection.

While $\Bins$ integrates over a set of spherical curves on $\Sph$, it is computationally more convenient to rewrite this integral in terms of boundary curves in the 3D space.
As shown in Figure~\ref{fig:edge_types}, the 3D boundary curves comprise all the \emph{geometric edges} that cause discontinuities of $\Lv(\bx, \bom')$ in $\bom'$ when viewed from $\bx$, including (i)~\emph{boundary} edges associated with only one face; (ii)~\emph{silhouette} edges shared by a front-facing and a back-facing face; and (iii)~front-facing \emph{sharp} edges across which the surface normals are discontinuous.

Let $\gedge(\bx) \subset \boundary$ denote all the boundary curves when viewed from $\bx$.
By changing the measure of curve length from $\Sph$ to the 3D Euclidean space, we rewrite the last term $\Bins(\bx, \bom)$ in Eq.~\eqref{eqn:rte3d_Lins_diff} as
%
\begin{equation}
	\label{eqn:rte3d_Lins_edge}
	\begin{split}
		\Bins(\bx, \bom) =\;& \tint_{\gedge(\bx)} \big\langle \gnormp, \sdev(\by \to \bx) \big\rangle \, \phase(\bx, \bx \to \by, \bom)\\
		& \qquad \Delta\Lv(\bx, \by \to \bx) \, \vis(\bx, \by) \, \tfrac{\sin\theta}{\| \by - \bx \|} \,\D\ell(\by),
	\end{split} 
\end{equation}
%
where $\by \to \bx$ indicates the normalized direction from $\by$ to $\bx$, $\sdev(\by \to \bx)$ is the same as $\dbom'$, $\vis(\bx, \by)$ denotes the mutual visibility between $\bx$ and $\by$, and $\theta$ is the angle between the tangent direction at $\by$ and $\by \to \bx$ (see Figure~\ref{fig:sph_curves}-b).
As a result, $\ell(\by)$ here is the length measure in Euclidean space.

Lastly, we discuss how to compute the ingredients needed for evaluating Eq.~\eqref{eqn:rte3d_Lins_diff}, namely, $\gnormp$, $\dbom' = \sdev(\by \to \bx)$, and $\Delta\Lv$.

\paragraph{Normal}
The normal~$\gnormp$ in Eqs.~\eqref{eqn:rte3d_Lins_diff} and \eqref{eqn:rte3d_Lins_edge} emerges from the application of \thmref{reynolds} and represents the normal vector of the discontinuity boundary on the integration manifold (i.e., $\Sph$).
Therefore, $\gnormp$ must be in the tangent space of $\bom' \in \Sph$.

In practice, when the scene geometry is depicted using polygonal meshes, the boundary curves $\gedge(\bx)$ in Eq.~\eqref{eqn:rte3d_Lins_edge} are comprised of polygonal face edges.
Consider an edge with endpoints $\bp$ and $\bq$.
Its projection on a unit sphere centered at $\bx$ is an arc on which every point has the same normal in the tangent space (see Figure~\ref{fig:sph_curve_normal}-a):
%
\begin{equation}
	\label{eqn:rte3d_sph_norm}
	\gnormp = \frac{(\bp - \bx) \times (\bq - \bx)}{\| (\bp - \bx) \times (\bq - \bx) \|}.
\end{equation}

\paragraph{Change rate of $\bom'$}
Boundary curves in $\gedge(\bx)$ may vary with respect to the scene parameter $\param$---for example, an object may move in 3D along a trajectory parameterized by $\param$.
Suppose that a point $\by \in \gedge(\bx)$ has a change rate $\dot{\by}$.
Then, the corresponding direction
%\footnote{
%	Here $\bom'$ takes the direction pointing from $\by$ to $\bx$ (instead of the other way around) since $\Lv(\bx, \bom')$ is given by the line integral over the ray $(\bx, -\bom')$.
%}
$\bom' = (\by \to \bx)$ has the derivative (which we derive in Appendix~\ref{ssec:dbom_derive}):
%
\begin{equation}
	\label{eqn:rte3d_sph_vel}
	\dbom' = \sdev\left(\tfrac{\bx - \by}{\| \bx - \by \|}\right) = \tfrac{\dbx - \dot{\by}}{\| \bx - \by \|} - \bom' \left\langle \bom', \tfrac{\dbx - \dot{\by}}{\| \bx - \by \|} \right\rangle.
\end{equation}

\paragraph{Evaluating $\Delta\Lv$}
Recall that, in Eq.~\eqref{eqn:rte3d_Lins_diff}, $\Delta\Lv(\bx, \bom')$ indicates the difference in radiance across discontinuity boundaries with respect to $\bom'$.
This is given by the difference between two one-sided limits of $\Delta\Lv(\bx, \hatbom)$ when $\hatbom$ approaches the discontinuity boundary $\bom'$ from both sides along the normal direction $\gnormp$.
Namely,
%
\begin{equation}
	\label{eqn:rte3d_delta_L_def}
	\Delta\Lv(\bx, \bom') = \lim_{\epsilon \to 0^-} \Lv(\bx, \bom' + \epsilon\,\gnormp) - \lim_{\epsilon \to 0^+} \Lv(\bx, \bom' + \epsilon\,\gnormp).
\end{equation}
%
Based on this definition, we evaluate $\Delta\Lv$ in Appendix~\ref{ssec:deltaL_deriv}.

\begin{figure}[t]
	\centering
	\includegraphics[height=0.85in]{edge_types.pdf}
	\caption{\label{fig:edge_types}
		Three types of edges (drawn in yellow) that can cause geometric discontinuities: (a)~boundary, (b)~silhouette, and (c)~sharp.
	}
\end{figure}

\begin{figure}[b]
	\centering
	\includegraphics[width=0.7\columnwidth]{sph_curve_normal.pdf}
	\caption{\label{fig:sph_curve_normal}
		The normal directions of arcs and circles (that are respectively the projections of line segments and spheres) as spherical curves.
	}
\end{figure}
