fixed faulty commit

metadata
Wenzel Jakob 2015-07-15 12:23:45 +02:00
parent 73428bfc77
commit 7f5aa0c0b2
13 changed files with 25 additions and 81 deletions

View File

@ -12,7 +12,6 @@ plugins += env.SharedLibrary('roughplastic', ['roughplastic.cpp'])
# Materials that act as modifiers
plugins += env.SharedLibrary('twosided', ['twosided.cpp'])
plugins += env.SharedLibrary('force_twosided', ['force_twosided.cpp'])
plugins += env.SharedLibrary('mask', ['mask.cpp'])
plugins += env.SharedLibrary('mixturebsdf', ['mixturebsdf.cpp'])
plugins += env.SharedLibrary('blendbsdf', ['blendbsdf.cpp'])

View File

@ -27,7 +27,7 @@
* rendering into the weighted contributions of the individual sampling
* strategies.
*/
#define BDPT_DEBUG 1
//#define BDPT_DEBUG 1
MTS_NAMESPACE_BEGIN

View File

@ -95,12 +95,12 @@ void BDPTWorkResult::dump(const BDPTConfiguration &conf,
for (int t=0; t<=k+1; ++t) {
size_t s = k+1-t;
Bitmap *bitmap = const_cast<Bitmap *>(m_debugBlocks[strategyIndex(s, t)]->getBitmap());
ref<Bitmap> ldrBitmap = bitmap->convert(Bitmap::ERGB, Bitmap::EFloat32, -1, weight);
ref<Bitmap> ldrBitmap = bitmap->convert(Bitmap::ERGB, Bitmap::EUInt8, -1, weight);
fs::path filename =
prefix / fs::path(formatString("%s_k%02i_s%02i_t%02i.exr", stem.filename().string().c_str(), k, s, t));
prefix / fs::path(formatString("%s_k%02i_s%02i_t%02i.png", stem.filename().string().c_str(), k, s, t));
ref<FileStream> targetFile = new FileStream(filename,
FileStream::ETruncReadWrite);
ldrBitmap->write(Bitmap::EOpenEXR, targetFile, 1);
ldrBitmap->write(Bitmap::EPNG, targetFile, 1);
}
}
}

View File

@ -136,12 +136,9 @@ public:
if (!its.isValid()) {
/* If no intersection could be found, potentially return
radiance from a environment luminaire if it exists */
if (rRec.type & RadianceQueryRecord::EEmittedRadiance) {
Spectrum Le = scene->evalEnvironment(ray);
if (m_hideEmitters && !scattered)
Le = Spectrum(1.f);
Li += throughput * Le;
}
if ((rRec.type & RadianceQueryRecord::EEmittedRadiance)
&& (!m_hideEmitters || scattered))
Li += throughput * scene->evalEnvironment(ray);
break;
}
@ -173,12 +170,10 @@ public:
/* Estimate the direct illumination if this is requested */
DirectSamplingRecord dRec(its);
bool backgroundPlate = rRec.depth == 1 && its.shape->getName().find("background") != std::string::npos;
if (rRec.type & RadianceQueryRecord::EDirectSurfaceRadiance &&
(bsdf->getType() & BSDF::ESmooth)) {
Spectrum value = scene->sampleEmitterDirect(dRec, rRec.nextSample2D());
if (!value.isZero()) {
const Emitter *emitter = static_cast<const Emitter *>(dRec.object);
@ -199,22 +194,10 @@ public:
/* Weight using the power heuristic */
Float weight = miWeight(dRec.pdf, bsdfPdf);
if (backgroundPlate) {
Li += Spectrum(1.0f);
rRec.alpha = 0.0f;
} else {
Li += throughput * value * bsdfVal * weight;
}
Li += throughput * value * bsdfVal * weight;
}
}
}
if (backgroundPlate) {
if (dot(dRec.refN, dRec.d) < 0) {
Li += Spectrum(1.0f);
rRec.alpha = 0.0f;
}
break;
}
/* ==================================================================== */
/* BSDF sampling */

View File

@ -358,8 +358,6 @@ public:
m_config.luminance = pathSampler->generateSeeds(luminanceSamples,
m_config.workUnits, false, m_config.importanceMap, pathSeeds);
cout << "Luminance = " << m_config.luminance << endl;
if (!nested)
m_config.dump();

View File

@ -36,10 +36,6 @@ MTS_NAMESPACE_BEGIN
* increase both storage and computational costs.
* \default{4}
* }
* \parameter{pixelCenters}{\Integer}{
* Place samples at pixel centers. This is useful for use with the
* \pluginref{field} integrator.
* }
* }
* \vspace{-2mm}
* \renderings{
@ -83,11 +79,6 @@ public:
/* Dimension, up to which which low discrepancy samples are guaranteed to be available. */
m_maxDimension = props.getInteger("dimension", 4);
if (m_maxDimension < 1)
Log(EError, "Dimension parameter must be > 0!");
/* Place samples at pixel centers? */
m_pixelCenters = props.getBoolean("pixelCenters", false);
if (!math::isPowerOfTwo(m_sampleCount)) {
m_sampleCount = math::roundToPowerOfTwo(m_sampleCount);
@ -110,7 +101,6 @@ public:
: Sampler(stream, manager) {
m_random = static_cast<Random *>(manager->getInstance(stream));
m_maxDimension = stream->readSize();
m_pixelCenters = stream->readBool();
m_samples1D = new Float*[m_maxDimension];
m_samples2D = new Point2*[m_maxDimension];
@ -133,7 +123,6 @@ public:
Sampler::serialize(stream, manager);
manager->serialize(stream, m_random.get());
stream->writeSize(m_maxDimension);
stream->writeBool(m_pixelCenters);
}
ref<Sampler> clone() {
@ -208,9 +197,6 @@ public:
m_sampleIndex = 0;
m_dimension1D = m_dimension2D = 0;
m_dimension1DArray = m_dimension2DArray = 0;
if (m_pixelCenters)
m_samples2D[0][0] = Point2(0.5f);
}
void advance() {
@ -245,8 +231,7 @@ public:
std::ostringstream oss;
oss << "LowDiscrepancySampler[" << endl
<< " sampleCount = " << m_sampleCount << "," << endl
<< " dimension = " << m_maxDimension << "," << endl
<< " pixelCenters = " << m_pixelCenters << endl
<< " dimension = " << m_maxDimension << endl
<< "]";
return oss.str();
}
@ -259,7 +244,6 @@ private:
size_t m_dimension2D;
Float **m_samples1D;
Point2 **m_samples2D;
bool m_pixelCenters;
};
MTS_IMPLEMENT_CLASS_S(LowDiscrepancySampler, false, Sampler)

View File

@ -319,13 +319,7 @@ public:
t.uv[1] = t.uv[2];
t.n[1] = t.n[2];
parse(t, 2, tmp);
OBJTriangle tp = tp;
for (int i=0; i<3; ++i) {
tp.p[i] = t.p[(i+1)%3];
tp.uv[i] = t.uv[(i+1)%3];
tp.n[i] = t.n[(i+1)%3];
}
triangles.push_back(tp);
triangles.push_back(t);
}
} else {
/* Ignore */

View File

@ -304,7 +304,7 @@ public:
m_triangles[m_triangleCount++] = t;
if (m_indexCtr == 4) {
t.idx[0] = m_face[2]; t.idx[1] = m_face[3]; t.idx[2] = m_face[0];
t.idx[0] = m_face[3]; t.idx[1] = m_face[0]; t.idx[2] = m_face[2];
m_triangles[m_triangleCount++] = t;
}

View File

@ -105,8 +105,8 @@ public:
m_frame = Frame(normalize(m_dpdu), normalize(m_dpdv), normal);
m_invSurfaceArea = 1.0f / getSurfaceArea();
if (std::abs(dot(normalize(m_dpdu), normalize(m_dpdv))) > 1e-3f)
Log(EWarn, "Error: 'toWorld' transformation contains shear!");
if (std::abs(dot(normalize(m_dpdu), normalize(m_dpdv))) > Epsilon)
Log(EError, "Error: 'toWorld' transformation contains shear!");
}
AABB getAABB() const {

View File

@ -7,7 +7,5 @@ plugins += env.SharedLibrary('checkerboard', ['checkerboard.cpp'])
plugins += env.SharedLibrary('vertexcolors', ['vertexcolors.cpp'])
plugins += env.SharedLibrary('wireframe', ['wireframe.cpp'])
plugins += env.SharedLibrary('curvature', ['curvature.cpp'])
plugins += env.SharedLibrary('posyfield', ['posyfield.cpp'])
plugins += env.SharedLibrary('posysing', ['posysing.cpp'])
Export('plugins')

View File

@ -111,6 +111,9 @@ public:
}
MTS_DECLARE_CLASS()
private:
Spectrum m_brightReflectance;
Spectrum m_darkReflectance;
};
Shader *VertexColors::createShader(Renderer *renderer) const {

View File

@ -60,7 +60,6 @@ public:
m_edgeColor = props.getSpectrum("edgeColor", Spectrum(0.1f));
m_interiorColor = props.getSpectrum("interiorColor", Spectrum(.5f));
m_stepWidth = std::max((Float) 0.0f, std::min(m_stepWidth, (Float) 1.0f));
m_quads = props.getBoolean("quads", false);
m_mutex = new Mutex();
}
@ -70,7 +69,6 @@ public:
m_edgeColor = Spectrum(stream);
m_interiorColor = Spectrum(stream);
m_lineWidth = stream->readFloat();
m_quads = stream->readBool();
}
void serialize(Stream *stream, InstanceManager *manager) const {
@ -78,7 +76,6 @@ public:
m_edgeColor.serialize(stream);
m_interiorColor.serialize(stream);
stream->writeFloat(m_lineWidth);
stream->writeBool(m_quads);
}
Spectrum eval(const Intersection &its, bool /* unused */) const {
@ -108,20 +105,10 @@ public:
}
}
bool irregular = false;
if (m_quads) {
uint32_t base = its.primIndex & ~1u;
const Triangle &tri1 = triMesh->getTriangles()[base+1];
const Point *verts = triMesh->getVertexPositions();
if (verts[tri1.idx[0]] == verts[tri1.idx[1]])
irregular = true;
}
const Triangle &tri = triMesh->getTriangles()[its.primIndex];
Float minDist = std::numeric_limits<Float>::infinity();
for (int i=0; i<3; ++i) {
if ((m_quads && i == 2) || (irregular && (i == 1 || (its.primIndex & 1))))
continue;
const Point& cur = positions[tri.idx[i]];
const Point& next = positions[tri.idx[(i+1)%3]];
@ -175,9 +162,8 @@ public:
oss << "WireFrame[" << endl
<< " edgeColor = " << m_edgeColor.toString() << "," << endl
<< " interiorColor = " << m_interiorColor.toString() << "," << endl
<< " lineWidth = " << m_lineWidth << "," << endl
<< " stepWidth = " << m_stepWidth << "," << endl
<< " quads = " << m_quads << endl
<< " lineWidth = " << m_lineWidth << endl
<< " stepWidth = " << m_stepWidth << endl
<< "]";
return oss.str();
}
@ -191,7 +177,6 @@ protected:
Float m_stepWidth;
Spectrum m_edgeColor;
Spectrum m_interiorColor;
bool m_quads;
};
// ================ Hardware shader implementation ================