debugging..

metadata
Wenzel Jakob 2011-03-11 12:49:07 +01:00
parent 03c67c1ab3
commit 9e96220bf6
3 changed files with 26 additions and 23 deletions

View File

@ -62,7 +62,7 @@ public:
/* ==================================================================== */
/* Radiative Transfer Equation sampling */
/* ==================================================================== */
if (rRec.medium && rRec.medium->sampleDistance(Ray(ray, 0, its.t), mRec, rRec.sampler)) {
if (false && rRec.medium && rRec.medium->sampleDistance(Ray(ray, 0, its.t), mRec, rRec.sampler)) {
const PhaseFunction *phase = rRec.medium->getPhaseFunction();
/* Sample the integral
@ -120,7 +120,7 @@ public:
Account for this and multiply by the proper per-color-channel transmittance.
*/
if (rRec.medium)
if (rRec.medium && false)
pathThroughput *= mRec.transmittance / mRec.pdfFailure;
if (!its.isValid()) {
@ -170,7 +170,7 @@ public:
/* Sample BSDF * cos(theta) */
BSDFQueryRecord bRec(its);
Spectrum bsdfVal = bsdf->sampleCos(bRec, rRec.nextSample2D());
if (bsdfVal.isZero())
if (bsdfVal.isZero())
break;
/* In the next iteration, trace a ray in this direction */
@ -195,6 +195,7 @@ public:
--rRec.depth;
}
} else {
cout << "Got here 3." << endl;
break;
}
} else {

View File

@ -389,39 +389,41 @@ Spectrum Scene::getTransmittance(const Point &p1, const Point &p2,
? 0.0f : 1.0f);
} else {
Vector d = p2 - p1;
Float distance = d.length(), traveled = 0;
d /= distance;
distance *= 1-Epsilon;
Float remaining = d.length();
d /= remaining;
remaining *= 1-Epsilon;
const Shape *shape;
Ray ray(p1, d, time);
Spectrum atten(1.0f);
int iterations = 0;
while (true) {
while (remaining > 0) {
Normal n;
Float t;
ray.mint = 0.1*Epsilon;
bool surface = rayIntersect(ray, t, shape, n);
if (medium)
atten *= medium->getTransmittance(Ray(ray, 0, t));
if (medium)
atten *= medium->getTransmittance(Ray(ray, 0, std::min(t, remaining)));
if (!surface)
if (!surface)
break;
ray.o = ray(t);
traveled += t;
remaining -= t;
if (shape->isOccluder() && traveled < distance)
return Spectrum(0.0f);
else if (shape->isMediumTransition())
medium = dot(n, d) > 0 ? shape->getExteriorMedium()
: shape->getInteriorMedium();
if (++iterations > 100) { /// Just a precaution..
Log(EWarn, "sampleAttenuatedLuminaire(): round-off error issues?");
break;
if (remaining > 0) {
if (shape->isOccluder())
return Spectrum(0.0f);
else if (shape->isMediumTransition())
medium = dot(n, d) > 0 ? shape->getExteriorMedium()
: shape->getInteriorMedium();
if (++iterations > 100) { /// Just a precaution..
Log(EWarn, "sampleAttenuatedLuminaire(): round-off error issues?");
break;
}
}
}
return atten;

View File

@ -94,10 +94,10 @@ void Shape::addChild(const std::string &name, ConfigurableObject *child) {
Assert(m_subsurface == NULL);
m_subsurface = static_cast<Subsurface *>(child);
} else if (cClass->derivesFrom(MTS_CLASS(Medium))) {
if (name == "interiorMedium") {
if (name == "interior") {
Assert(m_interiorMedium == NULL);
m_interiorMedium = static_cast<Medium *>(child);
} else if (name == "exteriorMedium") {
} else if (name == "exterior") {
Assert(m_exteriorMedium == NULL);
m_exteriorMedium = static_cast<Medium *>(child);
} else {