slight tweaks to the BSDF API, components now specify whether they are front or back-facing
parent
44a928f1e5
commit
c34ad9f58a
|
@ -99,13 +99,24 @@ public:
|
||||||
*/
|
*/
|
||||||
enum EBSDFType {
|
enum EBSDFType {
|
||||||
EUnknown = 0x0000,
|
EUnknown = 0x0000,
|
||||||
EDiffuseReflection = 0x0001, /* Perfect diffuse reflection */
|
/// Perfect diffuse reflection
|
||||||
EDiffuseTransmission = 0x0002, /* Perfect diffuse transmission */
|
EDiffuseReflection = 0x0001,
|
||||||
EDeltaReflection = 0x0004, /* Reflection using a delta function */
|
/// Perfect diffuse transmission
|
||||||
EDeltaTransmission = 0x0008, /* Transmission using a delta function */
|
EDiffuseTransmission = 0x0002,
|
||||||
EGlossyReflection = 0x0010, /* Glossy reflection */
|
/// Reflection using a delta function
|
||||||
EGlossyTransmission = 0x0020, /* Glossy transmission */
|
EDeltaReflection = 0x0004,
|
||||||
EAnisotropicMaterial = 0x1000 /* Reflection is not invariant to rotation */
|
/// Transmission using a delta function
|
||||||
|
EDeltaTransmission = 0x0008,
|
||||||
|
/// Glossy reflection
|
||||||
|
EGlossyReflection = 0x0010,
|
||||||
|
/// Glossy transmission
|
||||||
|
EGlossyTransmission = 0x0020,
|
||||||
|
/// Reflection is not invariant to rotation
|
||||||
|
EAnisotropic = 0x1000,
|
||||||
|
/// Supports interactions on the front-facing side
|
||||||
|
EFrontSide = 0x2000,
|
||||||
|
/// Supports interactions on the back-facing side
|
||||||
|
EBackSide = 0x4000
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Type combinations
|
/// Type combinations
|
||||||
|
|
|
@ -112,8 +112,8 @@ public:
|
||||||
for (int j=0; j<bsdf->getComponentCount(); ++j) {
|
for (int j=0; j<bsdf->getComponentCount(); ++j) {
|
||||||
int componentType = bsdf->getType(j);
|
int componentType = bsdf->getType(j);
|
||||||
m_type[offset+j] = componentType;
|
m_type[offset+j] = componentType;
|
||||||
m_combinedType |= componentType;
|
|
||||||
}
|
}
|
||||||
|
m_combinedType |= bsdf->getType();
|
||||||
offset += bsdf->getComponentCount();
|
offset += bsdf->getComponentCount();
|
||||||
m_usesRayDifferentials |= bsdf->usesRayDifferentials();
|
m_usesRayDifferentials |= bsdf->usesRayDifferentials();
|
||||||
m_pdf[i] = m_bsdfWeight[i];
|
m_pdf[i] = m_bsdfWeight[i];
|
||||||
|
|
|
@ -45,8 +45,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDeltaReflection;
|
m_type[0] = EDeltaReflection | EFrontSide;
|
||||||
m_type[1] = EDeltaTransmission;
|
m_type[1] = EDeltaTransmission | EFrontSide | EBackSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDeltaReflection;
|
m_type[0] = EDeltaReflection | EFrontSide;
|
||||||
m_type[1] = EDeltaTransmission;
|
m_type[1] = EDeltaTransmission | EFrontSide | EBackSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
@ -246,8 +246,10 @@ public:
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Dielectric[" << endl
|
oss << "Dielectric[" << endl
|
||||||
<< " intIOR=" << m_intIOR << "," << endl
|
<< " intIOR = " << m_intIOR << "," << endl
|
||||||
<< " extIOR=" << m_extIOR << endl
|
<< " extIOR = " << m_extIOR << "," << endl
|
||||||
|
<< " reflectance = " << m_reflectance.toString() << "," << endl
|
||||||
|
<< " transmittance = " << m_transmittance.toString() << endl
|
||||||
<< "]";
|
<< "]";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public:
|
||||||
props.getSpectrum("transmittance", Spectrum(.5f)));
|
props.getSpectrum("transmittance", Spectrum(.5f)));
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EDiffuseTransmission;
|
m_combinedType = m_type[0] = EDiffuseTransmission | EFrontSide | EBackSide;
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ public:
|
||||||
m_transmittance = static_cast<Texture *>(manager->getInstance(stream));
|
m_transmittance = static_cast<Texture *>(manager->getInstance(stream));
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EDiffuseTransmission;
|
m_combinedType = m_type[0] = EDiffuseTransmission | EFrontSide | EBackSide;
|
||||||
m_usesRayDifferentials = m_transmittance->usesRayDifferentials();
|
m_usesRayDifferentials = m_transmittance->usesRayDifferentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,7 +113,9 @@ public:
|
||||||
|
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "DiffuseTransmitter[transmittance=" << m_transmittance->toString() << "]";
|
oss << "DiffuseTransmitter[" << endl
|
||||||
|
<< " transmittance = " << indent(m_transmittance->toString()) << endl
|
||||||
|
<< "]";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ public:
|
||||||
: BSDF(props) {
|
: BSDF(props) {
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EGlossyReflection;
|
m_type[0] = m_combinedType = EGlossyReflection | EFrontSide | EAnisotropic;
|
||||||
m_usesRayDifferentials = true;
|
m_usesRayDifferentials = true;
|
||||||
|
|
||||||
FileResolver *fResolver = Thread::getThread()->getFileResolver();
|
FileResolver *fResolver = Thread::getThread()->getFileResolver();
|
||||||
|
@ -94,7 +94,7 @@ public:
|
||||||
m_ksMultiplier = stream->readFloat();
|
m_ksMultiplier = stream->readFloat();
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EGlossyReflection | EAnisotropicMaterial;
|
m_type[0] = m_combinedType = EGlossyReflection | EFrontSide | EAnisotropic;
|
||||||
m_usesRayDifferentials = true;
|
m_usesRayDifferentials = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ public:
|
||||||
props.getSpectrum("reflectance", Spectrum(.5f)));
|
props.getSpectrum("reflectance", Spectrum(.5f)));
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EDiffuseReflection;
|
m_combinedType = m_type[0] = EDiffuseReflection | EFrontSide;
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ public:
|
||||||
m_reflectance = static_cast<Texture *>(manager->getInstance(stream));
|
m_reflectance = static_cast<Texture *>(manager->getInstance(stream));
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EDiffuseReflection;
|
m_combinedType = m_type[0] = EDiffuseReflection | EFrontSide;
|
||||||
m_usesRayDifferentials = m_reflectance->usesRayDifferentials();
|
m_usesRayDifferentials = m_reflectance->usesRayDifferentials();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,13 +55,15 @@ public:
|
||||||
BSDF::configure();
|
BSDF::configure();
|
||||||
if (!m_nestedBSDF)
|
if (!m_nestedBSDF)
|
||||||
Log(EError, "A child BSDF is required");
|
Log(EError, "A child BSDF is required");
|
||||||
m_combinedType = m_nestedBSDF->getType() | EDeltaTransmission;
|
|
||||||
m_usesRayDifferentials = m_nestedBSDF->usesRayDifferentials();
|
m_usesRayDifferentials = m_nestedBSDF->usesRayDifferentials();
|
||||||
m_componentCount = m_nestedBSDF->getComponentCount() + 1;
|
m_componentCount = m_nestedBSDF->getComponentCount() + 1;
|
||||||
|
if (m_type)
|
||||||
|
delete[] m_type;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
for (int i=0; i<m_nestedBSDF->getComponentCount(); ++i)
|
for (int i=0; i<m_nestedBSDF->getComponentCount(); ++i)
|
||||||
m_type[i] = m_nestedBSDF->getType(i);
|
m_type[i] = m_nestedBSDF->getType(i);
|
||||||
m_type[m_nestedBSDF->getComponentCount()] = EDeltaTransmission;
|
m_type[m_nestedBSDF->getComponentCount()] = EDeltaTransmission | EFrontSide | EBackSide;
|
||||||
|
m_combinedType = m_nestedBSDF->getType() | m_type[m_nestedBSDF->getComponentCount()];
|
||||||
}
|
}
|
||||||
|
|
||||||
Spectrum getDiffuseReflectance(const Intersection &its) const {
|
Spectrum getDiffuseReflectance(const Intersection &its) const {
|
||||||
|
@ -170,6 +172,14 @@ public:
|
||||||
|
|
||||||
Shader *createShader(Renderer *renderer) const;
|
Shader *createShader(Renderer *renderer) const;
|
||||||
|
|
||||||
|
std::string toString() const {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << "Mask[" << endl
|
||||||
|
<< " opacity = " << indent(m_opacity->toString()) << "," << endl
|
||||||
|
<< " nestedBSDF = " << indent(m_nestedBSDF.toString()) << endl
|
||||||
|
<< "]";
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
MTS_DECLARE_CLASS()
|
MTS_DECLARE_CLASS()
|
||||||
protected:
|
protected:
|
||||||
ref<Texture> m_opacity;
|
ref<Texture> m_opacity;
|
||||||
|
|
|
@ -52,8 +52,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDiffuseReflection;
|
m_type[0] = EDiffuseReflection | EFrontSide;
|
||||||
m_type[1] = EGlossyReflection;
|
m_type[1] = EGlossyReflection | EFrontSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials =
|
m_usesRayDifferentials =
|
||||||
m_diffuseReflectance->usesRayDifferentials() ||
|
m_diffuseReflectance->usesRayDifferentials() ||
|
||||||
|
@ -72,8 +72,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDiffuseReflection;
|
m_type[0] = EDiffuseReflection | EFrontSide;
|
||||||
m_type[1] = EGlossyReflection;
|
m_type[1] = EGlossyReflection | EFrontSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials =
|
m_usesRayDifferentials =
|
||||||
m_diffuseReflectance->usesRayDifferentials() ||
|
m_diffuseReflectance->usesRayDifferentials() ||
|
||||||
|
|
|
@ -30,8 +30,7 @@ public:
|
||||||
m_reflectance = props.getSpectrum("specularReflectance", Spectrum(0.8f));
|
m_reflectance = props.getSpectrum("specularReflectance", Spectrum(0.8f));
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDeltaReflection;
|
m_type[0] = m_combinedType = EDeltaReflection | EFrontSide;
|
||||||
m_combinedType = m_type[0];
|
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +39,8 @@ public:
|
||||||
m_reflectance = Spectrum(stream);
|
m_reflectance = Spectrum(stream);
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDeltaReflection;
|
m_type[0] = m_combinedType = EDeltaReflection | EFrontSide;
|
||||||
m_combinedType = m_type[0];
|
m_combinedType = m_type[0] | EFrontSide;
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +93,13 @@ public:
|
||||||
return m_reflectance;
|
return m_reflectance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string toString() const {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << "Mirror[" << endl
|
||||||
|
<< " reflectance = " << m_reflectance.toString() << endl
|
||||||
|
<< "]";
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
MTS_DECLARE_CLASS()
|
MTS_DECLARE_CLASS()
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -46,8 +46,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDiffuseReflection;
|
m_type[0] = EDeltaReflection | EFrontSide;
|
||||||
m_type[1] = EGlossyReflection;
|
m_type[1] = EDeltaTransmission | EFrontSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDiffuseReflection;
|
m_type[0] = EDeltaReflection | EFrontSide;
|
||||||
m_type[1] = EGlossyReflection;
|
m_type[1] = EDeltaTransmission | EFrontSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials =
|
m_usesRayDifferentials =
|
||||||
m_diffuseReflectance->usesRayDifferentials() ||
|
m_diffuseReflectance->usesRayDifferentials() ||
|
||||||
|
|
|
@ -40,8 +40,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EGlossyReflection;
|
m_type[0] = EDeltaReflection | EFrontSide | EBackSide;
|
||||||
m_type[1] = EGlossyTransmission;
|
m_type[1] = EDeltaTransmission | EFrontSide | EBackSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,8 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EGlossyReflection;
|
m_type[0] = EDeltaReflection | EFrontSide | EBackSide;
|
||||||
m_type[1] = EGlossyTransmission;
|
m_type[1] = EDeltaTransmission | EFrontSide | EBackSide;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
@ -398,11 +398,11 @@ public:
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "RoughGlass[" << std::endl
|
oss << "RoughGlass[" << std::endl
|
||||||
<< " specularReflectance=" << m_specularReflectance.toString() << "," << std::endl
|
<< " specularReflectance = " << m_specularReflectance.toString() << "," << std::endl
|
||||||
<< " specularTransmittance=" << m_specularTransmittance.toString() << "," << std::endl
|
<< " specularTransmittance = " << m_specularTransmittance.toString() << "," << std::endl
|
||||||
<< " intIOR=" << m_intIOR << "," << std::endl
|
<< " intIOR = " << m_intIOR << "," << std::endl
|
||||||
<< " extIOR=" << m_extIOR << "," << std::endl
|
<< " extIOR = " << m_extIOR << "," << std::endl
|
||||||
<< " alphaB=" << m_alphaB << std::endl
|
<< " alphaB = " << m_alphaB << std::endl
|
||||||
<< "]";
|
<< "]";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
|
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EGlossyReflection;
|
m_combinedType = m_type[0] = EGlossyReflection | EFrontSide;
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ public:
|
||||||
|
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_combinedType = m_type[0] = EGlossyReflection;
|
m_combinedType = m_type[0] = EGlossyReflection | EFrontSide;
|
||||||
m_usesRayDifferentials =
|
m_usesRayDifferentials =
|
||||||
m_specularReflectance->usesRayDifferentials();
|
m_specularReflectance->usesRayDifferentials();
|
||||||
}
|
}
|
||||||
|
@ -187,7 +187,7 @@ public:
|
||||||
std::string toString() const {
|
std::string toString() const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "RoughMetal[" << endl
|
oss << "RoughMetal[" << endl
|
||||||
<< " specularReflectance=" << m_specularReflectance.toString() << "," << std::endl
|
<< " specularReflectance = " << indent(m_specularReflectance->toString()) << "," << std::endl
|
||||||
<< " ior = " << m_ior.toString() << "," << std::endl
|
<< " ior = " << m_ior.toString() << "," << std::endl
|
||||||
<< " k = " << m_k.toString() << "," << std::endl
|
<< " k = " << m_k.toString() << "," << std::endl
|
||||||
<< " alphaB = " << m_alphaB << std::endl
|
<< " alphaB = " << m_alphaB << std::endl
|
||||||
|
|
|
@ -30,8 +30,7 @@ public:
|
||||||
m_transmission = props.getSpectrum("transmission", Spectrum(0.8f));
|
m_transmission = props.getSpectrum("transmission", Spectrum(0.8f));
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDeltaTransmission;
|
m_combinedType = m_type[0] = EDeltaTransmission | EFrontSide | EBackSide;
|
||||||
m_combinedType = m_type[0];
|
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ public:
|
||||||
m_componentCount = 1;
|
m_componentCount = 1;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDeltaTransmission;
|
m_type[0] = EDeltaTransmission;
|
||||||
m_combinedType = m_type[0];
|
m_combinedType = m_type[0] = EDeltaTransmission | EFrontSide | EBackSide;
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,6 +98,14 @@ public:
|
||||||
return m_transmission;
|
return m_transmission;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string toString() const {
|
||||||
|
std::ostringstream oss;
|
||||||
|
oss << "Transparent[" << endl
|
||||||
|
<< " transmission = " << m_transmission.toString() << endl
|
||||||
|
<< "]";
|
||||||
|
return oss.str();
|
||||||
|
}
|
||||||
|
|
||||||
MTS_DECLARE_CLASS()
|
MTS_DECLARE_CLASS()
|
||||||
protected:
|
protected:
|
||||||
Spectrum m_transmission;
|
Spectrum m_transmission;
|
||||||
|
|
|
@ -47,15 +47,19 @@ public:
|
||||||
void configure() {
|
void configure() {
|
||||||
if (!m_nestedBRDF)
|
if (!m_nestedBRDF)
|
||||||
Log(EError, "TwoSidedBRDF: A child BRDF instance is required");
|
Log(EError, "TwoSidedBRDF: A child BRDF instance is required");
|
||||||
m_combinedType = m_nestedBRDF->getType();
|
|
||||||
if (m_combinedType & BSDF::ETransmission)
|
if (m_combinedType & BSDF::ETransmission)
|
||||||
Log(EError, "TwoSidedBRDF: only BRDF child instances (without "
|
Log(EError, "TwoSidedBRDF: only BRDF child instances (without "
|
||||||
"transmission) are supported");
|
"transmission) are supported");
|
||||||
m_usesRayDifferentials = m_nestedBRDF->usesRayDifferentials();
|
m_usesRayDifferentials = m_nestedBRDF->usesRayDifferentials();
|
||||||
m_componentCount = m_nestedBRDF->getComponentCount();
|
m_componentCount = m_nestedBRDF->getComponentCount();
|
||||||
|
if (m_type)
|
||||||
|
delete[] m_type;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
for (int i=0; i<m_nestedBRDF->getComponentCount(); ++i)
|
m_combinedType = 0;
|
||||||
m_type[i] = m_nestedBRDF->getType(i);
|
for (int i=0; i<m_nestedBRDF->getComponentCount(); ++i) {
|
||||||
|
m_type[i] = m_nestedBRDF->getType(i) | EFrontSide | EBackSide;
|
||||||
|
m_combinedType |= m_type[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Spectrum getDiffuseReflectance(const Intersection &its) const {
|
Spectrum getDiffuseReflectance(const Intersection &its) const {
|
||||||
|
|
|
@ -49,12 +49,10 @@ public:
|
||||||
m_alphaY = props.getFloat("alphaY", .1f);
|
m_alphaY = props.getFloat("alphaY", .1f);
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDiffuseReflection;
|
m_type[0] = EDiffuseReflection | EFrontSide;
|
||||||
m_type[1] = EGlossyReflection;
|
m_type[1] = EGlossyReflection | EFrontSide;
|
||||||
if (m_alphaX != m_alphaY) {
|
if (m_alphaX != m_alphaY)
|
||||||
m_type[0] |= EAnisotropicMaterial;
|
m_type[1] |= EAnisotropic;
|
||||||
m_type[1] |= EAnisotropicMaterial;
|
|
||||||
}
|
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials = false;
|
m_usesRayDifferentials = false;
|
||||||
}
|
}
|
||||||
|
@ -72,8 +70,10 @@ public:
|
||||||
|
|
||||||
m_componentCount = 2;
|
m_componentCount = 2;
|
||||||
m_type = new unsigned int[m_componentCount];
|
m_type = new unsigned int[m_componentCount];
|
||||||
m_type[0] = EDiffuseReflection;
|
m_type[0] = EDiffuseReflection | EFrontSide;
|
||||||
m_type[1] = EGlossyReflection;
|
m_type[1] = EGlossyReflection | EFrontSide;
|
||||||
|
if (m_alphaX != m_alphaY)
|
||||||
|
m_type[1] |= EAnisotropic;
|
||||||
m_combinedType = m_type[0] | m_type[1];
|
m_combinedType = m_type[0] | m_type[1];
|
||||||
m_usesRayDifferentials =
|
m_usesRayDifferentials =
|
||||||
m_diffuseReflectance->usesRayDifferentials() ||
|
m_diffuseReflectance->usesRayDifferentials() ||
|
||||||
|
|
|
@ -361,7 +361,7 @@ void VPLShaderManager::configure(const VPL &vpl, const BSDF *bsdf,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool anisotropic = bsdf->getType() & BSDF::EAnisotropicMaterial;
|
bool anisotropic = bsdf->getType() & BSDF::EAnisotropic;
|
||||||
|
|
||||||
m_targetConfig = VPLProgramConfiguration(vplShader, bsdfShader,
|
m_targetConfig = VPLProgramConfiguration(vplShader, bsdfShader,
|
||||||
lumShader, faceNormals);
|
lumShader, faceNormals);
|
||||||
|
|
|
@ -383,7 +383,7 @@ void PreviewWorker::processCoherent(const WorkUnit *workUnit, WorkResult *workRe
|
||||||
its.p.x = secRay4.o[0].f[idx];
|
its.p.x = secRay4.o[0].f[idx];
|
||||||
its.p.y = secRay4.o[1].f[idx];
|
its.p.y = secRay4.o[1].f[idx];
|
||||||
its.p.z = secRay4.o[2].f[idx];
|
its.p.z = secRay4.o[2].f[idx];
|
||||||
if (EXPECT_NOT_TAKEN(bsdf->getType() & BSDF::EAnisotropicMaterial)) {
|
if (EXPECT_NOT_TAKEN(bsdf->getType() & BSDF::EAnisotropic)) {
|
||||||
its.shFrame.s = normalize(its.dpdu - its.shFrame.n
|
its.shFrame.s = normalize(its.dpdu - its.shFrame.n
|
||||||
* dot(its.shFrame.n, its.dpdu));
|
* dot(its.shFrame.n, its.dpdu));
|
||||||
its.shFrame.t = cross(its.shFrame.n, its.shFrame.s);
|
its.shFrame.t = cross(its.shFrame.n, its.shFrame.s);
|
||||||
|
|
|
@ -285,7 +285,7 @@ void TriMesh::configure() {
|
||||||
computeNormals();
|
computeNormals();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasBSDF() && ((m_bsdf->getType() & BSDF::EAnisotropicMaterial)
|
if (hasBSDF() && ((m_bsdf->getType() & BSDF::EAnisotropic)
|
||||||
|| m_bsdf->usesRayDifferentials()) && !m_tangents)
|
|| m_bsdf->usesRayDifferentials()) && !m_tangents)
|
||||||
computeTangentSpaceBasis();
|
computeTangentSpaceBasis();
|
||||||
}
|
}
|
||||||
|
@ -547,7 +547,7 @@ void TriMesh::computeNormals() {
|
||||||
bool TriMesh::computeTangentSpaceBasis() {
|
bool TriMesh::computeTangentSpaceBasis() {
|
||||||
int zeroArea = 0, zeroNormals = 0;
|
int zeroArea = 0, zeroNormals = 0;
|
||||||
if (!m_texcoords) {
|
if (!m_texcoords) {
|
||||||
bool anisotropic = hasBSDF() && m_bsdf->getType() & BSDF::EAnisotropicMaterial;
|
bool anisotropic = hasBSDF() && m_bsdf->getType() & BSDF::EAnisotropic;
|
||||||
if (anisotropic)
|
if (anisotropic)
|
||||||
Log(EError, "\"%s\": computeTangentSpace(): texture coordinates "
|
Log(EError, "\"%s\": computeTangentSpace(): texture coordinates "
|
||||||
"are required to generate tangent vectors. If you want to render with an anisotropic "
|
"are required to generate tangent vectors. If you want to render with an anisotropic "
|
||||||
|
|
|
@ -122,7 +122,7 @@ public:
|
||||||
for (size_t j=0; j<wiSamples; ++j) {
|
for (size_t j=0; j<wiSamples; ++j) {
|
||||||
Vector wi;
|
Vector wi;
|
||||||
|
|
||||||
if (bsdf->getType() & (BSDF::EDiffuseTransmission | BSDF::EGlossyTransmission))
|
if (bsdf->getType() & BSDF::EBackSide)
|
||||||
wi = squareToSphere(Point2(random->nextFloat(), random->nextFloat()));
|
wi = squareToSphere(Point2(random->nextFloat(), random->nextFloat()));
|
||||||
else
|
else
|
||||||
wi = squareToHemispherePSA(Point2(random->nextFloat(), random->nextFloat()));
|
wi = squareToHemispherePSA(Point2(random->nextFloat(), random->nextFloat()));
|
||||||
|
@ -159,7 +159,7 @@ public:
|
||||||
for (size_t j=0; j<wiSamples; ++j) {
|
for (size_t j=0; j<wiSamples; ++j) {
|
||||||
Vector wi;
|
Vector wi;
|
||||||
|
|
||||||
if (bsdf->getType(comp) & (BSDF::EDiffuseTransmission | BSDF::EGlossyTransmission))
|
if (bsdf->getType(comp) & BSDF::EBackSide)
|
||||||
wi = squareToSphere(Point2(random->nextFloat(), random->nextFloat()));
|
wi = squareToSphere(Point2(random->nextFloat(), random->nextFloat()));
|
||||||
else
|
else
|
||||||
wi = squareToHemispherePSA(Point2(random->nextFloat(), random->nextFloat()));
|
wi = squareToHemispherePSA(Point2(random->nextFloat(), random->nextFloat()));
|
||||||
|
|
Loading…
Reference in New Issue