提交 27b54d51 编写于 作者: M Matt Pharr

Fix 2(!) AOIntegrator bugs.

Forgot to add the divide by the wavelengths' PDF here once that was moved
out of Film.

Illuminant photometric scaling so we're back to 0-1 then.

Issue #53.
上级 ec742b2c
......@@ -1412,7 +1412,8 @@ AOIntegrator::AOIntegrator(bool cosSample, Float maxDist, CameraHandle camera,
: RayIntegrator(camera, sampler, aggregate, lights),
cosSample(cosSample),
maxDist(maxDist),
illuminant(illuminant) {}
illuminant(illuminant),
illumScale(1.f / SpectrumToPhotometric(illuminant)) {}
SampledSpectrum AOIntegrator::Li(RayDifferential ray, SampledWavelengths &lambda,
SamplerHandle sampler, ScratchBuffer &scratchBuffer,
......@@ -1455,8 +1456,11 @@ retry:
// Divide by pi so that fully visible is one.
Ray r = isect.SpawnRay(wi);
if (!IntersectP(r, maxDist))
return illuminant.Sample(lambda) * SampledSpectrum(Dot(wi, n) / (Pi * pdf));
if (!IntersectP(r, maxDist)) {
SampledSpectrum L = illumScale * illuminant.Sample(lambda) *
SampledSpectrum(Dot(wi, n) / (Pi * pdf));
return SafeDiv(L, lambda.PDF());
}
}
return SampledSpectrum(0.);
}
......
......@@ -305,6 +305,7 @@ class AOIntegrator : public RayIntegrator {
bool cosSample;
Float maxDist;
SpectrumHandle illuminant;
Float illumScale;
};
// LightPathIntegrator Definition
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册