Skip to content

Fix delta emitter sample weights in the direct integrator - #1863

Open
JurriaanD wants to merge 1 commit into
mitsuba-renderer:masterfrom
JurriaanD:master
Open

Fix delta emitter sample weights in the direct integrator#1863
JurriaanD wants to merge 1 commit into
mitsuba-renderer:masterfrom
JurriaanD:master

Conversation

@JurriaanD

Copy link
Copy Markdown

Description

Fixes #1861

The direct illumination integrator computes the (MIS) weight of emitter samples as

Float mis = dr::select(ds.delta, Float(1.f), mis_weight(
                    ds.pdf * m_frac_lum, bsdf_pdf * m_frac_bsdf) * m_weight_lum);
result[active_e] += mis * bsdf_val * emitter_val;

where

  • m_frac_lum = emitter_samples / (emitter_samples + bsdf_samples)
  • m_frac_bsdf = bsdf_samples / (emitter_samples + bsdf_samples)
  • m_weight_lum = 1 / emitter_samples

The weight of delta emitters is simply set to 1 so we are adding 1 * bsdf * Li to the output for each sample. The more samples you take the brighter the output will be.
My fix consists of moving the multiplication by m_weight_lum down one line so that it is also applied for delta emitter samples.

This bug is only present in the direct illumination integrator as far as I can tell.

Testing

I added a test that constructs a scene with

  • A sphere with radius 1 at (0,0,0)
  • A point light at (0,0,2)
  • A camera at (0,0,5), looking down the z-axis

The scene is rendered with the direct integrator with emitter_samples=1 and emitter_samples=10. The test asserts that the color of the center pixel is the same in both renders.

Checklist

  • My code follows the style guidelines of this project
  • My changes generate no new warnings
  • My code also compiles for cuda_* and llvm_* variants. If you can't test this, please leave below
  • I have commented my code
  • I have made corresponding changes to the documentation (N/A)
  • I have added tests that prove my fix is effective or that my feature works
  • I cleaned the commit history and removed any "Merge" commits
  • I give permission that the Mitsuba 3 project may redistribute my contributions under the terms of its license

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Direct integrator weighs delta emitters contributions incorrectly

1 participant