half-potato / nmf

Our method takes as input a collection of images (100 in our experiments) with known cameras, and outputs the volumetric density and normals, materials (BRDFs), and far-field illumination (environment map) of the scene.
https://half-potato.gitlab.io/posts/nmf/
MIT License
52 stars 3 forks source link

Computation of Normals using finite-difference kernels #6

Closed eldar closed 11 months ago

eldar commented 11 months ago

Hi, congrats on a really awesome paper! I am particularly curious about how you compute normals on a tri-plane/TensoRF representation. In the paper you write:

However, like [20], we found that numerically computing spatial gradients of the density field using finite differences rather than using analytic gradients leads to normal vectors that we can use directly, without using features predicted by a separate MLP. Additionally, these numerical gradients can be efficiently computed using 2D and 1D convolution using TensorRF’s low-rank density decomposition

I was able to trace the implementation to the Triplanar and Convolver classes: https://github.com/half-potato/nmf/blob/main/fields/triplanar.py#L101 and https://github.com/half-potato/nmf/blob/main/modules/convolver.py#L52

However it seems that Triplanar class is not referenced in any of the experiments and never imported by other modules in the codebase. I just wanted to confirm whether this code is indeed the reference model, because the codebase also contains code to compute gradients with autograd https://github.com/half-potato/nmf/blob/main/fields/tensor_base.py#L119

Cheers, Eldar.

half-potato commented 11 months ago

Hi Eldar, Thanks for checking out our paper!

The gradient calculation can be found here: modules/grid_sample_Cinf.py

This special grid sample operator is used here: fields/tensoRF.py

The files you found are not used. I’ll try to get around to deleting them.

eldar commented 11 months ago

Thanks for the prompt response! There might still be typo in the code though, grid_sample2 used in https://github.com/half-potato/nmf/blob/main/fields/tensoRF.py#L255 is not defined anywhere.

Edit: Ignore the above, I should be looking at the TensoRF class not Triplanar.