Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/integrators/direct.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ class DirectIntegrator : public SamplingIntegrator<Float, Spectrum> {
bsdf_val = si.to_world_mueller(bsdf_val, -wo, si.wi);

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;
ds.pdf * m_frac_lum, bsdf_pdf * m_frac_bsdf));
result[active_e] += mis * bsdf_val * emitter_val * m_weight_lum;
}
}

Expand Down
62 changes: 62 additions & 0 deletions src/integrators/tests/test_direct.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
import pytest
import drjit as dr
import mitsuba as mi

def test01_delta_emitter_samples_weighted(variants_all_rgb):
scene = mi.load_dict({
'type': 'scene',
'sensor': {
'type': 'perspective',
'to_world': mi.ScalarTransform4f().look_at(
origin=(0, 0, 5),
target=(0, 0, 0),
up=(0, 1, 0),
),
'sampler': {
'type': 'independent',
'sample_count': 1
},
'film': {
'type': 'hdrfilm',
'width': 128, 'height': 128,
'crop_offset_x': 64,
'crop_offset_y': 64,
'crop_width': 1,
'crop_height': 1
},
},
'emitter' : {
'type': 'point',
'position': [0.0, 0.0, 2.0],
'intensity': {
'type': 'rgb',
'value': 1.0,
}
},
'sphere' : {
'type': 'sphere',
'center': [0.0, 0.0, 0.0],
'radius': 1,
'bsdf': {
'type': 'diffuse'
}
}
})

integrator = mi.load_dict({
'type': 'direct',
'emitter_samples': 1,
'bsdf_samples': 0,
})
single_sample_img = mi.render(scene, integrator=integrator)

integrator = mi.load_dict({
'type': 'direct',
'emitter_samples': 10,
'bsdf_samples': 0,
})
multi_sample_img = mi.render(scene, integrator=integrator)
# The number of emitter samples should not affect a scene with a single
# point light source.
diff = single_sample_img.array - multi_sample_img.array
assert dr.allclose(diff, 0)