Skip to content
Snippets Groups Projects
Commit 7ace2e3c authored by Thomas Müller's avatar Thomas Müller
Browse files

Make `instant-ngp` binary available in the top-level dir

parent d4610140
No related branches found
No related tags found
No related merge requests found
......@@ -139,9 +139,9 @@ jobs:
LICENSE.txt
README.md
requirements.txt
${{ env.build_dir }}/cudart64*.dll
${{ env.build_dir }}/instant-ngp.exe
${{ env.build_dir }}/nvngx_dlss.dll
cudart64*.dll
instant-ngp.exe
nvngx_dlss.dll
configs/
docs/nerf_dataset_tips.md
docs/assets_readme/
......
......@@ -8,6 +8,9 @@
/tmp
/venv
/video
/instant-ngp
/*.dll
/*.exe
/*.json
*.msgpack
*.training
......
......@@ -306,6 +306,17 @@ if (NGP_VULKAN)
endif()
endif()
if (MSVC)
# Copy CUDA runtime DLLs to the build directory so that Python can find them.
file(GLOB CUDA_DLLS "${CUDA_COMPILER_BIN}/cudart64*.dll")
if (CUDA_DLLS)
add_custom_command(TARGET instant-ngp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CUDA_DLLS} $<TARGET_FILE_DIR:instant-ngp>
COMMAND_EXPAND_LISTS
)
endif()
endif()
if (Python_FOUND)
add_library(pyngp SHARED src/python_api.cu)
......@@ -315,13 +326,18 @@ if (Python_FOUND)
pybind11_extension(pyngp)
endif()
# Link the executable to the project directory and copy over DLLs such that instant-ngp can be invoked without going into the build folder.
set(NGP_BINARY_FILE "\"${CMAKE_CURRENT_SOURCE_DIR}/$<TARGET_FILE_NAME:instant-ngp>\"")
file(TO_NATIVE_PATH ${NGP_BINARY_FILE} NGP_BINARY_FILE)
if (MSVC)
# Copy CUDA runtime DLLs to the build directory so that Python can find them.
file(GLOB CUDA_DLLS "${CUDA_COMPILER_BIN}/cudart64*.dll")
if (CUDA_DLLS)
add_custom_command(TARGET pyngp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CUDA_DLLS} $<TARGET_FILE_DIR:pyngp>
add_custom_command(TARGET instant-ngp POST_BUILD COMMAND cmd /C del /F /Q "${NGP_BINARY_FILE}" && cmd /C mklink /H "${NGP_BINARY_FILE}" "\"$<TARGET_FILE:instant-ngp>\"")
file(GLOB REQUIRED_DLLS "${CMAKE_CURRENT_BINARY_DIR}/*.dll")
if (REQUIRED_DLLS)
add_custom_command(TARGET instant-ngp POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${REQUIRED_DLLS} ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND_EXPAND_LISTS
)
endif()
else()
add_custom_command(TARGET instant-ngp POST_BUILD COMMAND ${CMAKE_COMMAND} -E create_symlink $<TARGET_FILE:instant-ngp> "${NGP_BINARY_FILE}")
endif()
......@@ -80,7 +80,7 @@ instant-ngp$ cmake --build build --config RelWithDebInfo -j
If compilation fails inexplicably or takes longer than an hour, you might be running out of memory. Try running the above command without `-j` in that case.
If this does not help, please consult [this list of possible fixes](https://github.com/NVlabs/instant-ngp#troubleshooting-compile-errors) before opening an issue.
If the build succeeds, you can now run the code via the `build/instant-ngp` executable or the `scripts/run.py` script described below.
If the build succeeds, you can now run the code via the `./instant-ngp` executable or the `scripts/run.py` script described below.
If automatic GPU architecture detection fails, (as can happen if you have multiple GPUs installed), set the `TCNN_CUDA_ARCHITECTURES` environment variable for the GPU you would like to use. The following table lists the values for common GPUs. If your GPU is not listed, consult [this exhaustive list](https://developer.nvidia.com/cuda-gpus).
......@@ -109,13 +109,13 @@ Let's start using __instant-ngp__; more information about the GUI and other scri
One test scene is provided in this repository, using a small number of frames from a casually captured phone video:
```sh
instant-ngp$ ./build/instant-ngp data/nerf/fox
instant-ngp$ ./instant-ngp data/nerf/fox
```
On Windows you need to reverse the slashes here (and below), i.e.:
```sh
instant-ngp> .\build\instant-ngp data\nerf\fox
instant-ngp> .\instant-ngp data\nerf\fox
```
<img src="docs/assets_readme/fox.png"/>
......@@ -124,7 +124,7 @@ Alternatively, download any NeRF-compatible scene (e.g. from the [NeRF authors'
Now you can run:
```sh
instant-ngp$ ./build/instant-ngp data/nerf_synthetic/lego/transforms_train.json
instant-ngp$ ./instant-ngp data/nerf_synthetic/lego/transforms_train.json
```
**[To prepare your own dataset for use with our NeRF implementation, click here.](docs/nerf_dataset_tips.md)** See also [this video](https://www.youtube.com/watch?v=8GbENSmdVeE) for a guided walkthrough.
......@@ -132,7 +132,7 @@ instant-ngp$ ./build/instant-ngp data/nerf_synthetic/lego/transforms_train.json
### SDF armadillo
```sh
instant-ngp$ ./build/instant-ngp data/sdf/armadillo.obj
instant-ngp$ ./instant-ngp data/sdf/armadillo.obj
```
<img src="docs/assets_readme/armadillo.png"/>
......@@ -140,7 +140,7 @@ instant-ngp$ ./build/instant-ngp data/sdf/armadillo.obj
### Image of Einstein
```sh
instant-ngp$ ./build/instant-ngp data/image/albert.exr
instant-ngp$ ./instant-ngp data/image/albert.exr
```
<img src="docs/assets_readme/albert.png"/>
......@@ -148,7 +148,7 @@ instant-ngp$ ./build/instant-ngp data/image/albert.exr
To reproduce the gigapixel results, download, for example, [the Tokyo image](https://www.flickr.com/photos/trevor_dobson_inefekt69/29314390837) and convert it to `.bin` using the `scripts/convert_image.py` script. This custom format improves compatibility and loading speed when resolution is high. Now you can run:
```sh
instant-ngp$ ./build/instant-ngp data/image/tokyo.bin
instant-ngp$ ./instant-ngp data/image/tokyo.bin
```
......@@ -157,7 +157,7 @@ instant-ngp$ ./build/instant-ngp data/image/tokyo.bin
Download the [nanovdb volume for the Disney cloud](https://drive.google.com/drive/folders/1SuycSAOSG64k2KLV7oWgyNWyCvZAkafK?usp=sharing), which is derived [from here](https://disneyanimation.com/data-sets/?drawer=/resources/clouds/) ([CC BY-SA 3.0](https://media.disneyanimation.com/uploads/production/data_set_asset/6/asset/License_Cloud.pdf)).
```sh
instant-ngp$ ./build/instant-ngp data/volume/wdas_cloud_quarter.nvdb
instant-ngp$ ./instant-ngp data/volume/wdas_cloud_quarter.nvdb
```
<img src="docs/assets_readme/cloud.png"/>
......@@ -190,13 +190,13 @@ Some popular user controls in __instant-ngp__ are:
* __Rendering -> DLSS:__ toggling this on and setting "DLSS sharpening" below it to 1.0 can often improve rendering quality.
* __Rendering -> Crop size:__ trim back the surrounding environment to focus on the model. "Crop aabb" lets you move the center of the volume of interest and fine tune. See more about this feature in [our NeRF training & dataset tips](https://github.com/NVlabs/instant-ngp/blob/master/docs/nerf_dataset_tips.md).
The "Camera path" GUI lets you set frames along a path. "Add from cam" is the main button you'll want to push, then saving out the camera keyframes using "Save" to create a `base_cam.json` file. There is a bit more information about the GUI [in this post](https://developer.nvidia.com/blog/getting-started-with-nvidia-instant-nerfs/) and [in this (bit dated) video](https://www.youtube.com/watch?v=z3-fjYzd0BA).
The "Camera path" GUI lets you set frames along a path. "Add from cam" is the main button you'll want to push. Then, you can render a video `.mp4` of your camera path or export the keyframes to a `.json` file. There is a bit more information about the GUI [in this post](https://developer.nvidia.com/blog/getting-started-with-nvidia-instant-nerfs/) and [in this (bit dated) video](https://www.youtube.com/watch?v=z3-fjYzd0BA).
## Python bindings
To conduct controlled experiments in an automated fashion, all features from the interactive GUI (and more!) have Python bindings that can be easily instrumented.
For an example of how the `./build/instant-ngp` application can be implemented and extended from within Python, see `./scripts/run.py`, which supports a superset of the command line arguments that `./build/instant-ngp` does.
For an example of how the `./instant-ngp` application can be implemented and extended from within Python, see `./scripts/run.py`, which supports a superset of the command line arguments that `./instant-ngp` does.
Here is a typical command line using `scripts/run.py` to generate a 5-second flythrough of the fox dataset to the (default) file `video.mp4`, after using the GUI to save a (default) NeRF snapshot `base.msgpack` and a set of camera key frames: (see [this video](https://www.youtube.com/watch?v=8GbENSmdVeE) for a guided walkthrough)
......@@ -213,7 +213,7 @@ Happy hacking!
__Q:__ How can I run __instant-ngp__ in headless mode?
__A:__ Use `./build/instant-ngp --no-gui` or `python scripts/run.py`. You can also compile without GUI via `cmake -DNGP_BUILD_WITH_GUI=off ...`
__A:__ Use `./instant-ngp --no-gui` or `python scripts/run.py`. You can also compile without GUI via `cmake -DNGP_BUILD_WITH_GUI=off ...`
##
__Q:__ Does this codebase run on [Google Colab](https://colab.research.google.com/)?
......@@ -295,7 +295,7 @@ If your problem persists, consult the following table of known issues.
| __Compile error:__ A single input file is required for a non-link phase when an outputfile is specified | Ensure there no spaces in the path to __instant-ngp__. Some build systems seem to have trouble with those. ([#39](https://github.com/NVlabs/instant-ngp/issues/39) [#198](https://github.com/NVlabs/instant-ngp/issues/198)) |
| __Compile error:__ undefined references to "cudaGraphExecUpdate" / identifier "cublasSetWorkspace" is undefined | Update your CUDA installation (which is likely 11.0) to 11.3 or higher. ([#34](https://github.com/NVlabs/instant-ngp/issues/34) [#41](https://github.com/NVlabs/instant-ngp/issues/41) [#42](https://github.com/NVlabs/instant-ngp/issues/42)) |
| __Compile error:__ too few arguments in function call | Update submodules with the above two `git` commands. ([#37](https://github.com/NVlabs/instant-ngp/issues/37) [#52](https://github.com/NVlabs/instant-ngp/issues/52)) |
| __Python error:__ No module named 'pyngp' | It is likely that CMake did not detect your Python installation and therefore did not build `pyngp`. Check CMake logs to verify this. If `pyngp` was built in a different folder than `instant-ngp/build`, Python will be unable to detect it and you have to supply the full path to the import statement. ([#43](https://github.com/NVlabs/instant-ngp/issues/43)) |
| __Python error:__ No module named 'pyngp' | It is likely that CMake did not detect your Python installation and therefore did not build `pyngp`. Check CMake logs to verify this. If `pyngp` was built in a different folder than `build`, Python will be unable to detect it and you have to supply the full path to the import statement. ([#43](https://github.com/NVlabs/instant-ngp/issues/43)) |
If you cannot find your problem in the table, try searching [the discussions board](https://github.com/NVlabs/instant-ngp/discussions) and [the issues area](https://github.com/NVlabs/instant-ngp/issues?q=is%3Aissue) for help. If you are still stuck, please [open an issue](https://github.com/NVlabs/instant-ngp/issues/new) and ask for help.
......
......@@ -109,7 +109,7 @@ The `aabb_scale` parameter is the most important `instant-ngp` specific paramete
Assuming success, you can now train your NeRF model as follows, starting in the `instant-ngp` folder:
```sh
instant-ngp$ ./build/instant-ngp [path to training data folder containing transforms.json]
instant-ngp$ ./instant-ngp [path to training data folder containing transforms.json]
```
### Record3D
......@@ -121,13 +121,13 @@ With an >=iPhone 12 Pro, one can use [Record3D](https://record3d.app/) to collec
3. Replace the `.r3d` extension with `.zip` and unzip the file to get a directory `path/to/data`.
4. Run the preprocessing script:
```
python scripts/record3d2nerf.py --scene path/to/data
instant-ngp$ python scripts/record3d2nerf.py --scene path/to/data
```
If you capture the scene in the landscape orientation, add `--rotate`.
5. Launch Instant-NGP training:
```
./build/instant-ngp path/to/data
instant-ngp$ ./instant-ngp path/to/data
```
## Tips for NeRF training data
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment