-
When there is previous surface interaction But how on earth does this code work, when if (dr::any_or<true>(si.emitter(scene) != nullptr)) {
// On 0th iteration, the prev_si contains all zeros, meaning ds generates direction towards si.p from world origin ?
// But shouldn't the direction be from ray.o towards si.p ???
DirectionSample3f ds(scene, si, ls.prev_si);
Float em_pdf = 0.f;
// Cos theta term is internally computed based on ds.d and si.n
if (dr::any_or<true>(!ls.prev_bsdf_delta))
em_pdf = scene->pdf_emitter_direction(ls.prev_si, ds, !ls.prev_bsdf_delta);
Float mis_bsdf = mis_weight(ls.prev_bsdf_pdf, em_pdf);
ls.result = spec_fma(ls.throughput, ds.emitter->eval(si, ls.prev_bsdf_pdf > 0.f) * mis_bsdf, ls.result);
} So I guess my question is, why the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @xacond00 The Note that |
Beta Was this translation helpful? Give feedback.
Hi @xacond00
The
prev_bsdf_delta
variable is initialized totrue
, so the entireem_pdf = scene->pdf_emitter_direction(ls.prev_si, ds, !ls.prev_bsdf_delta);
computation is masked (the second argument ofpdf_emitter_direction
is a mask to indicate which lanes/threads are active). Effectively this means thatem_pdf
is equal to0
and doesn't depend on the cosine term you mentioned.Note that
prev_bsdf_pdf
is initialized as1
, so themis_bsdf
is equal to1
even thoughem_pdf
is 0.