From a17fed6f5b131d98830f933fee7284627a50a5b9 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 18 Jul 2011 14:46:24 +0200 Subject: [PATCH] documentation updates for the HK model --- doc/macros.sty | 1 + src/bsdfs/coating.cpp | 6 ++-- src/bsdfs/hk.cpp | 83 ++++++++++++++++++++++++++++--------------- 3 files changed, 59 insertions(+), 31 deletions(-) diff --git a/doc/macros.sty b/doc/macros.sty index 4467f085..5df693a2 100644 --- a/doc/macros.sty +++ b/doc/macros.sty @@ -21,6 +21,7 @@ \newcommand{\Point}{\texttt{point}} \newcommand{\Texture}{\texttt{texture}} \newcommand{\BSDF}{\texttt{bsdf}} +\newcommand{\Phase}{\texttt{phase}} \newcommand{\Unnamed}{\emph{(Nested plugin)}} \newcommand{\Or}{~~\small or \small} \newcolumntype{P}[1]{>{\RaggedRight\hspace{0pt}}p{#1}} diff --git a/src/bsdfs/coating.cpp b/src/bsdfs/coating.cpp index 3beb8b57..208c6d20 100644 --- a/src/bsdfs/coating.cpp +++ b/src/bsdfs/coating.cpp @@ -30,8 +30,10 @@ MTS_NAMESPACE_BEGIN * numerically or using a known material name. \default{\texttt{bk7} / 1.5046}} * \parameter{extIOR}{\Float\Or\String}{Exterior index of refraction specified * numerically or using a known material name. \default{\texttt{air} / 1.000277}} - * \parameter{thickness}{\Float}{Denotes the thickness of the layer (to model absorption --- should be specified in inverse units of \code{sigmaA})\default{1}} - * \parameter{sigmaA}{\Spectrum\Or\Texture}{The absorption coefficient of the coating layer. \default{0, i.e. there is no absorption}} + * \parameter{thickness}{\Float}{Denotes the thickness of the layer (to + * model absorption --- should be specified in inverse units of \code{sigmaA})\default{1}} + * \parameter{sigmaA}{\Spectrum\Or\Texture}{The absorption coefficient of the + * coating layer. \default{0, i.e. there is no absorption}} * \parameter{\Unnamed}{\BSDF}{A nested BSDF model that should be coated.} * } * diff --git a/src/bsdfs/hk.cpp b/src/bsdfs/hk.cpp index 858b72be..e246540a 100644 --- a/src/bsdfs/hk.cpp +++ b/src/bsdfs/hk.cpp @@ -24,54 +24,79 @@ MTS_NAMESPACE_BEGIN -/*!\plugin{hk}{Hanrahan-Krueger BRDF} +/*!\plugin{hk}{Hanrahan-Krueger BSDF} * - * This plugin is an implementation of the Hanrahan-Krueger scattering model - * \cite{Hanrahan1993Reflection}. This model provides an analytic BSDF that - * accounts for single scattering within thin slabs of scattering media having - * index matched boundaries. + * \parameters{ + * \parameter{sigmaA}{\Spectrum\Or\Texture}{Scattering coefficient of the + * layer. \default{2.0}} + * \parameter{sigmaA}{\Spectrum\Or\Texture}{Absorption coefficient of the + * layer. \default{0.05}} + * \parameter{thickness}{\Float}{Denotes the thickness of the layer. + * Should be specified in inverse units of \code{sigmaA} and \code{sigmaS})\default{1}} + * \parameter{\Unnamed}{\Phase}{A nested phase function instance that represents + * the type of scattering interactions occurring within the layer} + * } * - * It also accounts for $0^{\mathrm{th}}$-order scattered light (i.e. attenuated - * light) that did not scatter within the medium. When used in conjuction with - * the \pluginref{coating} plugin, it can also acount for refraction and reflection - * at the boundaries of the medium when the indices of refraction are mismatched. + * This plugin provides an implementation of the Hanrahan-Krueger BSDF + * \cite{Hanrahan1993Reflection}. This analytic model simulates single scattering + * within a thin index-matched layer filled with a random medium. + * Apart from single scattering, the implementation also accounts for attenuated + * light that passes through the medium without undergoing any scattering events. * - * This BSDF needs a nested phase function to model the scattering within the - * medium. When no phase function is given, it will use an isotropic one ($g=0$) - * by default. A sample usage is given below: + * This BSDF requires a phase function to model scattering interactions within the + * random medium. When no phase function is explicitly specified, it uses an + * isotropic one ($g=0$) by default. A sample usage for instantiating the + * plugin is given below: * * \begin{xml} * - * - * - * + * + * + * + * * - * + * * * * \end{xml} * - * When \texttt{sigmaS} = \texttt{sigmaA}$\ = 0$, any associated geometry - * will be invisible. + * When used in conjuction with the \pluginref{coating} plugin, it is possible + * to correctly model refraction and reflection at the layer boundaries when + * the indices of refraction are mismatched: + * \begin{xml} + * + * + * * - * The sampling of this BSDF is either with respect to the phase function PDF or - * with the delta transmission function. The weighting between the two is decided - * based on the probability of an event within the medium. + * + * + * + * * - * The implementation is based on code by Tom Kamzimier and Marios Papas. + * + * + * + * + * + * \end{xml} + * + * Note that when \texttt{sigmaS} = \texttt{sigmaA}$\ = 0$, or when \texttt{thickness=0}, + * any geometry associated with this scattering model will be invisible. + * + * The implementation in Mitsuba is based on code by Tom Kazimiers and Marios Papas. */ class HanrahanKrueger : public BSDF { public: HanrahanKrueger(const Properties &props) : BSDF(props) { - /* Scattering events per scene unit */ - m_sigmaS = props.getSpectrum("sigmaS", Spectrum(4.0f)); - - /* Absorption events per scene unit */ - m_sigmaA = props.getSpectrum("sigmaA", Spectrum(0.1f)); + /* Scattering coefficient of the layer */ + m_sigmaS = props.getSpectrum("sigmaS", Spectrum(2.0f)); - /* Slab Thickness in scene units*/ - m_d = props.getFloat("thickness",0.5); + /* Absorption coefficient of the layer */ + m_sigmaA = props.getSpectrum("sigmaA", Spectrum(0.05f)); + + /* Slab thickness in inverse units of sigmaS and sigmaA */ + m_d = props.getFloat("thickness", 1); }