cleanups, yet another bugfix for the A-S model
parent
37770752ca
commit
d2f1d31aeb
|
@ -6,6 +6,14 @@
|
|||
|
||||
import os, re
|
||||
|
||||
def findOrderID(filename):
|
||||
f = open(filename)
|
||||
for line in f.readlines():
|
||||
match = re.match(r'.*\\order{([^}])}.*', line)
|
||||
if match != None:
|
||||
return int(match.group(1))
|
||||
return 1000
|
||||
|
||||
def process(target, filename):
|
||||
f = open(filename)
|
||||
inheader = False
|
||||
|
@ -36,9 +44,15 @@ def traverse(target, dirname, files):
|
|||
or suffix == 'converter' or suffix == 'qtgui':
|
||||
return
|
||||
|
||||
ordering = []
|
||||
for filename in files:
|
||||
if '.cpp' == os.path.splitext(filename)[1]:
|
||||
process(target,os.path.join(dirname, filename))
|
||||
fname = os.path.join(dirname, filename)
|
||||
ordering = ordering + [(findOrderID(fname), fname)]
|
||||
ordering = sorted(ordering, key = lambda entry: entry[0])
|
||||
|
||||
for entry in ordering:
|
||||
process(target, entry[1])
|
||||
|
||||
os.chdir(os.path.dirname(__file__))
|
||||
f = open('plugins_generated.tex', 'w')
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
% Macros that are used in the plugin documentation
|
||||
\newcommand{\plugin}[2]{\newpage\subsubsection{#2 (\texttt{#1})}\label{plg:#1}}
|
||||
\newcommand{\pluginref}[1]{\texttt{\hyperref[plg:#1]{#1}}}
|
||||
\newcommand{\order}[1]{} % Ignore
|
||||
|
||||
\newcommand{\Transform}{\texttt{transform}}
|
||||
\newcommand{\Spectrum}{\texttt{spectrum}}
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/*! \plugin{conductor}{Smooth conductor}
|
||||
/*!\plugin{conductor}{Smooth conductor}
|
||||
* \order{5}
|
||||
* \parameters{
|
||||
* \parameter{preset}{\String}{Name of a material preset, see
|
||||
* \tblref{conductor-iors}.\!\default{\texttt{Cu} / copper}}
|
||||
|
@ -71,9 +72,9 @@ MTS_NAMESPACE_BEGIN
|
|||
* separate measurements correponding to their two indices of
|
||||
* refraction (named ``ordinary'' and ``extraordinary ray'').
|
||||
*
|
||||
* When using this plugin, you should compile Mitsuba with support for spectral
|
||||
* renderings to get the most accurate results. While it also works in RGB mode,
|
||||
* the computations will be much more approximate in this case.
|
||||
* When using this plugin, you should ideally compile Mitsuba with support for
|
||||
* spectral renderings to get the most accurate results. While it also works
|
||||
* in RGB mode, the computations will be much more approximate in this case.
|
||||
*
|
||||
* \begin{xml}[caption=Material configuration for a smooth conductor with
|
||||
* measured gold data, label=lst:conductor-gold]
|
||||
|
@ -85,7 +86,8 @@ MTS_NAMESPACE_BEGIN
|
|||
* \end{xml}
|
||||
* \vspace{5mm}
|
||||
* It is also possible to load spectrally varying index of refraction data from
|
||||
* two external files (see \secref{format-spectra} for details on the file
|
||||
* two external files containing the real and imaginary components,
|
||||
* respectively (see \secref{format-spectra} for details on the file
|
||||
* format):
|
||||
* \begin{xml}[caption=Rendering a smooth conductor with custom data]
|
||||
* <shape type="...">
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/*! \plugin{dielectric}{Smooth dielectric material}
|
||||
*
|
||||
/*!\plugin{dielectric}{Smooth dielectric material}
|
||||
* \order{4}
|
||||
* \parameters{
|
||||
* \parameter{intIOR}{\Float\Or\String}{Interior index of refraction specified
|
||||
* numerically or using a known material name. \default{\texttt{bk7} / 1.5046}}
|
||||
|
@ -45,7 +45,7 @@ MTS_NAMESPACE_BEGIN
|
|||
*
|
||||
* This plugin models an interface between two dielectric materials having mismatched
|
||||
* indices of refraction (for instance, water and air). Exterior and interior IOR values
|
||||
* can be independently specified, where ``exterior'' refers to the side that contains
|
||||
* can be specified independently, where ``exterior'' refers to the side that contains
|
||||
* the surface normal. When no parameters are given, the plugin activates the defaults, which
|
||||
* describe a borosilicate glass BK7/air interface.
|
||||
*
|
||||
|
@ -126,11 +126,11 @@ MTS_NAMESPACE_BEGIN
|
|||
* \caption{
|
||||
* \label{tbl:dielectric-iors}
|
||||
* This table lists all supported material names along with
|
||||
* along with the associated index of refraction at
|
||||
* standard conditions. These can be used with the plugins
|
||||
* along with their associated index of refraction at standard
|
||||
* conditions. These material names can be used with the plugins
|
||||
* \pluginref{dielectric},\
|
||||
* \pluginref{roughdielectric},\
|
||||
* \pluginref{plastic}, and
|
||||
* \pluginref{plastic}, as well as
|
||||
* \pluginref{roughplastic}.
|
||||
* }
|
||||
* \end{table}
|
||||
|
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
MTS_NAMESPACE_BEGIN
|
||||
|
||||
/*! \plugin{diffuse}{Smooth diffuse material}
|
||||
*
|
||||
/*!\plugin{diffuse}{Smooth diffuse material}
|
||||
* \order{1}
|
||||
* \parameters{
|
||||
* \lastparameter{reflectance}{\Spectrum\Or\Texture}{
|
||||
* Specifies the diffuse reflectance / albedo of the material \linebreak(Default: 0.5)
|
||||
|
@ -35,7 +35,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* \rendering{Textured reflectance, see \lstref{diffuse-textured}}{bsdf_diffuse_textured}
|
||||
* }
|
||||
*
|
||||
* The smooth diffuse material (often referred to as ``Lambertian'' materials)
|
||||
* The smooth diffuse material (sometimes referred to as ``Lambertian'')
|
||||
* represents an ideally diffuse material with a user-specified amount of
|
||||
* reflectance. Any received illumination is scattered so that the surface
|
||||
* looks the same independently of the direction of observation.
|
||||
|
@ -49,14 +49,15 @@ MTS_NAMESPACE_BEGIN
|
|||
* Note that this material is one-sided---that is, observed from the
|
||||
* back side, it will be completely black. If this is undesirable,
|
||||
* consider using the \pluginref{twosided} BRDF adapter plugin.
|
||||
* \vspace{4mm}
|
||||
*
|
||||
* \begin{xml}[caption=Reflectance specified as an sRGB color, label=lst:diffuse-uniform]
|
||||
* \begin{xml}[caption={A diffuse material, whose reflectance is specified as an sRGB color}, label=lst:diffuse-uniform]
|
||||
* <bsdf type="diffuse">
|
||||
* <srgb name="reflectance" value="#6d7185"/>
|
||||
* </bsdf>
|
||||
* \end{xml}
|
||||
*
|
||||
* \begin{xml}[caption=Diffuse material with a texture map, label=lst:diffuse-textured]
|
||||
* \begin{xml}[caption=A diffuse material with a texture map, label=lst:diffuse-textured]
|
||||
* <bsdf type="diffuse">
|
||||
* <texture type="bitmap" name="reflectance">
|
||||
* <string name="filename" value="wood.jpg"/>
|
||||
|
|
|
@ -322,6 +322,11 @@ public:
|
|||
return smithG1(wi, m, alphaU)
|
||||
* smithG1(wo, m, alphaU);
|
||||
} else {
|
||||
/* Can't see the back side from the front and vice versa */
|
||||
if (dot(wi, m) * Frame::cosTheta(wi) <= 0 ||
|
||||
dot(wo, m) * Frame::cosTheta(wo) <= 0)
|
||||
return 0.0f;
|
||||
|
||||
/* Infinite groove shadowing/masking */
|
||||
const Float nDotM = std::abs(Frame::cosTheta(m)),
|
||||
nDotWo = std::abs(Frame::cosTheta(wo)),
|
||||
|
|
|
@ -33,7 +33,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*/
|
||||
#define ENLARGE_LOBE_TRICK 0
|
||||
|
||||
/*! \plugin{roughconductor}{Rough conductor material}
|
||||
/*!\plugin{roughconductor}{Rough conductor material}
|
||||
* \order{6}
|
||||
* \parameters{
|
||||
* \parameter{distribution}{\String}{
|
||||
* Specifies the type of microfacet normal distribution
|
||||
|
|
|
@ -30,7 +30,8 @@ MTS_NAMESPACE_BEGIN
|
|||
*/
|
||||
#define ENLARGE_LOBE_TRICK 1
|
||||
|
||||
/*! \plugin{roughdielectric}{Rough dielectric material}
|
||||
/*!\plugin{roughdielectric}{Rough dielectric material}
|
||||
* \order{4}
|
||||
* \parameters{
|
||||
* \parameter{distribution}{\String}{
|
||||
* Specifies the type of microfacet normal distribution
|
||||
|
@ -70,7 +71,7 @@ MTS_NAMESPACE_BEGIN
|
|||
* factor used to modulate the reflectance component\default{1.0}}
|
||||
* \lastparameter{specular\showbreak Transmittance}{\Spectrum\Or\Texture}{Optional
|
||||
* factor used to modulate the transmittance component\default{1.0}}
|
||||
* }
|
||||
* }\vspace{4mm}
|
||||
*
|
||||
* This plugin implements a realistic microfacet scattering model for rendering
|
||||
* rough interfaces between dielectric materials, such as a transition from air to
|
||||
|
@ -81,12 +82,10 @@ MTS_NAMESPACE_BEGIN
|
|||
* off-specular reflections peaks observed in real-world measurements of such
|
||||
* materials.
|
||||
* \renderings{
|
||||
* \medrendering{Rough glass (Beckmann, $\alpha$=0.1)}
|
||||
* \rendering{Anti-glare glass (Beckmann, $\alpha=0.02$)}
|
||||
* {bsdf_roughdielectric_beckmann_0_0_2.jpg}
|
||||
* \rendering{Rough glass (Beckmann, $\alpha=0.1$)}
|
||||
* {bsdf_roughdielectric_beckmann_0_1.jpg}
|
||||
* \medrendering{Ground glass (GGX, $\alpha$=0.304,
|
||||
* \lstref{roughdielectric-roughglass})}{bsdf_roughdielectric_ggx_0_304.jpg}
|
||||
* \medrendering{Textured rougness (\lstref{roughdielectric-textured})}
|
||||
* {bsdf_roughdielectric_textured.jpg}
|
||||
* }
|
||||
*
|
||||
* This plugin is essentially the ``roughened'' equivalent of the (smooth) plugin
|
||||
|
@ -94,11 +93,11 @@ MTS_NAMESPACE_BEGIN
|
|||
* be very similar, though scenes using this plugin will take longer to render
|
||||
* due to the additional computational burden of tracking surface roughness.
|
||||
*
|
||||
* The implementation of this plugin is based on the paper ``Microfacet Models
|
||||
* The implementation is based on the paper ``Microfacet Models
|
||||
* for Refraction through Rough Surfaces'' by Walter et al.
|
||||
* \cite{Walter07Microfacet}. It supports several different types of microfacet
|
||||
* distributions and has a texturable roughness parameter. Exterior and
|
||||
* interior IOR values can be independently specified, where ``exterior''
|
||||
* interior IOR values can be specified independently, 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
|
||||
|
@ -107,16 +106,28 @@ MTS_NAMESPACE_BEGIN
|
|||
* glass BK7/air interface with a light amount of roughness modeled using a
|
||||
* Beckmann distribution.
|
||||
*
|
||||
* 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
|
||||
* To get an intuition about the effect of the surface roughness
|
||||
* parameter $\alpha$, consider the following approximate differentiation:
|
||||
* a value of $\alpha=0.001-0.01$ corresponds to 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
|
||||
* and $\alpha=0.3-0.5$ is \emph{extremely} rough (e.g. an 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
|
||||
* of these distributions. This is done in a way, such that the different
|
||||
* Please note that when using this plugin, it is crucial that the scene contains
|
||||
* meaningful and mutally compatible index of refraction changes---see
|
||||
* \figref{glass-explanation} for an example of what this entails. Also, note that
|
||||
* the importance sampling implementation of this model is close, but
|
||||
* not always a perfect a perfect match to the underlying scattering distribution,
|
||||
* particularly for high roughness values and when the \texttt{ggx}
|
||||
* microfacet distribution is used. Hence, such renderings may
|
||||
* converge slowly.
|
||||
*
|
||||
* \subsubsection*{Techical details}
|
||||
* When rendering with the Ashikhmin-Shirley or Phong microfacet
|
||||
* distributions, a conversion is used to turn the specified
|
||||
* $\alpha$ roughness value into the exponents 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$.
|
||||
*
|
||||
|
@ -124,18 +135,16 @@ MTS_NAMESPACE_BEGIN
|
|||
* 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.}.
|
||||
* parameterization of the underlying mesh in this case. This means that
|
||||
* such an anisotropic material cannot be applied to triangle meshes that
|
||||
* are missing texture coordinates.\newpage
|
||||
*
|
||||
* When using this plugin, it is crucial that the scene contains
|
||||
* meaningful and mutally compatible index of refraction changes---see
|
||||
* \figref{glass-explanation} for an example. Also, please note that
|
||||
* the importance sampling implementation of this model is close, but
|
||||
* not always a perfect a perfect match to the underlying scattering distribution,
|
||||
* particularly for high roughness values and when the \texttt{ggx}
|
||||
* microfacet distribution is used. Hence, such renderings may
|
||||
* converge slowly.
|
||||
* \renderings{
|
||||
* \rendering{Ground glass (GGX, $\alpha$=0.304,
|
||||
* \lstref{roughdielectric-roughglass})}{bsdf_roughdielectric_ggx_0_304.jpg}
|
||||
* \rendering{Textured rougness (\lstref{roughdielectric-textured})}
|
||||
* {bsdf_roughdielectric_textured.jpg}
|
||||
* }
|
||||
*
|
||||
* \begin{xml}[caption=A material definition for ground glass, label=lst:roughdielectric-roughglass]
|
||||
* <bsdf type="roughdielectric">
|
||||
|
|
|
@ -171,7 +171,8 @@ std::string Statistics::getStats() {
|
|||
float baseValue = (float) counter->getBase();
|
||||
int suffixIndex = 0, suffixIndex2 = 0;
|
||||
|
||||
if (value == 0 && counter->getType() != EPercentage)
|
||||
if ((counter->getType() != EPercentage && value == 0) ||
|
||||
(counter->getType() == EPercentage && baseValue == 0))
|
||||
continue;
|
||||
|
||||
if (category != counter->getCategory()) {
|
||||
|
|
Loading…
Reference in New Issue