\subsection{Differentiation of the Interfacial Scattering Operator}
\label{ssec:boundary}
%
We now move on to the second term in Figure~\ref{fig:outline}, the derivative of $\kernelS\,\Lv$.
Differentiating $(\kernelS\,\Lv)(\bx, \bom) = T(\bx_0, \bom)\,\Lr(\bx_0, \bom)$ yields
%
\begin{myMathBox}
	\begin{align}
		& \left(\sdev\kernelS\,\Lv\right)(\bx, \bom) = \sdev [T(\bx_0, \bx) \,\Lr(\bx_0, \bx)] \nonumber\\
		=\;& \trans(\bx_0, \bx) \,\dLr(\bx_0, \bom) + \dot{\trans}(\bx_0, \bx)\,\Lr(\bx_0, \bom) \label{eqn:rte3d_kernelS_diff}\\
		=\;& \trans(\bx_0, \bx) \left[ -\left( \intSigT(\bx, \bom, \dist) + \ddist \, \sigT(\bx_0) \right) \Lr(\bx_0, \bom) + \dLr(\bx_0, \bom) \right]. \nonumber
	\end{align}
\end{myMathBox}
%
\noindent
The expression of $\dot{\trans}(\bx_0, \bx)$ is derived in Appendix~\ref{ssec:trans_deriv} and equals:
%
\begin{equation}
	\label{eqn:rte3d_trans1_diff}
	\dot{\trans}(\bx_0, \bx)
	= -\trans(\bx_0, \bx) \left( \intSigT(\bx, \bom, \dist) + \ddist \,\sigT(\bx_0) \right),
\end{equation}
%
where $\intSigT$ follows the definition in Eq.~\eqref{eqn:rte3d_int_sigT} but with the distance variable $\tau$ replaced by $\dist$.
The last term $\ddist \,\sigT(\bx_0)$ appears because the total travel distance $\dist$ in the medium depends on the medium's boundary that might change under $\param$.

The last component needed in Eq.~\eqref{eqn:rte3d_kernelS_diff} is $\dLr(\bx_0, \bom)$, whose specific form is analogous to $\dLins$ from Eq.~\eqref{eqn:rte3d_Lins_diff} since both $\Lins$ and $\Lr$ involve integrations over $\Sph$ (with the difference that $\Lr$ modulates incident radiance with the cosine-weighted BSDF~$\bsdf$, while $\Lins$ uses the phase function~$\phase$).
Thus, $\dLr$ takes the form expressed in Eq.~\eqref{eqn:rte3d_Lr_diff}:
%
\begin{myBox}
	\begin{equation}
		\label{eqn:rte3d_Lr_diff}
		\begin{split}
			\dLr(\bx, \bom) =\;& \tint_{\Sph} \sdev\left[\bsdf(\bx, -\bom', \bom) \,\Lv(\bx, \bom') \right] \D\bom' \;+\\
			& \tint_{\gedge(\bx)} \big\langle \gnormp, \sdev(\by \to \bx) \big\rangle \, \bsdf(\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}
\end{myBox}
%
\noindent
where $\Delta\Lv$ follows Eq.~\eqref{eqn:rte3d_delta_L_def}. %Eqs.~\eqref{eqn:rte3d_deltaL_silhouette} and \eqref{eqn:rte3d_deltaL_sharp}.
Further, $\sdev\bsdf\,\Lv$ in the first term depends on the derivative of the BSDF~$\bsdf$ which can generally be obtained using symbolic/automated differentiation.
