Skip to content

Commit

Permalink
Distant plugin fix and docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
leroyvn committed May 26, 2020
1 parent b4e6a8a commit 2e7ef08
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/sensors/distant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,14 @@ Distant directional sensor (:monosp:`distant`)
uniformly over the entire scene.
This sensor plugin implements a distant directional sensor which records
radiation leaving the scene in a given direction. If the ``target`` parameter
is not set, rays cast by the sensor will be distributed uniformly on the cross
section of the scene's bounding sphere.
radiation leaving the scene in a given direction. By default, it records the
(spectral) radiant flux per unit solid angle leaving the scene in the specified
direction (in unit power per unit solid angle). Rays cast by the sensor are
distributed uniformly on the cross section of the scene's bounding sphere.
If the ``target`` parameter is not set, the sensor looks at a single point and
records a (spectral) radiant flux per unit surface area per unit solid angle
(in unit power per unit surface area per unit solid angle).
*/

Expand Down Expand Up @@ -116,7 +121,10 @@ MTS_VARIANT class DistantSensor final : public Sensor<Float, Spectrum> {
}

ray.update();
return std::make_pair(ray, wav_weight);
return std::make_pair(
ray, m_has_target
? wav_weight
: wav_weight * (math::Pi<Float> * sqr(m_bsphere.radius)));
}

std::pair<RayDifferential3f, Spectrum> sample_ray_differential(
Expand Down Expand Up @@ -153,7 +161,10 @@ MTS_VARIANT class DistantSensor final : public Sensor<Float, Spectrum> {
ray.has_differentials = false;

ray.update();
return std::make_pair(ray, wav_weight);
return std::make_pair(
ray, m_has_target
? wav_weight
: wav_weight * (math::Pi<Float> * sqr(m_bsphere.radius)));
}

/// This sensor does not occupy any particular region of space, return an
Expand Down

0 comments on commit 2e7ef08

Please sign in to comment.