From eb416b6c1ccbe6b92b05df9805383a3610526768 Mon Sep 17 00:00:00 2001 From: Wenzel Jakob Date: Mon, 22 Oct 2012 22:41:10 -0400 Subject: [PATCH] added a 'none' conductor profile which has 100% reflectance regardless of the angle of incidence --- src/bsdfs/conductor.cpp | 20 +++++++++++++++----- src/bsdfs/roughconductor.cpp | 17 +++++++++++++---- 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/src/bsdfs/conductor.cpp b/src/bsdfs/conductor.cpp index da828747..061c44b9 100644 --- a/src/bsdfs/conductor.cpp +++ b/src/bsdfs/conductor.cpp @@ -19,6 +19,7 @@ #include #include #include +#include MTS_NAMESPACE_BEGIN @@ -70,6 +71,9 @@ MTS_NAMESPACE_BEGIN * coatings, which are not actually conductors. These materials can also * be used with this plugin, though note that the plugin will ignore any * refraction component that the actual material might have had. + * There is also a special material profile named \code{none}, which disables + * the computation of Fresnel reflectances and produces an idealized + * 100% reflecting mirror. * * When using this plugin, you should ideally compile Mitsuba with support for * spectral rendering to get the most accurate results. While it also works @@ -127,7 +131,7 @@ MTS_NAMESPACE_BEGIN * K, K\_palik & Polycrystalline potassium && W & Tungsten \\ * Li, Li\_palik & Lithium && \\ * MgO, MgO\_palik & Magnesium oxide && \\ - * Mo, Mo\_palik & Molybdenum && \\ + * Mo, Mo\_palik & Molybdenum && none & No mat. profile ($\to$ 100% reflecting mirror)\\ * \bottomrule * \end{tabular} * \caption{ @@ -151,11 +155,17 @@ public: props.getSpectrum("specularReflectance", Spectrum(1.0f))); std::string material = props.getString("material", "Cu"); + Spectrum materialEta, materialK; - materialEta.fromContinuousSpectrum(InterpolatedSpectrum( - fResolver->resolve("data/ior/" + material + ".eta.spd"))); - materialK.fromContinuousSpectrum(InterpolatedSpectrum( - fResolver->resolve("data/ior/" + material + ".k.spd"))); + if (boost::to_lower_copy(material) == "none") { + materialEta = Spectrum(0.0f); + materialK = Spectrum(1.0f); + } else { + materialEta.fromContinuousSpectrum(InterpolatedSpectrum( + fResolver->resolve("data/ior/" + material + ".eta.spd"))); + materialK.fromContinuousSpectrum(InterpolatedSpectrum( + fResolver->resolve("data/ior/" + material + ".k.spd"))); + } m_eta = props.getSpectrum("eta", materialEta); m_k = props.getSpectrum("k", materialK); diff --git a/src/bsdfs/roughconductor.cpp b/src/bsdfs/roughconductor.cpp index 2ccce5ff..f25b5de8 100644 --- a/src/bsdfs/roughconductor.cpp +++ b/src/bsdfs/roughconductor.cpp @@ -102,6 +102,9 @@ MTS_NAMESPACE_BEGIN * refraction information, this plugin can access a set of measured materials * for which visible-spectrum information was publicly available * (see \tblref{conductor-iors} for the full list). + * There is also a special material profile named \code{none}, which disables + * the computation of Fresnel reflectances and produces an idealized + * 100% reflecting mirror. * * When no parameters are given, the plugin activates the default settings, * which describe copper with a light amount of roughness modeled using a @@ -157,10 +160,16 @@ public: std::string material = props.getString("material", "Cu"); Spectrum materialEta, materialK; - materialEta.fromContinuousSpectrum(InterpolatedSpectrum( - fResolver->resolve("data/ior/" + material + ".eta.spd"))); - materialK.fromContinuousSpectrum(InterpolatedSpectrum( - fResolver->resolve("data/ior/" + material + ".k.spd"))); + + if (boost::to_lower_copy(material) == "none") { + materialEta = Spectrum(0.0f); + materialK = Spectrum(1.0f); + } else { + materialEta.fromContinuousSpectrum(InterpolatedSpectrum( + fResolver->resolve("data/ior/" + material + ".eta.spd"))); + materialK.fromContinuousSpectrum(InterpolatedSpectrum( + fResolver->resolve("data/ior/" + material + ".k.spd"))); + } m_eta = props.getSpectrum("eta", materialEta); m_k = props.getSpectrum("k", materialK);