sssbrdf improvements
parent
bc16235f6f
commit
9130f3ab0c
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<Float>::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<Float>::infinity()) {
|
||||
MediumSamplingRecord dummy;
|
||||
PhaseFunctionQueryRecord pRec(dummy,bRec.wi,bRec.wo);
|
||||
const Float phaseVal = m_phase->eval(pRec);
|
||||
|
|
|
@ -137,8 +137,11 @@ public:
|
|||
m_coating->configure();
|
||||
|
||||
m_components.clear();
|
||||
for (int i=0; i<m_coating->getComponentCount(); ++i)
|
||||
m_components.push_back(m_coating->getType(i));
|
||||
for (int i=0; i<m_coating->getComponentCount(); ++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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue