From 70d805dee1d603aa1982db73edb76bb36bd49dd2 Mon Sep 17 00:00:00 2001 From: joshua Date: Sat, 21 Mar 2026 16:16:15 -0700 Subject: [PATCH 1/2] use copysign when making onb - upstream luisacompute commit changes defn of `sign`, not merged yet but it causes div by zero --- src/util/frame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/frame.cpp b/src/util/frame.cpp index 81091f93..ab37aa3f 100644 --- a/src/util/frame.cpp +++ b/src/util/frame.cpp @@ -19,7 +19,7 @@ Frame::Frame() noexcept _n{make_float3(0.f, 0.f, 1.f)} {} Frame Frame::make(Expr n) noexcept { - auto sgn = sign(n.z); + auto sgn = copysign(1.f, n.z); auto a = -1.f / (sgn + n.z); auto b = n.x * n.y * a; auto s = make_float3(1.f + sgn * sqr(n.x) * a, sgn * b, -sgn * n.x); From 015b5325c7caa6d36b0e1ae957b6e7666a1d4d23 Mon Sep 17 00:00:00 2001 From: joshua Date: Sat, 21 Mar 2026 18:14:46 -0700 Subject: [PATCH 2/2] make eta_scale part of path state - this is what pbrt does --- src/integrators/mega_path.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/integrators/mega_path.cpp b/src/integrators/mega_path.cpp index 18b4d98d..d820fc96 100644 --- a/src/integrators/mega_path.cpp +++ b/src/integrators/mega_path.cpp @@ -57,6 +57,7 @@ class MegakernelPathTracingInstance final : public ProgressiveIntegrator::Instan auto swl = spectrum->sample(spectrum->node()->is_fixed() ? 0.f : sampler()->generate_1d()); SampledSpectrum beta{swl.dimension(), camera_weight}; SampledSpectrum Li{swl.dimension()}; + Float eta_scale = def(1.f); auto ray = camera_ray; auto pdf_bsdf = def(1e16f); @@ -109,7 +110,6 @@ class MegakernelPathTracingInstance final : public ProgressiveIntegrator::Instan // evaluate material auto surface_tag = it->shape().surface_tag(); - auto eta_scale = def(1.f); $outline { PolymorphicCall call; @@ -137,8 +137,8 @@ class MegakernelPathTracingInstance final : public ProgressiveIntegrator::Instan // apply eta scale auto eta = closure->eta().value_or(1.f); $switch(surface_sample.event) { - $case(Surface::event_enter) { eta_scale = sqr(eta); }; - $case(Surface::event_exit) { eta_scale = sqr(1.f / eta); }; + $case(Surface::event_enter) { eta_scale *= sqr(eta); }; + $case(Surface::event_exit) { eta_scale *= sqr(1.f / eta); }; }; }); };