Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/integrators/volpath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ class VolumetricPathIntegrator : public MonteCarloIntegrator<Float, Spectrum> {
return { emitter_val, ds };
}

Ray3f ray = ref_interaction.spawn_ray(ds.d);
Ray3f ray = ref_interaction.spawn_ray_to(ds.p);
Float max_dist = ray.maxt;

// Potentially escaping the medium if this is the current medium's boundary
if constexpr (std::is_convertible_v<Interaction, SurfaceInteraction3f>)
Expand All @@ -356,7 +357,7 @@ class VolumetricPathIntegrator : public MonteCarloIntegrator<Float, Spectrum> {
sampler->loop_put(loop);
loop.init();
while (loop(dr::detach(active))) {
Float remaining_dist = ds.dist * (1.f - math::ShadowEpsilon<Float>) - total_dist;
Float remaining_dist = max_dist - total_dist;
ray.maxt = remaining_dist;
active &= remaining_dist > 0.f;
if (dr::none_or<false>(active))
Expand Down
6 changes: 3 additions & 3 deletions src/integrators/volpathmis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,8 @@ class VolpathMisIntegratorImpl final : public MonteCarloIntegrator<Float, Spectr
return { p_over_f_nee, p_over_f_uni, emitter_val, ds};
}

Ray3f ray = ref_interaction.spawn_ray(ds.d);
Ray3f ray = ref_interaction.spawn_ray_to(ds.p);
Float max_dist = ray.maxt;

// Potentially escaping the medium if this is the current medium's boundary
if constexpr (std::is_convertible_v<Interaction, SurfaceInteraction3f>)
Expand All @@ -408,8 +409,7 @@ class VolpathMisIntegratorImpl final : public MonteCarloIntegrator<Float, Spectr
sampler->loop_put(loop);
loop.init();
while (loop(dr::detach(active))) {

Float remaining_dist = ds.dist * (1.f - math::ShadowEpsilon<Float>) - total_dist;
Float remaining_dist = max_dist - total_dist;
ray.maxt = remaining_dist;
active &= remaining_dist > 0.f;
if (dr::none_or<false>(active))
Expand Down
5 changes: 3 additions & 2 deletions src/python/python/ad/integrators/prbvolpath.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ def sample_emitter(self, mei, si, active_medium, active_surface, scene, sampler,
medium = dr.select(active, medium, dr.zeros(mi.MediumPtr))
medium[(active_surface & si.is_medium_transition())] = si.target_medium(ds.d)

ray = ref_interaction.spawn_ray(ds.d)
ray = ref_interaction.spawn_ray_to(ds.p)
max_dist = mi.Float(ray.maxt)
total_dist = mi.Float(0.0)
si = dr.zeros(mi.SurfaceInteraction3f)
needs_intersection = mi.Bool(True)
Expand All @@ -340,7 +341,7 @@ def sample_emitter(self, mei, si, active_medium, active_surface, scene, sampler,
state=lambda: (sampler, active, medium, ray, total_dist,
needs_intersection, si, transmittance))
while loop(active):
remaining_dist = ds.dist * (1.0 - mi.math.ShadowEpsilon) - total_dist
remaining_dist = max_dist - total_dist
ray.maxt = dr.detach(remaining_dist)
active &= remaining_dist > 0.0

Expand Down