- 
                Notifications
    You must be signed in to change notification settings 
- Fork 264
Flexible spectral sampling for sensors #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Flexible spectral sampling for sensors #142
Conversation
cb346ee    to
    81fb6f0      
    Compare
  
    | Hi @Speierers, I pushed an update to the  This is the refactored sensor creation function: def create_camera(o, d, fov=34, fov_axis="x", s_open=1.5, s_close=5, dict_srf=None):
    from mitsuba.core.xml import load_dict
    from mitsuba.core import Transform4f, Vector3f
    dict_camera = {
        "type": "perspective",
        "near_clip": 1.0,
        "far_clip": 35.0,
        "focus_distance": 15.0,
        "to_world": Transform4f.look_at(
            origin=Vector3f(o),
            target=Vector3f(o) + Vector3f(d),
            up=[0, 1, 0]
        ),
        "fov": fov,
        "fov_axis": fov_axis,
        "shutter_open": s_open,
        "shutter_close": s_close,
        "film": {
            "type": "hdrfilm",
            "width": 512,
            "height": 256,
        }
    }
    if dict_srf:
        dict_camera["srf"] = dict_srf
    return load_dict(dict_camera)Any idea of what could be wrong? | 
| 
 Maybe you should try using  | 
| Still no luck using  Edit: I got to the bottom of it, I had missed your point about  | 
15a7271    to
    4e6d703      
    Compare
  
    4e6d703    to
    223f853      
    Compare
  
    | Hi @Speierers, I'm reviving this PR a little: would you mind telling me if this implementation suits you? I could then proceed with propagating this to the other sensor plugins. I was actually wondering if it wouldn't be better (for maintenance) to have this implemented as part of  | 
878b46d    to
    65fe4a8      
    Compare
  
    | Hi @wjakob, I just finished propagating the sensor response function implementation to all the currently available sensor plugins (including relevant docs updates). The currently open questions are: 
 | 
a0b43ff    to
    17bbfcd      
    Compare
  
    Ported test_irradiancemeter.py Ported test_radiancemeter.py Ported test_thinlens.py Partially revert "Updated test_perspective.py" This reverts formatting changes in commit caf2198. Autopep8 and isort pass Updated perspective plugin and tests with SRF support Added flexible spectral range and default value to uniform spectrum plugin Fixes after rebase and ported tests to dict API Fixed perspective camera Added SRF to radiancemeter Added SRF to irradiancemeter plugin Updated plugin docs Docs update and minor fixes to uniform spectrum plugin Minor fix to uniform spectrum
17bbfcd    to
    f55dc8c      
    Compare
  
    | Hi @Speierers, I think this is still relevant to atmospheric radiative transfer use cases (although we're still not using it). I however wonder if changes could not be made more concise with some  | 
This PR adds flexible spectral sampling for sensors as discussed in #127. Changes are as follows. I only added it to the
perspectivesensor plugin so far, I'll add this to the other sensor plugins depending on feedback.Perspective camera plugin
I added a new member
m_srfwhich, if set, defines a spectrum from which sensor wavelengths will be sampled. As requested by @wjakob, I tried to minimize the performance overhead in default cases. This means that:m_srfwill be set tonullptr;m_srfis set when using a non-spectral variant, it will be ignored, set tonullptrand a warning will be issued;m_srfis set, it will be used to sample wavelengths when callingsample_rayorsample_ray_differential;Tests have been updated accordingly.
Uniform spectrum plugin
I added the possiblity to specify a spectral interval for which the uniform value is applied; otherwise, the plugin returns 0. This led to adding two plugin parameters
lambda_minandlambda_max, as well as the corresponding data members. All parameters are optional, includingvalue, which now defaults to 1 (not sure if it's desirable behaviour, I just thought it would be convenient sometimes). I'm however unsure about the performance cost brought by the multiple parameter checks I introduced: is it okay?Example renders
Default Cornell box:
Constant SSR (value=1) in [400, 500 nm] using modified
uniformspectrum plugin:Sentinel-2A/MSI Band 03 SSR using a loaded
irregularplugin:Todo