diff --git a/src/bsdfs/dipolebrdf.cpp b/src/bsdfs/dipolebrdf.cpp index 9013c633..f8ace01a 100644 --- a/src/bsdfs/dipolebrdf.cpp +++ b/src/bsdfs/dipolebrdf.cpp @@ -53,6 +53,12 @@ public: m_sigmaA = new ConstantSpectrumTexture( props.getSpectrum("sigmaA", sigmaA)); + if (props.hasProperty("sigmaT")) + m_sigmaT = new ConstantSpectrumTexture( + props.getSpectrum("sigmaT")); + if (props.hasProperty("albedo")) + m_albedo = new ConstantSpectrumTexture( + props.getSpectrum("albedo")); } DipoleBRDF(Stream *stream, InstanceManager *manager) @@ -103,9 +109,6 @@ public: m_usesRayDifferentials = m_sigmaS->usesRayDifferentials() || m_sigmaA->usesRayDifferentials(); - if ((m_sigmaS->getMaximum()+m_sigmaA->getMaximum()).isZero()) - Log(EError, "Please specify nonzero sigmaS/sigmaA-values!"); - /* relative index of refraction */ const Float eta = m_intIOR / m_extIOR; diff --git a/src/bsdfs/hk.cpp b/src/bsdfs/hk.cpp index b02c3517..bb6ba2b5 100644 --- a/src/bsdfs/hk.cpp +++ b/src/bsdfs/hk.cpp @@ -125,9 +125,16 @@ public: /* Absorption coefficient of the layer */ m_sigmaA = new ConstantSpectrumTexture( props.getSpectrum("sigmaA", sigmaA)); - + /* Slab thickness in inverse units of sigmaS and sigmaA */ m_thickness = props.getFloat("thickness", 1); + + if (props.hasProperty("sigmaT")) + m_sigmaT = new ConstantSpectrumTexture( + props.getSpectrum("sigmaT")); + if (props.hasProperty("albedo")) + m_albedo = new ConstantSpectrumTexture( + props.getSpectrum("albedo")); } HanrahanKrueger(Stream *stream, InstanceManager *manager) @@ -156,14 +163,14 @@ public: m_albedo = NULL; } - if ((m_sigmaS->getMaximum()+m_sigmaA->getMaximum()).isZero()) - Log(EError, "Please specify nonzero sigmaS/sigmaA-values!"); - int extraFlags = m_sigmaS->isConstant() && m_sigmaA->isConstant() ? 0 : ESpatiallyVarying; m_components.clear(); m_components.push_back(EGlossyReflection | EFrontSide | EBackSide | ECanUseSampler | extraFlags); - m_components.push_back(EGlossyTransmission | EFrontSide | EBackSide | ECanUseSampler | extraFlags); - m_components.push_back(EDeltaTransmission | EFrontSide | EBackSide | ECanUseSampler | extraFlags); + + if (m_thickness != std::numeric_limits::infinity()) { + m_components.push_back(EGlossyTransmission | EFrontSide | EBackSide | ECanUseSampler | extraFlags); + m_components.push_back(EDeltaTransmission | EFrontSide | EBackSide | ECanUseSampler | extraFlags); + } m_usesRayDifferentials = m_sigmaS->usesRayDifferentials() || m_sigmaA->usesRayDifferentials(); @@ -231,7 +238,8 @@ public: /* Transmission component */ /* ==================================================================== */ - if (hasGlossyTransmission && transmission) { + if (hasGlossyTransmission && transmission + && m_thickness < std::numeric_limits::infinity()) { MediumSamplingRecord dummy; PhaseFunctionQueryRecord pRec(dummy,bRec.wi,bRec.wo); const Float phaseVal = m_phase->eval(pRec); diff --git a/src/bsdfs/sssbrdf.cpp b/src/bsdfs/sssbrdf.cpp index a1e4b2a0..afe41f95 100644 --- a/src/bsdfs/sssbrdf.cpp +++ b/src/bsdfs/sssbrdf.cpp @@ -137,8 +137,11 @@ public: m_coating->configure(); m_components.clear(); - for (int i=0; igetComponentCount(); ++i) - m_components.push_back(m_coating->getType(i)); + for (int i=0; igetComponentCount(); ++i) { + unsigned int type = m_coating->getType(i); + type &= ~BSDF::EBackSide; + m_components.push_back(type); + } BSDF::configure(); } } @@ -148,18 +151,26 @@ public: } Spectrum eval(const BSDFQueryRecord &bRec, EMeasure measure) const { + if (Frame::cosTheta(bRec.wi) <= 0 || Frame::cosTheta(bRec.wo) <= 0) + return Spectrum(0.0f); return m_coating->eval(bRec, measure); } Float pdf(const BSDFQueryRecord &bRec, EMeasure measure) const { + if (Frame::cosTheta(bRec.wi) <= 0 || Frame::cosTheta(bRec.wo) <= 0) + return 0.0f; return m_coating->pdf(bRec, measure); } Spectrum sample(BSDFQueryRecord &bRec, Float &pdf, const Point2 &sample) const { + if (Frame::cosTheta(bRec.wi) <= 0) + return Spectrum(0.0f); return m_coating->sample(bRec, pdf, sample); } Spectrum sample(BSDFQueryRecord &bRec, const Point2 &sample) const { + if (Frame::cosTheta(bRec.wi) <= 0) + return Spectrum(0.0f); return m_coating->sample(bRec, sample); } diff --git a/src/textures/vertexcolors.cpp b/src/textures/vertexcolors.cpp index 79fa0c68..b57f04a1 100644 --- a/src/textures/vertexcolors.cpp +++ b/src/textures/vertexcolors.cpp @@ -97,5 +97,5 @@ Shader *VertexColors::createShader(Renderer *renderer) const { MTS_IMPLEMENT_CLASS(VertexColorShader, false, Shader) MTS_IMPLEMENT_CLASS_S(VertexColors, false, Texture) -MTS_EXPORT_PLUGIN(VertexColors, "VertexColors texture"); +MTS_EXPORT_PLUGIN(VertexColors, "Vertex color texture"); MTS_NAMESPACE_END