Closed Immocat closed 6 years ago
I'm a little bit confused by the implementation of HomogeneousMedium::Sample.
HomogeneousMedium::Sample
Around line 57, homogeneous.cpp(Also at Page 894 in pbrt3 book)
homogeneous.cpp
Float dist = -std::log(1 - sampler.Get1D()) / sigma_t[channel]; Float t = std::min(dist * ray.d.Length(), ray.tMax);
As far as I know, the dist is the sampled distance over [0,+inf). For rays ( o + d t ), `dist == t ray.d.Length(), andt = dist / ray.d.Length()`.
dist
, and
Why the code is dist * ray.d.Length()? Maybe I misunderstand something, or it is a bug here.
dist * ray.d.Length()
Thanks!
I'm a little bit confused by the implementation of
HomogeneousMedium::Sample
.Around line 57,
homogeneous.cpp
(Also at Page 894 in pbrt3 book)As far as I know, the
dist
is the sampled distance over [0,+inf). For rays ( o + d t ), `dist == t ray.d.Length(), and
t = dist / ray.d.Length()`.Why the code is
dist * ray.d.Length()
? Maybe I misunderstand something, or it is a bug here.