cleanups
parent
ff62ccea31
commit
37770752ca
|
@ -2,15 +2,6 @@
|
||||||
to be tested for consistency. This is done
|
to be tested for consistency. This is done
|
||||||
using the testcase 'test_chisquare' -->
|
using the testcase 'test_chisquare' -->
|
||||||
<scene>
|
<scene>
|
||||||
<!-- Test the rough dielectric model with the anisotropic
|
|
||||||
Ashikhmin-Shirley microfacet distribution -->
|
|
||||||
<bsdf type="roughconductor">
|
|
||||||
<string name="preset" value="Au"/>
|
|
||||||
<string name="distribution" value="as"/>
|
|
||||||
<float name="alphaU" value="0.1"/>
|
|
||||||
<float name="alphaV" value="0.3"/>
|
|
||||||
</bsdf>
|
|
||||||
|
|
||||||
<!-- Test the diffuse model -->
|
<!-- Test the diffuse model -->
|
||||||
<bsdf type="diffuse"/>
|
<bsdf type="diffuse"/>
|
||||||
|
|
||||||
|
@ -97,4 +88,13 @@
|
||||||
<string name="distribution" value="beckmann"/>
|
<string name="distribution" value="beckmann"/>
|
||||||
<float name="alpha" value=".3"/>
|
<float name="alpha" value=".3"/>
|
||||||
</bsdf>
|
</bsdf>
|
||||||
|
|
||||||
|
<!-- Test the rough dielectric model with the anisotropic
|
||||||
|
Ashikhmin-Shirley microfacet distribution -->
|
||||||
|
<bsdf type="roughconductor">
|
||||||
|
<string name="preset" value="Au"/>
|
||||||
|
<string name="distribution" value="as"/>
|
||||||
|
<float name="alphaU" value="0.1"/>
|
||||||
|
<float name="alphaV" value="0.3"/>
|
||||||
|
</bsdf>
|
||||||
</scene>
|
</scene>
|
||||||
|
|
|
@ -318,8 +318,21 @@ public:
|
||||||
* \param alpha The surface roughness
|
* \param alpha The surface roughness
|
||||||
*/
|
*/
|
||||||
Float G(const Vector &wi, const Vector &wo, const Vector &m, Float alphaU, Float alphaV) const {
|
Float G(const Vector &wi, const Vector &wo, const Vector &m, Float alphaU, Float alphaV) const {
|
||||||
Float alpha = std::max(alphaU, alphaV);
|
if (m_type != EAshikhminShirley) {
|
||||||
return smithG1(wi, m, alpha) * smithG1(wo, m, alpha);
|
return smithG1(wi, m, alphaU)
|
||||||
|
* smithG1(wo, m, alphaU);
|
||||||
|
} else {
|
||||||
|
/* Infinite groove shadowing/masking */
|
||||||
|
const Float nDotM = std::abs(Frame::cosTheta(m)),
|
||||||
|
nDotWo = std::abs(Frame::cosTheta(wo)),
|
||||||
|
nDotWi = std::abs(Frame::cosTheta(wi)),
|
||||||
|
woDotM = absDot(wo, m),
|
||||||
|
wiDotM = absDot(wi, m);
|
||||||
|
|
||||||
|
return std::max((Float) 0, std::min((Float) 1,
|
||||||
|
std::min(2 * nDotM * nDotWo / woDotM,
|
||||||
|
2 * nDotM * nDotWi / wiDotM)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
|
|
|
@ -41,29 +41,29 @@ MTS_NAMESPACE_BEGIN
|
||||||
* \begin{enumerate}[(i)]
|
* \begin{enumerate}[(i)]
|
||||||
* \item \code{beckmann}: Physically-based distribution derived from
|
* \item \code{beckmann}: Physically-based distribution derived from
|
||||||
* Gaussian random surfaces. This is the default.
|
* Gaussian random surfaces. This is the default.
|
||||||
|
* \item \code{ggx}: New distribution proposed by
|
||||||
|
* Walter et al. \cite{Walter07Microfacet}, which is meant to better handle
|
||||||
|
* the long tails observed in measurements of ground surfaces.
|
||||||
|
* Renderings with this distribution may converge slowly.
|
||||||
* \item \code{phong}: Classical $\cos^p\theta$ distribution.
|
* \item \code{phong}: Classical $\cos^p\theta$ distribution.
|
||||||
* Due to the underlying microfacet theory,
|
* Due to the underlying microfacet theory,
|
||||||
* the use of this distribution here leads to more realistic
|
* the use of this distribution here leads to more realistic
|
||||||
* behavior than the separately available \pluginref{phong} plugin.
|
* behavior than the separately available \pluginref{phong} plugin.
|
||||||
* \item \code{ggx}: New distribution proposed by
|
|
||||||
* Walter et al. meant to better handle the long
|
|
||||||
* tails observed in measurements of ground surfaces.
|
|
||||||
* Renderings with this distribution may converge slowly.
|
|
||||||
* \item \code{as}: Anisotropic Phong-style microfacet distribution proposed by
|
* \item \code{as}: Anisotropic Phong-style microfacet distribution proposed by
|
||||||
* Ashikhmin and Shirley \cite{Ashikhmin2005Anisotropic}.\vspace{-3mm}
|
* Ashikhmin and Shirley \cite{Ashikhmin2005Anisotropic}.\vspace{-3mm}
|
||||||
* \end{enumerate}
|
* \end{enumerate}
|
||||||
* }
|
* }
|
||||||
* \parameter{alpha}{\Float\Or\Texture}{
|
* \parameter{alpha}{\Float\Or\Texture}{
|
||||||
* Specifies the roughness value of the unresolved surface microgeometry.
|
* Specifies the roughness of the unresolved surface microgeometry.
|
||||||
* When the Beckmann distribution is used, this parameter is equal to the
|
* When the Beckmann distribution is used, this parameter is equal to the
|
||||||
* \emph{root mean square} (RMS) slope of the microfacets. This
|
* \emph{root mean square} (RMS) slope of the microfacets. This
|
||||||
* parameter is only valid when \texttt{distribution=beckmann/phong/ggx}.
|
* parameter is only valid when \texttt{distribution=beckmann/phong/ggx}.
|
||||||
* \default{0.1}.
|
* \default{0.1}.
|
||||||
* }
|
* }
|
||||||
* \parameter{alphaU, alphaV}{\Float\Or\Texture}{
|
* \parameter{alphaU, alphaV}{\Float\Or\Texture}{
|
||||||
* Specifies the anisotropic rougness values along the tangent and bitangent directions. These
|
* Specifies the anisotropic rougness values along the tangent and
|
||||||
* parameter are only valid when \texttt{distribution=as}.
|
* bitangent directions. These parameter are only valid when
|
||||||
* \default{0.1}.
|
* \texttt{distribution=as}. \default{0.1}.
|
||||||
* }
|
* }
|
||||||
* \parameter{preset}{\String}{Name of a material preset, see
|
* \parameter{preset}{\String}{Name of a material preset, see
|
||||||
* \tblref{conductor-iors}.\!\default{\texttt{Cu} / copper}}
|
* \tblref{conductor-iors}.\!\default{\texttt{Cu} / copper}}
|
||||||
|
|
|
@ -38,29 +38,29 @@ MTS_NAMESPACE_BEGIN
|
||||||
* \begin{enumerate}[(i)]
|
* \begin{enumerate}[(i)]
|
||||||
* \item \code{beckmann}: Physically-based distribution derived from
|
* \item \code{beckmann}: Physically-based distribution derived from
|
||||||
* Gaussian random surfaces. This is the default.
|
* Gaussian random surfaces. This is the default.
|
||||||
|
* \item \code{ggx}: New distribution proposed by
|
||||||
|
* Walter et al. \cite{Walter07Microfacet}, which is meant to better handle
|
||||||
|
* the long tails observed in measurements of ground surfaces.
|
||||||
|
* Renderings with this distribution may converge slowly.
|
||||||
* \item \code{phong}: Classical $\cos^p\theta$ distribution.
|
* \item \code{phong}: Classical $\cos^p\theta$ distribution.
|
||||||
* Due to the underlying microfacet theory,
|
* Due to the underlying microfacet theory,
|
||||||
* the use of this distribution here leads to more realistic
|
* the use of this distribution here leads to more realistic
|
||||||
* behavior than the separately available \pluginref{phong} plugin.
|
* behavior than the separately available \pluginref{phong} plugin.
|
||||||
* \item \code{ggx}: New distribution proposed by
|
|
||||||
* Walter et al. meant to better handle the long
|
|
||||||
* tails observed in measurements of ground surfaces.
|
|
||||||
* Renderings with this distribution may converge slowly.
|
|
||||||
* \item \code{as}: Anisotropic Phong-style microfacet distribution proposed by
|
* \item \code{as}: Anisotropic Phong-style microfacet distribution proposed by
|
||||||
* Ashikhmin and Shirley \cite{Ashikhmin2005Anisotropic}.\vspace{-3mm}
|
* Ashikhmin and Shirley \cite{Ashikhmin2005Anisotropic}.\vspace{-3mm}
|
||||||
* \end{enumerate}
|
* \end{enumerate}
|
||||||
* }
|
* }
|
||||||
* \parameter{alpha}{\Float\Or\Texture}{
|
* \parameter{alpha}{\Float\Or\Texture}{
|
||||||
* Specifies the roughness value of the unresolved surface microgeometry.
|
* Specifies the roughness of the unresolved surface microgeometry.
|
||||||
* When the Beckmann distribution is used, this parameter is equal to the
|
* When the Beckmann distribution is used, this parameter is equal to the
|
||||||
* \emph{root mean square} (RMS) slope of the microfacets. This
|
* \emph{root mean square} (RMS) slope of the microfacets. This
|
||||||
* parameter is only valid when \texttt{distribution=beckmann/phong/ggx}.
|
* parameter is only valid when \texttt{distribution=beckmann/phong/ggx}.
|
||||||
* \default{0.1}.
|
* \default{0.1}.
|
||||||
* }
|
* }
|
||||||
* \parameter{alphaU, alphaV}{\Float\Or\Texture}{
|
* \parameter{alphaU, alphaV}{\Float\Or\Texture}{
|
||||||
* Specifies the anisotropic rougness values along the tangent and bitangent directions. These
|
* Specifies the anisotropic rougness values along the tangent and
|
||||||
* parameter are only valid when \texttt{distribution=as}.
|
* bitangent directions. These parameter are only valid when
|
||||||
* \default{0.1}.
|
* \texttt{distribution=as}. \default{0.1}.
|
||||||
* }
|
* }
|
||||||
* \parameter{intIOR}{\Float\Or\String}{Interior index of refraction specified
|
* \parameter{intIOR}{\Float\Or\String}{Interior index of refraction specified
|
||||||
* numerically or using a known material name. \default{\texttt{bk7} / 1.5046}}
|
* numerically or using a known material name. \default{\texttt{bk7} / 1.5046}}
|
||||||
|
@ -89,25 +89,44 @@ MTS_NAMESPACE_BEGIN
|
||||||
* {bsdf_roughdielectric_textured.jpg}
|
* {bsdf_roughdielectric_textured.jpg}
|
||||||
* }
|
* }
|
||||||
*
|
*
|
||||||
* This plugin is essentially the ``roughened'' equivalent of the plugin
|
* This plugin is essentially the ``roughened'' equivalent of the (smooth) plugin
|
||||||
* \pluginref{dielectric}. As the roughness parameter $\alpha$ decreases, it
|
* \pluginref{dielectric}. For very low values of $\alpha$, the two will
|
||||||
* will increasingly approximate the smooth model. The implementation of this
|
* be very similar, though scenes using this plugin will take longer to render
|
||||||
* plugin is based on the paper ``Microfacet Models for Refraction through
|
* due to the additional computational burden of tracking surface roughness.
|
||||||
* Rough Surfaces'' by Walter et al. \cite{Walter07Microfacet}. It supports
|
*
|
||||||
* several types of microfacet distributions and has a texturable roughness
|
* The implementation of this plugin is based on the paper ``Microfacet Models
|
||||||
* parameter. Exterior and interior IOR values can be independently
|
* for Refraction through Rough Surfaces'' by Walter et al.
|
||||||
* specified, where ``exterior'' refers to the side that contains the surface
|
* \cite{Walter07Microfacet}. It supports several different types of microfacet
|
||||||
* normal. Similar to the \pluginref{dielectric} plugin, IOR values can either
|
* distributions and has a texturable roughness parameter. Exterior and
|
||||||
* be specified numerically, or based on a list of known materials (see
|
* interior IOR values can be independently specified, where ``exterior''
|
||||||
|
* refers to the side that contains the surface normal. Similar to the
|
||||||
|
* \pluginref{dielectric} plugin, IOR values can either be specified
|
||||||
|
* numerically, or based on a list of known materials (see
|
||||||
* \tblref{dielectric-iors} for an overview). When no parameters are given,
|
* \tblref{dielectric-iors} for an overview). When no parameters are given,
|
||||||
* the plugin activates the default settings, which describe a borosilicate
|
* the plugin activates the default settings, which describe a borosilicate
|
||||||
* glass BK7/air interface with a light amount of roughness modeled using a
|
* glass BK7/air interface with a light amount of roughness modeled using a
|
||||||
* Beckmann distribution.
|
* Beckmann distribution.
|
||||||
*
|
*
|
||||||
* When using the Ashikmin-Shirley or Phong models, a conversion method is
|
* To get an intuition about the range and effects of the surface roughness
|
||||||
|
* parameter $\alpha$, consider the following: a value of
|
||||||
|
* $\alpha=0.001-0.01$ corresponds a material with slight imperfections on an
|
||||||
|
* otherwise smooth surface finish, $\alpha=0.1$ is relatively rough,
|
||||||
|
* and $\alpha=0.3-0.5$ is \emph{extremely} rough (e.g. a etched or ground
|
||||||
|
* finish).
|
||||||
|
*
|
||||||
|
* When using the Ashikhmin-Shirley or Phong models, a conversion method is
|
||||||
* used to turn the specified $\alpha$ roughness value into the exponents
|
* used to turn the specified $\alpha$ roughness value into the exponents
|
||||||
* of these distributions. This is done in a way, such that the different
|
* of these distributions. This is done in a way, such that the different
|
||||||
* distributions all produce a similar appearance for the same value of $\alpha$.
|
* distributions all produce a similar appearance for the same value of
|
||||||
|
* $\alpha$.
|
||||||
|
*
|
||||||
|
* The Ashikhmin-Shirley microfacet distribution allows the specification
|
||||||
|
* of two distinct roughness values along the tangent and bitangent
|
||||||
|
* directions. This can be used to provide a material with a ``brushed''
|
||||||
|
* appearance. The alignment of the anisotropy will follow the UV
|
||||||
|
* parameterization of the underlying mesh\footnote{Therefore,
|
||||||
|
* such anisotropic materials cannot be applied to triangle meshes that
|
||||||
|
* are missing texture coordinates.}.
|
||||||
*
|
*
|
||||||
* When using this plugin, it is crucial that the scene contains
|
* When using this plugin, it is crucial that the scene contains
|
||||||
* meaningful and mutally compatible index of refraction changes---see
|
* meaningful and mutally compatible index of refraction changes---see
|
||||||
|
@ -116,7 +135,7 @@ MTS_NAMESPACE_BEGIN
|
||||||
* not always a perfect a perfect match to the underlying scattering distribution,
|
* not always a perfect a perfect match to the underlying scattering distribution,
|
||||||
* particularly for high roughness values and when the \texttt{ggx}
|
* particularly for high roughness values and when the \texttt{ggx}
|
||||||
* microfacet distribution is used. Hence, such renderings may
|
* microfacet distribution is used. Hence, such renderings may
|
||||||
* converge slowly.\vspace{1cm}
|
* converge slowly.
|
||||||
*
|
*
|
||||||
* \begin{xml}[caption=A material definition for ground glass, label=lst:roughdielectric-roughglass]
|
* \begin{xml}[caption=A material definition for ground glass, label=lst:roughdielectric-roughglass]
|
||||||
* <bsdf type="roughdielectric">
|
* <bsdf type="roughdielectric">
|
||||||
|
|
Loading…
Reference in New Issue