BSDFs now flag spatially varying components

metadata
Wenzel Jakob 2011-07-13 17:40:26 +02:00
parent a92aa6b29a
commit ce9ad8515d
27 changed files with 176 additions and 71 deletions

View File

@ -6,6 +6,8 @@
<bsdf type="coating"> <bsdf type="coating">
<float name="intIOR" value="1.5"/> <float name="intIOR" value="1.5"/>
<float name="extIOR" value="1"/> <float name="extIOR" value="1"/>
<rgb name="sigmaA" value="0.1 0.2 0.3"/>
<float name="thickness" value="2"/>
<bsdf type="diffuse"/> <bsdf type="diffuse"/>
</bsdf> </bsdf>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

After

Width:  |  Height:  |  Size: 150 KiB

View File

@ -55,6 +55,10 @@ public:
return m_value; return m_value;
} }
inline bool isConstant() const {
return true;
}
inline std::string toString() const { inline std::string toString() const {
std::ostringstream oss; std::ostringstream oss;
oss << "ConstantSpectrumTexture[value=" << m_value.toString() << "]"; oss << "ConstantSpectrumTexture[value=" << m_value.toString() << "]";
@ -99,6 +103,10 @@ public:
return Spectrum(m_value); return Spectrum(m_value);
} }
inline bool isConstant() const {
return true;
}
inline std::string toString() const { inline std::string toString() const {
std::ostringstream oss; std::ostringstream oss;
oss << "ConstantFloatTexture[value=" << m_value << "]"; oss << "ConstantFloatTexture[value=" << m_value << "]";

View File

@ -225,10 +225,12 @@ public:
// ============================================================= // =============================================================
/// The lobe is not invariant to rotation around the normal /// The lobe is not invariant to rotation around the normal
EAnisotropic = 0x01000, EAnisotropic = 0x01000,
/// The BSDF depends on the UV coordinates
ESpatiallyVarying = 0x02000,
/// Supports interactions on the front-facing side /// Supports interactions on the front-facing side
EFrontSide = 0x02000, EFrontSide = 0x04000,
/// Supports interactions on the back-facing side /// Supports interactions on the back-facing side
EBackSide = 0x04000, EBackSide = 0x08000,
/// Can use an extra sampler instance to improve the sampling method /// Can use an extra sampler instance to improve the sampling method
ECanUseSampler = 0x10000 ECanUseSampler = 0x10000
//! @} //! @}
@ -276,7 +278,7 @@ public:
inline unsigned int getType(int component) const { inline unsigned int getType(int component) const {
return m_components[component]; return m_components[component];
} }
/** /**
* \brief Return the measure corresponding to a particular * \brief Return the measure corresponding to a particular
* component type * component type

View File

@ -43,6 +43,9 @@ public:
/// Return the resolution in pixels, if applicable /// Return the resolution in pixels, if applicable
virtual Vector3i getResolution() const; virtual Vector3i getResolution() const;
/// Return whether the texture takes on a single constant value
virtual bool isConstant() const = 0;
/** /**
* \brief Does this texture do pre-filtering when ray * \brief Does this texture do pre-filtering when ray
* differentials are available? * differentials are available?

View File

@ -30,37 +30,44 @@ MTS_NAMESPACE_BEGIN
* numerically or using a known material name. \default{\texttt{bk7} / 1.5046}} * numerically or using a known material name. \default{\texttt{bk7} / 1.5046}}
* \parameter{extIOR}{\Float\Or\String}{Exterior index of refraction specified * \parameter{extIOR}{\Float\Or\String}{Exterior index of refraction specified
* numerically or using a known material name. \default{\texttt{air} / 1.000277}} * numerically or using a known material name. \default{\texttt{air} / 1.000277}}
* \parameter{sigmaA}{\Spectrum\Or\Texture}{Absorption coefficient within the layer. \default{0}} * \parameter{thickness}{\Float}{Denotes the thickness of the absorbing layer (given in inverse units of \code{sigmaA})\default{1}}
* \parameter{thickness}{\Float}{Thickness of the absorbing layer (given 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}}
* } * }
* *
* \renderings{ * \renderings{
* \rendering{Coated rough copper (lower exposure, \lstref{coating-roughcopper})} * \rendering{Rough copper}
* {bsdf_roughconductor_copper}
* \rendering{The same material coated with a single layer of clear varnish (see \lstref{coating-roughcopper})}
* {bsdf_coating_roughconductor} * {bsdf_coating_roughconductor}
* \rendering{Coated rough plastic}
* {bsdf_coating_roughplastic}
* } * }
* *
* This plugin implements a smooth dielectric coating in the style of the * This plugin implements a smooth dielectric coating (e.g. a layer of varnish)
* paper ``Arbitrarily Layered Micro-Facet Surfaces'' by Weidlich and * in the style of the paper ``Arbitrarily Layered Micro-Facet Surfaces'' by
* Wilkie \cite{Weidlich2007Arbitrarily}. Any non-transmissive model can * Weidlich and Wilkie \cite{Weidlich2007Arbitrarily}. Any non-transmissive
* be coated, and multiple layers can be applied in sequence. This allows * BSDF in Mitsuba can be coated using this plugin, and multiple coating layers
* designing custom materials like car paint. * can be applied in sequence. This allows designing interesting custom materials
* like car paint or glazed metal foil. The coating layer can optionally be
* tinted (i.e. filled with an absorbing medium), in which case this model also
* accounts for the directionally dependent absorption within the layer.
* *
* The coating layer can optionally be filled with an absorbing medium, * Note that the plugin discards illumination that undergoes internal
* in which case this model also accounts for the directionally dependent * reflection within the coating. This can lead to a noticeable energy
* extinction within the layer. * loss for materials that reflect much of their energy near or below the critical
* angle (i.e. diffuse or very rough materials).
* Therefore, users are discouraged to use this plugin to coat smooth
* diffuse materials, since there is a separately available plugin
* named \pluginref{smoothplastic}, which covers the same case and does not
* suffer from energy loss.
* *
* Evaluating the internal component of this model entails refracting the * Evaluating the internal component of this model entails refracting the
* incident and exitant rays through the dielectric interface, followed by * incident and exitant rays through the dielectric interface, followed by
* querying the nested material with this modified direction pair. The result * querying the nested material with this modified direction pair. The result
* is attenuated by the two Fresnel transmittances. Note that this model does * is attenuated by the two Fresnel transmittances and the absorption, if any.
* not attempt to handle illumination that is reflected by the interior of the
* coating---this energy is essentially lost.
* *
* \vspace{4mm} * \vspace{4mm}
* *
* \begin{xml}[caption=Rough copper coated with a transparent layer of lacquer, label=lst:coating-roughcopper] * \begin{xml}[caption=Rough copper coated with a transparent layer of
* varnish, label=lst:coating-roughcopper]
* <bsdf type="coating"> * <bsdf type="coating">
* <float name="intIOR" value="1.7"/> * <float name="intIOR" value="1.7"/>
* <bsdf type="roughconductor"> * <bsdf type="roughconductor">
@ -79,13 +86,13 @@ public:
/* Specifies the external index of refraction at the interface */ /* Specifies the external index of refraction at the interface */
m_extIOR = lookupIOR(props, "extIOR", "air"); m_extIOR = lookupIOR(props, "extIOR", "air");
/* Specifies the absorption within the layer */
m_sigmaA = new ConstantSpectrumTexture(
props.getSpectrum("sigmaA", Spectrum(0.0f)));
/* Specifies the layer's thickness using the inverse units of sigmaA */ /* Specifies the layer's thickness using the inverse units of sigmaA */
m_thickness = props.getFloat("thickness", 1); m_thickness = props.getFloat("thickness", 1);
/* Specifies the absorption within the layer */
m_sigmaA = new ConstantSpectrumTexture(
props.getSpectrum("sigmaA", Spectrum(0.0f)));
} }
SmoothCoating(Stream *stream, InstanceManager *manager) SmoothCoating(Stream *stream, InstanceManager *manager)
@ -105,11 +112,26 @@ public:
Log(EError, "Tried to put a smooth coating layer on top of a BSDF " Log(EError, "Tried to put a smooth coating layer on top of a BSDF "
"with a transmission component -- this is currently not allowed!"); "with a transmission component -- this is currently not allowed!");
#if COMPENSATE
if (m_nested->getClass()->getName() == "SmoothDiffuse") {
/* For an ideally diffuse material, it is known how much
energy will be lost to total internal reflection */
m_compensation = (m_intIOR*m_intIOR) / (m_extIOR * m_extIOR);
} else {
/* Otherwise, give up (for now) */
m_compensation = 1.0f;
}
#endif
unsigned int extraFlags = 0;
if (!m_sigmaA->isConstant())
extraFlags |= ESpatiallyVarying;
m_components.clear(); m_components.clear();
for (int i=0; i<m_nested->getComponentCount(); ++i) for (int i=0; i<m_nested->getComponentCount(); ++i)
m_components.push_back(m_nested->getType(i)); m_components.push_back(m_nested->getType(i) | extraFlags);
m_components.push_back(EDeltaReflection | EFrontSide); m_components.push_back(EDeltaReflection | EFrontSide);
m_usesRayDifferentials = m_nested->usesRayDifferentials() m_usesRayDifferentials = m_nested->usesRayDifferentials()
|| m_sigmaA->usesRayDifferentials(); || m_sigmaA->usesRayDifferentials();
@ -206,9 +228,10 @@ public:
if (R12 == 1 || R21 == 1) /* Total internal reflection */ if (R12 == 1 || R21 == 1) /* Total internal reflection */
return Spectrum(0.0f); return Spectrum(0.0f);
Float eta = m_extIOR / m_intIOR;
Spectrum result = m_nested->eval(bRec2, measure) Spectrum result = m_nested->eval(bRec2, measure)
* ((1-R12) * (1-R21)); * ((1-R12) * (1-R21) * eta * eta);
Spectrum sigmaA = m_sigmaA->getValue(bRec.its) * m_thickness; Spectrum sigmaA = m_sigmaA->getValue(bRec.its) * m_thickness;
if (!sigmaA.isZero()) if (!sigmaA.isZero())
result *= (-sigmaA * result *= (-sigmaA *
@ -216,10 +239,12 @@ public:
1/std::abs(Frame::cosTheta(bRec2.wo)))).exp(); 1/std::abs(Frame::cosTheta(bRec2.wo)))).exp();
if (measure == ESolidAngle) if (measure == ESolidAngle)
result *= Frame::cosTheta(bRec2.wo); result *= Frame::cosTheta(bRec.wo)
/ Frame::cosTheta(bRec2.wo);
Float eta = m_extIOR / m_intIOR; #ifdef COMPENSATE
result *= eta * eta; result *= m_compensation;
#endif
return result; return result;
} }
@ -250,9 +275,11 @@ public:
if (R12 == 1 || R21 == 1) /* Total internal reflection */ if (R12 == 1 || R21 == 1) /* Total internal reflection */
return 0.0f; return 0.0f;
Float pdf = m_nested->pdf(bRec2, measure) Float pdf = m_nested->pdf(bRec2, measure);
* Frame::cosTheta(bRec.wo)
/ Frame::cosTheta(bRec2.wo); if (measure == ESolidAngle)
pdf *= Frame::cosTheta(bRec.wo)
/ Frame::cosTheta(bRec2.wo);
Float eta = m_extIOR / m_intIOR; Float eta = m_extIOR / m_intIOR;
pdf *= eta * eta; pdf *= eta * eta;
@ -324,11 +351,16 @@ public:
if (R21 == 1.0f) /* Total internal reflection */ if (R21 == 1.0f) /* Total internal reflection */
return Spectrum(0.0f); return Spectrum(0.0f);
bool sampledSA = (BSDF::getMeasure(bRec.sampledType) == ESolidAngle);
Float cosRatio = Frame::cosTheta(bRec.wo) / cosThetaWoPrime,
commonTerms = (sampledSA ? cosRatio : 1.0f)* eta * eta;
pdf *= (sampleSpecular ? (1 - R12) : 1.0f) * eta * eta * pdf *= (sampleSpecular ? (1 - R12) : 1.0f) * commonTerms;
Frame::cosTheta(bRec.wo) / cosThetaWoPrime; result *= (1 - R12) * (1 - R21) * commonTerms;
result *= (1 - R12) * (1 - R21) * cosThetaWoPrime * eta * eta; #ifdef COMPENSATE
result *= m_compensation;
#endif
return result; return result;
} }
@ -358,11 +390,14 @@ public:
} }
MTS_DECLARE_CLASS() MTS_DECLARE_CLASS()
private: protected:
Float m_intIOR, m_extIOR; Float m_intIOR, m_extIOR;
ref<Texture> m_sigmaA; ref<Texture> m_sigmaA;
ref<BSDF> m_nested; ref<BSDF> m_nested;
Float m_thickness; Float m_thickness;
#ifdef COMPENSATE
Float m_compensation;
#endif
}; };
MTS_IMPLEMENT_CLASS_S(SmoothCoating, false, BSDF) MTS_IMPLEMENT_CLASS_S(SmoothCoating, false, BSDF)

View File

@ -181,8 +181,9 @@ public:
m_specularReflectance->usesRayDifferentials(); m_specularReflectance->usesRayDifferentials();
m_components.clear(); m_components.clear();
m_components.push_back(EDeltaReflection | EFrontSide); m_components.push_back(EDeltaReflection | EFrontSide
| (m_specularReflectance->isConstant() ? 0 : ESpatiallyVarying));
BSDF::configure(); BSDF::configure();
} }

View File

@ -176,8 +176,10 @@ public:
m_specularTransmittance, "specularTransmittance", 1.0f); m_specularTransmittance, "specularTransmittance", 1.0f);
m_components.clear(); m_components.clear();
m_components.push_back(EDeltaReflection | EFrontSide | EBackSide); m_components.push_back(EDeltaReflection | EFrontSide | EBackSide
m_components.push_back(EDeltaTransmission | EFrontSide | EBackSide); | (m_specularReflectance->isConstant() ? 0 : ESpatiallyVarying));
m_components.push_back(EDeltaTransmission | EFrontSide | EBackSide
| (m_specularTransmittance->isConstant() ? 0 : ESpatiallyVarying));
m_usesRayDifferentials = m_usesRayDifferentials =
m_specularReflectance->usesRayDifferentials() || m_specularReflectance->usesRayDifferentials() ||

View File

@ -64,7 +64,8 @@ public:
m_transmittance = ensureEnergyConservation(m_transmittance, "transmittance", 1.0f); m_transmittance = ensureEnergyConservation(m_transmittance, "transmittance", 1.0f);
m_components.clear(); m_components.clear();
m_components.push_back(EDiffuseTransmission | EFrontSide | EBackSide); m_components.push_back(EDiffuseTransmission | EFrontSide | EBackSide
| (m_transmittance->isConstant() ? 0 : ESpatiallyVarying));
BSDF::configure(); BSDF::configure();
} }

View File

@ -93,7 +93,8 @@ public:
m_reflectance = ensureEnergyConservation(m_reflectance, "reflectance", 1.0f); m_reflectance = ensureEnergyConservation(m_reflectance, "reflectance", 1.0f);
m_components.clear(); m_components.clear();
m_components.push_back(EDiffuseReflection | EFrontSide); m_components.push_back(EDiffuseReflection | EFrontSide
| (m_reflectance->isConstant() ? 0 : ESpatiallyVarying));
m_usesRayDifferentials = m_reflectance->usesRayDifferentials(); m_usesRayDifferentials = m_reflectance->usesRayDifferentials();
BSDF::configure(); BSDF::configure();

View File

@ -122,8 +122,10 @@ public:
void configure() { void configure() {
m_components.clear(); m_components.clear();
m_components.push_back(EGlossyReflection | EAnisotropic | EFrontSide); m_components.push_back(EGlossyReflection | EFrontSide
m_components.push_back(EDiffuseReflection | EFrontSide); | EAnisotropic | ESpatiallyVarying);
m_components.push_back(EDiffuseReflection | EFrontSide
| ESpatiallyVarying);
BSDF::configure(); BSDF::configure();
} }

View File

@ -83,10 +83,17 @@ public:
void configure() { void configure() {
if (!m_nestedBSDF) if (!m_nestedBSDF)
Log(EError, "A child BSDF is required"); Log(EError, "A child BSDF is required");
unsigned int extraFlags = 0;
if (!m_opacity->isConstant())
extraFlags |= ESpatiallyVarying;
m_components.clear(); m_components.clear();
for (int i=0; i<m_nestedBSDF->getComponentCount(); ++i) for (int i=0; i<m_nestedBSDF->getComponentCount(); ++i)
m_components.push_back(m_nestedBSDF->getType(i)); m_components.push_back(m_nestedBSDF->getType(i) | extraFlags);
m_components.push_back(EDeltaTransmission | EFrontSide | EBackSide); m_components.push_back(EDeltaTransmission | EFrontSide
| EBackSide | extraFlags);
m_usesRayDifferentials = m_nestedBSDF->usesRayDifferentials(); m_usesRayDifferentials = m_nestedBSDF->usesRayDifferentials();
m_opacity = ensureEnergyConservation(m_opacity, "opacity", 1.0f); m_opacity = ensureEnergyConservation(m_opacity, "opacity", 1.0f);
BSDF::configure(); BSDF::configure();

View File

@ -28,8 +28,8 @@ MTS_NAMESPACE_BEGIN
* \parameter{weights}{\String}{A comma-separated list of BSDF weights} * \parameter{weights}{\String}{A comma-separated list of BSDF weights}
* } * }
* \renderings{ * \renderings{
* \rendering{An exemplary combination of BSDFs * \rendering{An admittedly not particularly realistic linear combination of
* (\lstref{mixture-example})}{bsdf_mixture_test} * diffuse and specular BSDFs (\lstref{mixture-example})}{bsdf_mixture_test}
* } * }
* *
* This plugin implements a ``mixture'' material, which represents * This plugin implements a ``mixture'' material, which represents

View File

@ -77,8 +77,11 @@ public:
void configure() { void configure() {
m_components.clear(); m_components.clear();
m_components.push_back(EGlossyReflection | EFrontSide); m_components.push_back(EGlossyReflection | EFrontSide |
m_components.push_back(EDiffuseReflection | EFrontSide); ((!m_specularReflectance->isConstant()
|| !m_exponent->isConstant()) ? ESpatiallyVarying : 0));
m_components.push_back(EDiffuseReflection | EFrontSide
| (m_diffuseReflectance->isConstant() ? 0 : ESpatiallyVarying));
/* Verify the input parameters and fix them if necessary */ /* Verify the input parameters and fix them if necessary */
std::pair<Texture *, Texture *> result = ensureEnergyConservation( std::pair<Texture *, Texture *> result = ensureEnergyConservation(
@ -230,7 +233,7 @@ public:
} }
Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const { Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const {
Float pdf; Float pdf = 0;
Spectrum result = Phong::sample(bRec, pdf, sample); Spectrum result = Phong::sample(bRec, pdf, sample);
if (result.isZero()) if (result.isZero())

View File

@ -103,8 +103,10 @@ public:
m_diffuseReflectance->usesRayDifferentials(); m_diffuseReflectance->usesRayDifferentials();
m_components.clear(); m_components.clear();
m_components.push_back(EDeltaReflection | EFrontSide); m_components.push_back(EDeltaReflection | EFrontSide
m_components.push_back(EDiffuseReflection | EFrontSide); | (m_specularReflectance->isConstant() ? 0 : ESpatiallyVarying));
m_components.push_back(EDiffuseReflection | EFrontSide
| (m_diffuseReflectance->isConstant() ? 0 : ESpatiallyVarying));
BSDF::configure(); BSDF::configure();
} }

View File

@ -205,10 +205,12 @@ public:
"anisotropic Ashikhmin-Shirley microfacet distribution " "anisotropic Ashikhmin-Shirley microfacet distribution "
"(named \"as\")"); "(named \"as\")");
} }
if (!m_alphaU->isConstant() || !m_alphaV->isConstant() ||
!m_specularReflectance->isConstant())
extraFlags |= ESpatiallyVarying;
m_components.clear(); m_components.clear();
m_components.push_back( m_components.push_back(EGlossyReflection | EFrontSide | extraFlags);
EGlossyReflection | EFrontSide | extraFlags);
/* Verify the input parameters and fix them if necessary */ /* Verify the input parameters and fix them if necessary */
m_specularReflectance = ensureEnergyConservation( m_specularReflectance = ensureEnergyConservation(

View File

@ -227,11 +227,16 @@ public:
"(named \"as\")"); "(named \"as\")");
} }
if (!m_alphaU->isConstant() || !m_alphaV->isConstant())
extraFlags |= ESpatiallyVarying;
m_components.clear(); m_components.clear();
m_components.push_back( m_components.push_back(EGlossyReflection | EFrontSide
EGlossyReflection | EFrontSide | EBackSide | ECanUseSampler | extraFlags); | EBackSide | ECanUseSampler | extraFlags
m_components.push_back( | (m_specularReflectance->isConstant() ? 0 : ESpatiallyVarying));
EGlossyTransmission | EFrontSide | EBackSide | ECanUseSampler | extraFlags); m_components.push_back(EGlossyTransmission | EFrontSide
| EBackSide | ECanUseSampler | extraFlags
| (m_specularTransmittance->isConstant() ? 0 : ESpatiallyVarying));
/* Verify the input parameters and fix them if necessary */ /* Verify the input parameters and fix them if necessary */
m_specularReflectance = ensureEnergyConservation( m_specularReflectance = ensureEnergyConservation(

View File

@ -107,9 +107,12 @@ public:
void configure() { void configure() {
/* Verify the input parameter and fix them if necessary */ /* Verify the input parameter and fix them if necessary */
m_reflectance = ensureEnergyConservation(m_reflectance, "reflectance", 1.0f); m_reflectance = ensureEnergyConservation(m_reflectance, "reflectance", 1.0f);
m_components.clear(); m_components.clear();
m_components.push_back(EGlossyReflection | EFrontSide); m_components.push_back(EGlossyReflection | EFrontSide
| ((!m_reflectance->isConstant() || !m_alpha->isConstant())
? ESpatiallyVarying : 0));
m_usesRayDifferentials = m_reflectance->usesRayDifferentials() || m_usesRayDifferentials = m_reflectance->usesRayDifferentials() ||
m_alpha->usesRayDifferentials(); m_alpha->usesRayDifferentials();

View File

@ -176,8 +176,11 @@ public:
void configure() { void configure() {
m_components.clear(); m_components.clear();
m_components.push_back(EGlossyReflection | EFrontSide);
m_components.push_back(EDiffuseReflection | EFrontSide); m_components.push_back(EGlossyReflection | EFrontSide
| (m_specularReflectance->isConstant() ? 0 : ESpatiallyVarying));
m_components.push_back(EDiffuseReflection | EFrontSide
| (m_diffuseReflectance->isConstant() ? 0 : ESpatiallyVarying));
/* Verify the input parameters and fix them if necessary */ /* Verify the input parameters and fix them if necessary */
m_specularReflectance = ensureEnergyConservation( m_specularReflectance = ensureEnergyConservation(
@ -357,7 +360,7 @@ public:
} }
Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const { Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const {
Float pdf; Float pdf = 0;
Spectrum result = RoughPlastic::sample(bRec, pdf, sample); Spectrum result = RoughPlastic::sample(bRec, pdf, sample);
if (result.isZero()) if (result.isZero())

View File

@ -140,8 +140,11 @@ public:
extraFlags |= EAnisotropic; extraFlags |= EAnisotropic;
m_components.clear(); m_components.clear();
m_components.push_back(EGlossyReflection | EFrontSide | extraFlags); m_components.push_back(EGlossyReflection | EFrontSide | extraFlags
m_components.push_back(EDiffuseReflection | EFrontSide | extraFlags); | ((!m_specularReflectance->isConstant() || !m_alphaU->isConstant()
|| !m_alphaV->isConstant()) ? ESpatiallyVarying : 0));
m_components.push_back(EDiffuseReflection | EFrontSide | extraFlags
| (m_diffuseReflectance->isConstant() ? 0 : ESpatiallyVarying));
/* Verify the input parameters and fix them if necessary */ /* Verify the input parameters and fix them if necessary */
std::pair<Texture *, Texture *> result = ensureEnergyConservation( std::pair<Texture *, Texture *> result = ensureEnergyConservation(

View File

@ -31,7 +31,7 @@ Texture::Texture(Stream *stream, InstanceManager *manager)
Vector3i Texture::getResolution() const { Vector3i Texture::getResolution() const {
return Vector3i(0); return Vector3i(0);
} }
Texture::~Texture() { Texture::~Texture() {
} }

View File

@ -256,6 +256,10 @@ public:
return m_maximum; return m_maximum;
} }
bool isConstant() const {
return false;
}
bool usesRayDifferentials() const { bool usesRayDifferentials() const {
return true; return true;
} }
@ -353,7 +357,7 @@ public:
void unbind() const { void unbind() const {
m_gpuTexture->unbind(); m_gpuTexture->unbind();
} }
MTS_DECLARE_CLASS() MTS_DECLARE_CLASS()
private: private:
ref<GPUTexture> m_gpuTexture; ref<GPUTexture> m_gpuTexture;

View File

@ -71,6 +71,10 @@ public:
return m_brightColor; return m_brightColor;
} }
bool isConstant() const {
return false;
}
std::string toString() const { std::string toString() const {
return "Checkerboard[]"; return "Checkerboard[]";
} }
@ -128,7 +132,7 @@ public:
program->setParameter(parameterIDs[2], m_uvOffset); program->setParameter(parameterIDs[2], m_uvOffset);
program->setParameter(parameterIDs[3], m_uvScale); program->setParameter(parameterIDs[3], m_uvScale);
} }
MTS_DECLARE_CLASS() MTS_DECLARE_CLASS()
private: private:
Spectrum m_brightColor; Spectrum m_brightColor;

View File

@ -79,6 +79,10 @@ public:
Spectrum getAverage() const { Spectrum getAverage() const {
return m_brightColor; // that's not quite right return m_brightColor; // that's not quite right
} }
bool isConstant() const {
return false;
}
std::string toString() const { std::string toString() const {
return "GridTexture[]"; return "GridTexture[]";

View File

@ -68,6 +68,10 @@ public:
return m_nested->getMaximum() * m_scale; return m_nested->getMaximum() * m_scale;
} }
bool isConstant() const {
return m_nested->isConstant();
}
std::string toString() const { std::string toString() const {
std::ostringstream oss; std::ostringstream oss;
oss << "ScalingTexture[" << endl oss << "ScalingTexture[" << endl

View File

@ -54,6 +54,10 @@ public:
return Spectrum(1.0f); return Spectrum(1.0f);
} }
bool isConstant() const {
return false;
}
std::string toString() const { std::string toString() const {
return "VertexColors[]"; return "VertexColors[]";
} }