Skip to content

Propose a solution about fixing connection of delta emitters to senso…#1848

Open
dongclin wants to merge 1 commit intomitsuba-renderer:masterfrom
dongclin:fix_ptracer_delta_emitter_with_irradiancemeter
Open

Propose a solution about fixing connection of delta emitters to senso…#1848
dongclin wants to merge 1 commit intomitsuba-renderer:masterfrom
dongclin:fix_ptracer_delta_emitter_with_irradiancemeter

Conversation

@dongclin
Copy link
Copy Markdown
Contributor

@dongclin dongclin commented Feb 11, 2026

Description

Address the limitations of the default ptracer integrator when simulating a system with delta emitters (e.g. Spot/Point Lights) and spatially extended sensors (e.g. Irradiancemeter)

  1. Connectivity for delta emitters:
  • Under ptracer implementation, point light produces negligible signal (on the order of 10^-6)
newplot (21)
  • ptracer seems originally be designed for a pinhole camera, since the probability of a ray from a delta emitter to a delta sensor is zero, the integrator explicitly prevents connections between these. ref
  1. Constant Monte Carlo weighting (Distance Independence)
  • The rendered irradiance value of an irradiancemeter from an area light (which is not delta light) remains nearly constant regardless of the distance between the emitter and the sensor, it should probably follow the inverse-square law.
newplot (17)
  • irradiancemeter::sample_direction returned a fixed weight of dr::Pi. ref

Suggest fix

ptracer

  • Enabling Connection for Delta emitter: If the sensor needs an aperture sample (e.g. irradiancemeter) we allow delta lights to connect to it.
  • Add a has_frame check to verify a valid normal exists before performing coordinate transformations or back-face checks. (Since a delta light wound't have a normal si.n)

irradiancemeter

  • Change Monte Carlo weighting: Updated the return value to use the standard Monte Carlo weight: (1 / (PDF * surface_area)).

Testing

To validate the modifications made to the ptracer integrator and the irradiancemeter sensor, a numerical verification test was performed by comparing simulation results against an analytical solution for a fundamental optical setup.

The test considers a disk of radius R centered at the origin (0,0,0) in the xy-plane, illuminated by a point light source with radiant intensity I (Watt/Steradian) located at height h on the z-axis.

Analytical solution

# Formula for Flux of point source over a disk:
# Flux = 2 * pi * I * (1 - h / sqrt(R^2 + h^2))
term = h_height / np.sqrt(R_radius**2 + h_height**2)
total_flux_analytical = 2 * np.pi * I_intensity * (1 - term)
avg_irradiance_analytical = total_flux_analytical / disk_area

Scene setting

mi.set_variant('llvm_ad_spectral')
 
scene_dict: dict[str, Any] = {
    'type': 'scene',
    'integrator': {
        'type': integrator_type,
        'max_depth': 2,
    },
    'sensor_disk': {
        'type': 'disk',
        'to_world': mi.ScalarTransform4f(),
        'sensor': {
            'type': 'irradiancemeter',
            'srf': {
                'type': 'regular',
                'wavelength_min': 360.0, # MI_CIE_MIN
                'wavelength_max': 830.0, # MI_CIE_MAX defined in spectrum.h
                'values': '1.0, 1.0'
            },
            'film': {
                'type': 'hdrfilm',
                'width': 1,
                'height': 1,
                'pixel_format': 'luminance',      
                'rfilter': {
                    'type': 'box'
                }
            },
        },
    },
    'emitter': {
        'type': 'point',
        'position': [0, 0, z_value],
        'intensity': {
            'type': 'spectrum',
            'value': 1.0,
        },
    }, 
}

Test Results:
newplot (22)

newplot (23)
  1. Signal Detection: The ptracer now successfully captures signals from a point light source, resolving the connectivity issue.
  2. Physical Accuracy: The trends of mi Irradiance and Analytical Irradiance are almost the same.

Additionally, unit tests were implemented for the test_incoming_flux_integrator function. During these tests, the measured value of mi.TensorXf(img) was approximately 3.8, which is consistent with the theoretical expectation of radiance * dr.pi

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
  • 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.

1 participant