had a change of mind: issue a warning when encountering negative values, but then just clamp them and continue rendering (rather than failing)

metadata
Wenzel Jakob 2012-10-08 22:38:34 -04:00
parent c9294d81f7
commit 09283c9f44
3 changed files with 11 additions and 9 deletions

View File

@ -219,6 +219,17 @@ public:
m_pyramid[0].cleanup();
m_pyramid[0].init((Value *) bitmap->getData(), m_minimum, m_maximum, m_average);
if (m_minimum.min() < 0) {
Log(EWarn, "The texture contains negative pixel values! These will be clamped!");
Value *value = (Value *) bitmap->getData();
for (size_t i=0, count=bitmap->getPixelCount(); i<count; ++i)
(*value++).clampNegative();
m_pyramid[0].init((Value *) bitmap->getData(), m_minimum, m_maximum, m_average);
}
m_sizeRatio[0] = Vector2(1, 1);
/* 3. Progressively downsample until only a 1x1 image is left */

View File

@ -181,10 +181,6 @@ public:
std::numeric_limits<Float>::infinity(), Spectrum::EIlluminant);
}
if (m_mipmap->getMinimum().min() < 0)
Log(EError, "\"%s\": The environment map contains negative pixel values! This is not allowed.",
m_filename.string().c_str());
if (props.hasProperty("intensityScale"))
Log(EError, "The 'intensityScale' parameter has been deprecated and is now called scale.");

View File

@ -277,11 +277,6 @@ public:
rfilter, m_wrapModeU, m_wrapModeV, m_filterType, m_maxAnisotropy,
createCache ? cacheFile : fs::path(), timestamp);
}
if ((m_mipmap1 && m_mipmap1->getMinimum().min() < 0) ||
(m_mipmap3 && m_mipmap3->getMinimum().min() < 0))
Log(EError, "\"%s\": The texture map contains negative pixel values! This is not allowed.",
m_filename.string().c_str());
}
inline ReconstructionFilter::EBoundaryCondition parseWrapMode(const std::string &wrapMode) {