NVlabs / nvdiffrecmc

Official code for the NeurIPS 2022 paper "Shape, Light, and Material Decomposition from Images using Monte Carlo Rendering and Denoising".
Other
363 stars 28 forks source link

Support for camera_space_light? #29

Closed saedrna closed 1 year ago

saedrna commented 1 year ago

In nvdiffrec, there is a mode for camera_space_light, which is used when an object is placed on a rotating stand table. I noticed that this feature has been removed in nvdiffrecmc. Is it possible to reintroduce this feature without delving into the CUDA/Optix code, and by simply tweaking the light directions in the Python section?

JHnvidia commented 1 year ago

Hi @saedrna,

The best way to solve it would unfortunately be to update the Optix code and add a similar transform to https://github.com/NVlabs/nvdiffrec/blob/main/render/light.py#L98 whenever evaluating / sampling the probe. It requires plumbing through extra data (e.g. the light transform matrix), which is why we dropped it.

A possible, workaround is to rotate the actual light image. In that case, it would should go just before updating the light_pdf https://github.com/NVlabs/nvdiffrecmc/blob/main/train.py#L422 You'd have to:

I'm not sure how well this would work in practice, as it requires re-sampling the light image, which will cause additional blurring.

saedrna commented 1 year ago

We have made a minor modification by adding the rotation matrix (three float3 for each row) and translation vector to the kernel.cu. It seems to work better for our dataset collected on a stand table. However, as you mentioned, the code now looks much less elegant.

blacksino commented 1 year ago

胡教授好,请问可以请教您一些这个repo代码的问题,感觉还是挺复杂的。