fixed a stupid bug that could mess up medium rendering with analytic shapes
parent
33a6fd58c0
commit
4ed86ec392
|
@ -32,7 +32,7 @@ MTS_NAMESPACE_BEGIN
|
||||||
* For practical reasons, the integral is simultaneously computed
|
* For practical reasons, the integral is simultaneously computed
|
||||||
* for every pixel on the image plane. This is done similarly to
|
* for every pixel on the image plane. This is done similarly to
|
||||||
* path tracing with next event estimation (PTNEE) by tracing a
|
* path tracing with next event estimation (PTNEE) by tracing a
|
||||||
* shadow ray at every surface/volume interaction.
|
* shadow ray to the camera at every surface/volume interaction.
|
||||||
* An independent accumulation buffer will be assigned to each
|
* An independent accumulation buffer will be assigned to each
|
||||||
* processor so that the rendering process can run in parallel.
|
* processor so that the rendering process can run in parallel.
|
||||||
* When a perspective camera is used, the importance distribution
|
* When a perspective camera is used, the importance distribution
|
||||||
|
|
|
@ -444,7 +444,7 @@ Float ProductSpectrum::eval(Float lambda) const {
|
||||||
return m_spec1.eval(lambda) * m_spec2.eval(lambda);
|
return m_spec1.eval(lambda) * m_spec2.eval(lambda);
|
||||||
}
|
}
|
||||||
|
|
||||||
Float RayleighSpectrum::eval(Float lambda) {
|
Float RayleighSpectrum::eval(Float lambda) const {
|
||||||
Float lambdaSqr = lambda*lambda;
|
Float lambdaSqr = lambda*lambda;
|
||||||
|
|
||||||
return 1.0f / (lambdaSqr*lambdaSqr);
|
return 1.0f / (lambdaSqr*lambdaSqr);
|
||||||
|
|
|
@ -410,8 +410,9 @@ Spectrum Scene::getTransmittance(const Point &p1, const Point &p2,
|
||||||
|
|
||||||
bool surface = rayIntersect(ray, t, shape, n);
|
bool surface = rayIntersect(ray, t, shape, n);
|
||||||
|
|
||||||
if (medium)
|
if (medium)
|
||||||
transmittance *= medium->getTransmittance(Ray(ray, 0, std::min(t, remaining)), sampler);
|
transmittance *= medium->getTransmittance(
|
||||||
|
Ray(ray, 0, std::min(t, remaining)), sampler);
|
||||||
|
|
||||||
if (!surface)
|
if (!surface)
|
||||||
break;
|
break;
|
||||||
|
@ -422,7 +423,7 @@ Spectrum Scene::getTransmittance(const Point &p1, const Point &p2,
|
||||||
if (remaining > 0) {
|
if (remaining > 0) {
|
||||||
if (shape->isOccluder())
|
if (shape->isOccluder())
|
||||||
return Spectrum(0.0f);
|
return Spectrum(0.0f);
|
||||||
else if (shape->isMediumTransition())
|
else if (shape->isMediumTransition())
|
||||||
medium = dot(n, d) > 0 ? shape->getExteriorMedium()
|
medium = dot(n, d) > 0 ? shape->getExteriorMedium()
|
||||||
: shape->getInteriorMedium();
|
: shape->getInteriorMedium();
|
||||||
if (++iterations > 100) { /// Just a precaution..
|
if (++iterations > 100) { /// Just a precaution..
|
||||||
|
|
|
@ -164,6 +164,7 @@ bool ShapeKDTree::rayIntersect(const Ray &ray, Float &t, ConstShapePtr &shape, N
|
||||||
} else {
|
} else {
|
||||||
/// Uh oh... -- much unnecessary work is done here
|
/// Uh oh... -- much unnecessary work is done here
|
||||||
Intersection its;
|
Intersection its;
|
||||||
|
its.t = t;
|
||||||
shape->fillIntersectionRecord(ray,
|
shape->fillIntersectionRecord(ray,
|
||||||
reinterpret_cast<const uint8_t*>(temp) + 8, its);
|
reinterpret_cast<const uint8_t*>(temp) + 8, its);
|
||||||
n = its.geoFrame.n;
|
n = its.geoFrame.n;
|
||||||
|
|
Loading…
Reference in New Issue