nv-tlabs / nglod

Neural Geometric Level of Detail: Real-time Rendering with Implicit 3D Shapes (CVPR 2021 Oral)
MIT License
866 stars 93 forks source link

C++ Renderer: Failure to render higher LODs #6

Open coledea opened 3 years ago

coledea commented 3 years ago

Thank you very much for your work and the provided code! I tried to run the C++ Renderer but encountered some problems when rendering higher LODs. I am using Windows 10 / Libtorch 1.8 / CUDA 11.1 with a GeForce RTX 3090.

I had to make some changes to get the code running, especially changing some datatypes (e.g. from long to uint64_t). All the changes can be seen here https://github.com/coledea/nglod/commit/9f2cebf07c9c699b52c2277177c0c03dcb882ac1. Additionally I had to set g_TargetLevel to something smaller than g_SPC.getLevel() (e.g. 5). Otherwise I would get an illegal memory access error. After that, the code compiled and I was able to run the application.

I trained on the armadillo model and I am able to render the neural representation with the provided python tools. With the C++ renderer, however, I am only able to render the lower LODs. On higher LODs, parts of the model are missing (as the pictures show) or I get the error CUDA Error: invalid configuration argument and nothing is rendered at all.

When activating debug output it shows for example a negative number for #elem in cf level 3:

offset_ on cf level 3 : 5122 # elem in cf level 3 : -1570503101 offset on parent nuggets array 4: 63 # elem in parent nuggets array 4: 156 offset on nuggets array 5 : 219 # elem in nuggets level 5 : 590

armadillo1 Lowest LOD. armadillo2 Lowest LOD + 2 armadillo3 Lowest LOD + 3

Have you ever encountered this sort of problem and do you maybe know how to fix this?

EDIT: Interestingly, I am able to render higher LODs when using the model provided in #5. After clicking repeatedly +, I then get again the CUDA error (invalid configuration argument). I am using this .npz file: link

tovacinni commented 3 years ago

Hi, thanks for your interest in our work.

It's very weird that it works with the model provided in the other issue... I've been meaning to dive into this issue but haven't had the time to do so yet. Thanks for your patience!

zhaoyuanyuan2011 commented 2 years ago

Hi @coledea , may I ask what parameters did you pass to output the .npz file? I noticed it's asking for --num_steps and --camera_clamp etc. but I'm not sure how to set them. Thank you!

coledea commented 2 years ago

I did just use the command specified in the readme. I did not pass values for num_steps or camera_clamp. Worked fine for me.

zhaoyuanyuan2011 commented 2 years ago

Hi @coledea , Thank you so much for the explanation! I manually set the values to default ones and it moved forward now.

May I ask that do you still remember how much memory is required to export a mesh using the command mentioned above? As I'm getting RuntimeError: CUDA out of memory. Tried to allocate 978.00 MiB (GPU 0; 22.38 GiB total capacity; 21.05 GiB already allocated; 63.94 MiB free; 21.68 GiB reserved in total by PyTorch) no matter which gpu I use. Thanks again!

--update-- Thank you for the reply!

Sylva-Lin commented 1 year ago

@zhaoyuanyuan2011 Hi, do you remember what the default values for these inputs (--num_steps and --camera_clamp etc.) are? I also need my own input here to run

I have found it at options.py and it moved forward now