fixed faulty commit
parent
73428bfc77
commit
7f5aa0c0b2
|
@ -12,7 +12,6 @@ plugins += env.SharedLibrary('roughplastic', ['roughplastic.cpp'])
|
||||||
|
|
||||||
# Materials that act as modifiers
|
# Materials that act as modifiers
|
||||||
plugins += env.SharedLibrary('twosided', ['twosided.cpp'])
|
plugins += env.SharedLibrary('twosided', ['twosided.cpp'])
|
||||||
plugins += env.SharedLibrary('force_twosided', ['force_twosided.cpp'])
|
|
||||||
plugins += env.SharedLibrary('mask', ['mask.cpp'])
|
plugins += env.SharedLibrary('mask', ['mask.cpp'])
|
||||||
plugins += env.SharedLibrary('mixturebsdf', ['mixturebsdf.cpp'])
|
plugins += env.SharedLibrary('mixturebsdf', ['mixturebsdf.cpp'])
|
||||||
plugins += env.SharedLibrary('blendbsdf', ['blendbsdf.cpp'])
|
plugins += env.SharedLibrary('blendbsdf', ['blendbsdf.cpp'])
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
* rendering into the weighted contributions of the individual sampling
|
* rendering into the weighted contributions of the individual sampling
|
||||||
* strategies.
|
* strategies.
|
||||||
*/
|
*/
|
||||||
#define BDPT_DEBUG 1
|
//#define BDPT_DEBUG 1
|
||||||
|
|
||||||
MTS_NAMESPACE_BEGIN
|
MTS_NAMESPACE_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -95,12 +95,12 @@ void BDPTWorkResult::dump(const BDPTConfiguration &conf,
|
||||||
for (int t=0; t<=k+1; ++t) {
|
for (int t=0; t<=k+1; ++t) {
|
||||||
size_t s = k+1-t;
|
size_t s = k+1-t;
|
||||||
Bitmap *bitmap = const_cast<Bitmap *>(m_debugBlocks[strategyIndex(s, t)]->getBitmap());
|
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 =
|
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,
|
ref<FileStream> targetFile = new FileStream(filename,
|
||||||
FileStream::ETruncReadWrite);
|
FileStream::ETruncReadWrite);
|
||||||
ldrBitmap->write(Bitmap::EOpenEXR, targetFile, 1);
|
ldrBitmap->write(Bitmap::EPNG, targetFile, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,9 @@ static StatsCounter statsConverged(
|
||||||
/*!\plugin{motion}{Motion and specular motion vector integrator}
|
/*!\plugin{motion}{Motion and specular motion vector integrator}
|
||||||
* \parameters{
|
* \parameters{
|
||||||
* \parameter{time}{\Float}{
|
* \parameter{time}{\Float}{
|
||||||
* Denotes the time stamp of the target frame of the motion vectors.
|
* Denotes the time stamp of the target frame of the motion vectors.
|
||||||
* The current frame is specified via the sensor's \code{shutterOpen}
|
* The current frame is specified via the sensor's \code{shutterOpen}
|
||||||
* and \code{shutterClose} parameters, which should both be set to
|
* and \code{shutterClose} parameters, which should both be set to
|
||||||
* the same value. \default{0}
|
* the same value. \default{0}
|
||||||
* }
|
* }
|
||||||
* \parameter{time}{\String}{
|
* \parameter{time}{\String}{
|
||||||
|
@ -96,7 +96,7 @@ static StatsCounter statsConverged(
|
||||||
* <string name="config" value="ttd"/>
|
* <string name="config" value="ttd"/>
|
||||||
* <float name="time" value="1"/>
|
* <float name="time" value="1"/>
|
||||||
* </integrator>
|
* </integrator>
|
||||||
*
|
*
|
||||||
* <shape type="serialized">
|
* <shape type="serialized">
|
||||||
* <string name="filename" value="..."/>
|
* <string name="filename" value="..."/>
|
||||||
* <animation name="toWorld">
|
* <animation name="toWorld">
|
||||||
|
@ -109,16 +109,16 @@ static StatsCounter statsConverged(
|
||||||
* </animation>
|
* </animation>
|
||||||
* <bsdf type="dielectric"/>
|
* <bsdf type="dielectric"/>
|
||||||
* </shape>
|
* </shape>
|
||||||
*
|
*
|
||||||
* <sensor type="perspective">
|
* <sensor type="perspective">
|
||||||
* <float name="shutterOpen" value="0"/>
|
* <float name="shutterOpen" value="0"/>
|
||||||
* <float name="shutterClose" value="0"/>
|
* <float name="shutterClose" value="0"/>
|
||||||
*
|
*
|
||||||
* <sampler type="ldsampler">
|
* <sampler type="ldsampler">
|
||||||
* <integer name="sampleCount" value="1"/>
|
* <integer name="sampleCount" value="1"/>
|
||||||
* <boolean name="pixelCenters" value="true"/>
|
* <boolean name="pixelCenters" value="true"/>
|
||||||
* </sampler>
|
* </sampler>
|
||||||
*
|
*
|
||||||
* <film type="hdrfilm" id="film">
|
* <film type="hdrfilm" id="film">
|
||||||
* <string name="pixelFormat" value="rgb"/>
|
* <string name="pixelFormat" value="rgb"/>
|
||||||
* <boolean name="banner" value="false"/>
|
* <boolean name="banner" value="false"/>
|
||||||
|
|
|
@ -136,12 +136,9 @@ public:
|
||||||
if (!its.isValid()) {
|
if (!its.isValid()) {
|
||||||
/* If no intersection could be found, potentially return
|
/* If no intersection could be found, potentially return
|
||||||
radiance from a environment luminaire if it exists */
|
radiance from a environment luminaire if it exists */
|
||||||
if (rRec.type & RadianceQueryRecord::EEmittedRadiance) {
|
if ((rRec.type & RadianceQueryRecord::EEmittedRadiance)
|
||||||
Spectrum Le = scene->evalEnvironment(ray);
|
&& (!m_hideEmitters || scattered))
|
||||||
if (m_hideEmitters && !scattered)
|
Li += throughput * scene->evalEnvironment(ray);
|
||||||
Le = Spectrum(1.f);
|
|
||||||
Li += throughput * Le;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,12 +170,10 @@ public:
|
||||||
|
|
||||||
/* Estimate the direct illumination if this is requested */
|
/* Estimate the direct illumination if this is requested */
|
||||||
DirectSamplingRecord dRec(its);
|
DirectSamplingRecord dRec(its);
|
||||||
bool backgroundPlate = rRec.depth == 1 && its.shape->getName().find("background") != std::string::npos;
|
|
||||||
|
|
||||||
if (rRec.type & RadianceQueryRecord::EDirectSurfaceRadiance &&
|
if (rRec.type & RadianceQueryRecord::EDirectSurfaceRadiance &&
|
||||||
(bsdf->getType() & BSDF::ESmooth)) {
|
(bsdf->getType() & BSDF::ESmooth)) {
|
||||||
Spectrum value = scene->sampleEmitterDirect(dRec, rRec.nextSample2D());
|
Spectrum value = scene->sampleEmitterDirect(dRec, rRec.nextSample2D());
|
||||||
|
|
||||||
if (!value.isZero()) {
|
if (!value.isZero()) {
|
||||||
const Emitter *emitter = static_cast<const Emitter *>(dRec.object);
|
const Emitter *emitter = static_cast<const Emitter *>(dRec.object);
|
||||||
|
|
||||||
|
@ -199,22 +194,10 @@ public:
|
||||||
|
|
||||||
/* Weight using the power heuristic */
|
/* Weight using the power heuristic */
|
||||||
Float weight = miWeight(dRec.pdf, bsdfPdf);
|
Float weight = miWeight(dRec.pdf, bsdfPdf);
|
||||||
if (backgroundPlate) {
|
Li += throughput * value * bsdfVal * weight;
|
||||||
Li += Spectrum(1.0f);
|
|
||||||
rRec.alpha = 0.0f;
|
|
||||||
} else {
|
|
||||||
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 */
|
/* BSDF sampling */
|
||||||
|
|
|
@ -358,8 +358,6 @@ public:
|
||||||
m_config.luminance = pathSampler->generateSeeds(luminanceSamples,
|
m_config.luminance = pathSampler->generateSeeds(luminanceSamples,
|
||||||
m_config.workUnits, false, m_config.importanceMap, pathSeeds);
|
m_config.workUnits, false, m_config.importanceMap, pathSeeds);
|
||||||
|
|
||||||
cout << "Luminance = " << m_config.luminance << endl;
|
|
||||||
|
|
||||||
if (!nested)
|
if (!nested)
|
||||||
m_config.dump();
|
m_config.dump();
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,6 @@ MTS_NAMESPACE_BEGIN
|
||||||
* increase both storage and computational costs.
|
* increase both storage and computational costs.
|
||||||
* \default{4}
|
* \default{4}
|
||||||
* }
|
* }
|
||||||
* \parameter{pixelCenters}{\Integer}{
|
|
||||||
* Place samples at pixel centers. This is useful for use with the
|
|
||||||
* \pluginref{field} integrator.
|
|
||||||
* }
|
|
||||||
* }
|
* }
|
||||||
* \vspace{-2mm}
|
* \vspace{-2mm}
|
||||||
* \renderings{
|
* \renderings{
|
||||||
|
@ -83,11 +79,6 @@ public:
|
||||||
|
|
||||||
/* Dimension, up to which which low discrepancy samples are guaranteed to be available. */
|
/* Dimension, up to which which low discrepancy samples are guaranteed to be available. */
|
||||||
m_maxDimension = props.getInteger("dimension", 4);
|
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)) {
|
if (!math::isPowerOfTwo(m_sampleCount)) {
|
||||||
m_sampleCount = math::roundToPowerOfTwo(m_sampleCount);
|
m_sampleCount = math::roundToPowerOfTwo(m_sampleCount);
|
||||||
|
@ -110,7 +101,6 @@ public:
|
||||||
: Sampler(stream, manager) {
|
: Sampler(stream, manager) {
|
||||||
m_random = static_cast<Random *>(manager->getInstance(stream));
|
m_random = static_cast<Random *>(manager->getInstance(stream));
|
||||||
m_maxDimension = stream->readSize();
|
m_maxDimension = stream->readSize();
|
||||||
m_pixelCenters = stream->readBool();
|
|
||||||
|
|
||||||
m_samples1D = new Float*[m_maxDimension];
|
m_samples1D = new Float*[m_maxDimension];
|
||||||
m_samples2D = new Point2*[m_maxDimension];
|
m_samples2D = new Point2*[m_maxDimension];
|
||||||
|
@ -133,7 +123,6 @@ public:
|
||||||
Sampler::serialize(stream, manager);
|
Sampler::serialize(stream, manager);
|
||||||
manager->serialize(stream, m_random.get());
|
manager->serialize(stream, m_random.get());
|
||||||
stream->writeSize(m_maxDimension);
|
stream->writeSize(m_maxDimension);
|
||||||
stream->writeBool(m_pixelCenters);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ref<Sampler> clone() {
|
ref<Sampler> clone() {
|
||||||
|
@ -208,9 +197,6 @@ public:
|
||||||
m_sampleIndex = 0;
|
m_sampleIndex = 0;
|
||||||
m_dimension1D = m_dimension2D = 0;
|
m_dimension1D = m_dimension2D = 0;
|
||||||
m_dimension1DArray = m_dimension2DArray = 0;
|
m_dimension1DArray = m_dimension2DArray = 0;
|
||||||
|
|
||||||
if (m_pixelCenters)
|
|
||||||
m_samples2D[0][0] = Point2(0.5f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void advance() {
|
void advance() {
|
||||||
|
@ -245,8 +231,7 @@ public:
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "LowDiscrepancySampler[" << endl
|
oss << "LowDiscrepancySampler[" << endl
|
||||||
<< " sampleCount = " << m_sampleCount << "," << endl
|
<< " sampleCount = " << m_sampleCount << "," << endl
|
||||||
<< " dimension = " << m_maxDimension << "," << endl
|
<< " dimension = " << m_maxDimension << endl
|
||||||
<< " pixelCenters = " << m_pixelCenters << endl
|
|
||||||
<< "]";
|
<< "]";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
@ -259,7 +244,6 @@ private:
|
||||||
size_t m_dimension2D;
|
size_t m_dimension2D;
|
||||||
Float **m_samples1D;
|
Float **m_samples1D;
|
||||||
Point2 **m_samples2D;
|
Point2 **m_samples2D;
|
||||||
bool m_pixelCenters;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
MTS_IMPLEMENT_CLASS_S(LowDiscrepancySampler, false, Sampler)
|
MTS_IMPLEMENT_CLASS_S(LowDiscrepancySampler, false, Sampler)
|
||||||
|
|
|
@ -319,13 +319,7 @@ public:
|
||||||
t.uv[1] = t.uv[2];
|
t.uv[1] = t.uv[2];
|
||||||
t.n[1] = t.n[2];
|
t.n[1] = t.n[2];
|
||||||
parse(t, 2, tmp);
|
parse(t, 2, tmp);
|
||||||
OBJTriangle tp = tp;
|
triangles.push_back(t);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Ignore */
|
/* Ignore */
|
||||||
|
|
|
@ -304,7 +304,7 @@ public:
|
||||||
m_triangles[m_triangleCount++] = t;
|
m_triangles[m_triangleCount++] = t;
|
||||||
|
|
||||||
if (m_indexCtr == 4) {
|
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;
|
m_triangles[m_triangleCount++] = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,8 +105,8 @@ public:
|
||||||
m_frame = Frame(normalize(m_dpdu), normalize(m_dpdv), normal);
|
m_frame = Frame(normalize(m_dpdu), normalize(m_dpdv), normal);
|
||||||
|
|
||||||
m_invSurfaceArea = 1.0f / getSurfaceArea();
|
m_invSurfaceArea = 1.0f / getSurfaceArea();
|
||||||
if (std::abs(dot(normalize(m_dpdu), normalize(m_dpdv))) > 1e-3f)
|
if (std::abs(dot(normalize(m_dpdu), normalize(m_dpdv))) > Epsilon)
|
||||||
Log(EWarn, "Error: 'toWorld' transformation contains shear!");
|
Log(EError, "Error: 'toWorld' transformation contains shear!");
|
||||||
}
|
}
|
||||||
|
|
||||||
AABB getAABB() const {
|
AABB getAABB() const {
|
||||||
|
|
|
@ -7,7 +7,5 @@ plugins += env.SharedLibrary('checkerboard', ['checkerboard.cpp'])
|
||||||
plugins += env.SharedLibrary('vertexcolors', ['vertexcolors.cpp'])
|
plugins += env.SharedLibrary('vertexcolors', ['vertexcolors.cpp'])
|
||||||
plugins += env.SharedLibrary('wireframe', ['wireframe.cpp'])
|
plugins += env.SharedLibrary('wireframe', ['wireframe.cpp'])
|
||||||
plugins += env.SharedLibrary('curvature', ['curvature.cpp'])
|
plugins += env.SharedLibrary('curvature', ['curvature.cpp'])
|
||||||
plugins += env.SharedLibrary('posyfield', ['posyfield.cpp'])
|
|
||||||
plugins += env.SharedLibrary('posysing', ['posysing.cpp'])
|
|
||||||
|
|
||||||
Export('plugins')
|
Export('plugins')
|
||||||
|
|
|
@ -111,6 +111,9 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
MTS_DECLARE_CLASS()
|
MTS_DECLARE_CLASS()
|
||||||
|
private:
|
||||||
|
Spectrum m_brightReflectance;
|
||||||
|
Spectrum m_darkReflectance;
|
||||||
};
|
};
|
||||||
|
|
||||||
Shader *VertexColors::createShader(Renderer *renderer) const {
|
Shader *VertexColors::createShader(Renderer *renderer) const {
|
||||||
|
|
|
@ -60,7 +60,6 @@ public:
|
||||||
m_edgeColor = props.getSpectrum("edgeColor", Spectrum(0.1f));
|
m_edgeColor = props.getSpectrum("edgeColor", Spectrum(0.1f));
|
||||||
m_interiorColor = props.getSpectrum("interiorColor", Spectrum(.5f));
|
m_interiorColor = props.getSpectrum("interiorColor", Spectrum(.5f));
|
||||||
m_stepWidth = std::max((Float) 0.0f, std::min(m_stepWidth, (Float) 1.0f));
|
m_stepWidth = std::max((Float) 0.0f, std::min(m_stepWidth, (Float) 1.0f));
|
||||||
m_quads = props.getBoolean("quads", false);
|
|
||||||
m_mutex = new Mutex();
|
m_mutex = new Mutex();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -70,7 +69,6 @@ public:
|
||||||
m_edgeColor = Spectrum(stream);
|
m_edgeColor = Spectrum(stream);
|
||||||
m_interiorColor = Spectrum(stream);
|
m_interiorColor = Spectrum(stream);
|
||||||
m_lineWidth = stream->readFloat();
|
m_lineWidth = stream->readFloat();
|
||||||
m_quads = stream->readBool();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void serialize(Stream *stream, InstanceManager *manager) const {
|
void serialize(Stream *stream, InstanceManager *manager) const {
|
||||||
|
@ -78,7 +76,6 @@ public:
|
||||||
m_edgeColor.serialize(stream);
|
m_edgeColor.serialize(stream);
|
||||||
m_interiorColor.serialize(stream);
|
m_interiorColor.serialize(stream);
|
||||||
stream->writeFloat(m_lineWidth);
|
stream->writeFloat(m_lineWidth);
|
||||||
stream->writeBool(m_quads);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Spectrum eval(const Intersection &its, bool /* unused */) const {
|
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];
|
const Triangle &tri = triMesh->getTriangles()[its.primIndex];
|
||||||
|
|
||||||
Float minDist = std::numeric_limits<Float>::infinity();
|
Float minDist = std::numeric_limits<Float>::infinity();
|
||||||
for (int i=0; i<3; ++i) {
|
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& cur = positions[tri.idx[i]];
|
||||||
const Point& next = positions[tri.idx[(i+1)%3]];
|
const Point& next = positions[tri.idx[(i+1)%3]];
|
||||||
|
|
||||||
|
@ -175,9 +162,8 @@ public:
|
||||||
oss << "WireFrame[" << endl
|
oss << "WireFrame[" << endl
|
||||||
<< " edgeColor = " << m_edgeColor.toString() << "," << endl
|
<< " edgeColor = " << m_edgeColor.toString() << "," << endl
|
||||||
<< " interiorColor = " << m_interiorColor.toString() << "," << endl
|
<< " interiorColor = " << m_interiorColor.toString() << "," << endl
|
||||||
<< " lineWidth = " << m_lineWidth << "," << endl
|
<< " lineWidth = " << m_lineWidth << endl
|
||||||
<< " stepWidth = " << m_stepWidth << "," << endl
|
<< " stepWidth = " << m_stepWidth << endl
|
||||||
<< " quads = " << m_quads << endl
|
|
||||||
<< "]";
|
<< "]";
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
@ -191,7 +177,6 @@ protected:
|
||||||
Float m_stepWidth;
|
Float m_stepWidth;
|
||||||
Spectrum m_edgeColor;
|
Spectrum m_edgeColor;
|
||||||
Spectrum m_interiorColor;
|
Spectrum m_interiorColor;
|
||||||
bool m_quads;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// ================ Hardware shader implementation ================
|
// ================ Hardware shader implementation ================
|
||||||
|
|
Loading…
Reference in New Issue