mitsuba-renderer / mitsuba

Mitsuba renderer main repository
GNU General Public License v3.0
1.05k stars 321 forks source link

Cannot render negative values with field integrator (e.g. normals, position) #112

Open paulsans opened 5 years ago

paulsans commented 5 years ago

As the Mitsuba documentation suggests in section 8.10.18, there is a possibility to render e.g. normal maps or depth maps using the field integrator. Some of these fields can have negative values, e.g. position or geoNormal.

However, negative values are treated as bad sample by Mitsuba and are not added to the frame buffer: https://github.com/mitsuba-renderer/mitsuba/blob/26355676fa45feb5acca3f42b023a055ad2bb7e3/include/mitsuba/render/imageblock.h#L144

Hence, fields such as normals or positions cannot be rendered properly.

Do I miss something here?

chaosink commented 5 years ago

If you use an HDR viewer that can exhibit pixel values, like tev, you will find that the black pixels in normal maps acturally DO have negative components.


A sample containing negative components is treated as bad_sample by ImageBlock only when ImageBlock::m_warn is true. https://github.com/mitsuba-renderer/mitsuba/blob/26355676fa45feb5acca3f42b023a055ad2bb7e3/include/mitsuba/render/imageblock.h#L149-L150

And for multichannel integrator, ImageBlock::m_warn is set to be false through the last parameter of the function BlockedRenderProcess::setPixelFormat() in the following code. https://github.com/mitsuba-renderer/mitsuba/blob/1fd0f671dfcb77f813c0d6a36f2aa4e480b5ca8e/src/integrators/misc/multichannel.cpp#L143-L145


However, here comes another question: What about the radiance values which are bad_sample for multichannel integrator?

paulsans commented 5 years ago

Is there a way to set m_warn to false in the GUI or in the Python interface?