You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Large README update
copied in intro copy from docs
replaced banner image
Removed install instructions to point to docs
Updated a bunch of build info
Removed examples
Some formatting unification bits and bobs
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>
fVDB is a Python library of data structures and algorithms for building high-performance and large-domain
4
+
spatial applications using [NanoVDB](https://dl.acm.org/doi/abs/10.1145/3450623.3464653) on the GPU
5
+
in [PyTorch](https://pytorch.org/).
6
+
Applications of fVDB include 3D deep learning, computer graphics/vision, robotics, and scientific computing.
3
7
4
-
This repository contains the code for *f*VDB, a framework for encoding and operating on *sparse voxel hierarchies* of features in PyTorch. A sparse voxel hierarchy is a coarse-to-fine hierarchy of sparse voxel grids such that every fine voxel is contained within some coarse voxel. The image below illustrates an example. *f*VDB supports using PyTorch Tensors to represent features at the corners and centers of voxels in a hierarchy and enables a number of differentiable operations on these Tensors (*e.g.* trilinear interpolation, convolution, splatting, ray tracing).
<figcaptionstyle="text-align: center; font-style: italic;">An example of a sparse voxel hierarchy with 3 levels. Each fine voxel is contained within exactly one coarse voxel.</figcaption>
*f*VDB was first developed by the [NVIDIA High-Fidelity Physics Research Group](https://research.nvidia.com/labs/prl/) (a part of the NVIDIA Spatial Intelligence Lab) and continues to be developed with the OpenVDB community to suit the growing needs for a robust framework for spatial intelligence research and applications. Please review [the paper](https://research.nvidia.com/labs/prl/publication/williams2024fvdb/) for more details and kindly consider [citing it in your work](#references) if you find it useful.
13
13
14
-
## Learning to Use *f*VDB
15
-
16
-
After [installing *f*VDB](#installing-fvdb), we recommend starting with our walk-through [notebooks](notebooks) which provide a gentle, illustrated introduction to the main concepts and operations in *f*VDB.
17
-
18
-
Once familiar with the basics, [Usage Examples](#usage-examples) introduces a few of the practical python scripts that can be further explored in the [examples](examples) directory.
19
-
20
-
Lastly, our [documentation](docs) provides deeper details on the concepts as well as an exhaustive set of illustrations of all the operations available in *f*VDB and an API reference. The [documentation can be built locally](#building-documentation) or can be accessed online at https://www.openvdb.org/documentation/fvdb/.
21
-
22
-
## Installing *f*VDB
23
-
24
-
The `fvdb_core` Python package can be installed either using published packages with pip or built
25
-
from source.
26
14
27
-
### Platform Requirements
15
+
fVDB was first developed by the [NVIDIA High-Fidelity Physics Research Group](https://research.nvidia.com/labs/prl/)
16
+
within the [NVIDIA Spatial Intelligence Lab](https://research.nvidia.com/labs/sil/), and continues to be
17
+
developed with the OpenVDB community to suit the growing needs for a robust framework for
18
+
spatial intelligence research and applications.
28
19
29
-
#### Software
20
+
[The paper](https://research.nvidia.com/labs/prl/publication/williams2024fvdb/) is available for more details, kindly consider [citing it in your work](#references) if you find it useful.
30
21
31
-
fVDB is currently supported on the matrix of dependencies in the following table.
If the [pre-built packages](https://fvdb.ai/installation.html) do not meet your needs, you can build *f*VDB from source in this repository.
41
+
56
42
### Environment Management
57
43
58
44
ƒVDB is a Python library implemented as a C++ Pytorch extension. We provide three paths to
@@ -110,12 +96,12 @@ Running a Docker container ensures that you have a consistent environment for bu
110
96
111
97
Our provided [`Dockerfile`](Dockerfile) constructs a container that pre-installs the dependencies needed to build and run ƒVDB.
112
98
113
-
In the fvdb-core directory, build the Docker image:
99
+
1.In the fvdb-core directory, build the Docker image:
114
100
```shell
115
101
docker build -t fvdb-devel .
116
102
```
117
103
118
-
When you are ready to build ƒVDB, run the following command within the docker container. `TORCH_CUDA_ARCH_LIST` specifies which CUDA architectures to build for.
104
+
2.When you are ready to build ƒVDB, run the following command within the docker container. `TORCH_CUDA_ARCH_LIST` specifies which CUDA architectures to build for.
119
105
```shell
120
106
docker run -it --mount type=bind,src="$(pwd)",target=/workspace fvdb-devel bash
121
107
cd /workspace;
@@ -130,31 +116,39 @@ In order to extract an artifact from the container such as the Python wheel, que
130
116
131
117
#### **OPTION 3** Python Virtual Environment
132
118
133
-
Using a Python virtual environment enables you to use your system provided compiler and CUDA toolkit. This can be especially useful if you are using ƒVDB in conjunction with other Python packages, especially packages that have been built from source. Start by installing GCC, the CUDA Toolkit, and cuDNN.
119
+
Using a Python virtual environment enables you to use your system provided compiler and CUDA toolkit. This can be especially useful if you are using ƒVDB in conjunction with other Python packages, especially packages that have been built from source.
120
+
121
+
1. Start by installing GCC, the CUDA Toolkit, and cuDNN.
134
122
135
-
Then, create a Python virtual environment, install the requisite dependencies, and build:
123
+
2.Then, create a Python virtual environment, install the requisite dependencies, and build:
Note: adjust the TORCH_CUDA_ARCH_LIST to suit your needs. If you are building just to run on a single machine, including only the present GPU architecture(s) reduces build time.
133
+
144
134
---
145
135
146
136
### Building *f*VDB
147
137
148
-
**:warning: Note:** Compilation can be very memory-consuming. As part of our build script, we set the `CMAKE_BUILD_PARALLEL_LEVEL` environment variable to control compilation job parallelism with a value that we find works well for most machines (allowing for one job every 2.5GB of memory) but this can be overridden by setting the `CMAKE_BUILD_PARALLEL_LEVEL` environment variable to a different value.
138
+
#### Tips for Building *f*VDB
149
139
150
-
** Note:**To save time and trouble on repeated clean builds, configure your `CPM_SOURCE_CACHE`. Add the following to your shell configuration (e.g. `.bashrc`)
140
+
-**:warning:**Compilation can be very memory-consuming. As part of our build script, we set the `CMAKE_BUILD_PARALLEL_LEVEL` environment variable to control compilation job parallelism with a value that we find works well for most machines (allowing for one job every 2.5GB of memory) but this can be overridden by setting the `CMAKE_BUILD_PARALLEL_LEVEL` environment variable to a different value.
151
141
152
-
```shell
153
-
export CPM_SOURCE_CACHE=$HOME/.cache/CPM
154
-
```
142
+
- To save time and trouble on repeated clean builds, configure your `CPM_SOURCE_CACHE`. Add the following to your shell configuration (e.g. `.bashrc`)
155
143
156
-
If this is not set, CMake Package Manager (CPM) will cache in the fVDB build directory. Keeping the cache outside of the build directory allows build-time dependencies
157
-
to be reused across fvdb clean-build cycles and saves build time. [See the CPM documentation for more detail](https://github.com/cpm-cmake/CPM.cmake?tab=readme-ov-file#cpm_source_cache)
144
+
```shell
145
+
export CPM_SOURCE_CACHE=$HOME/.cache/CPM
146
+
```
147
+
148
+
If this is not set, CMake Package Manager (CPM) will cache in the fVDB build directory. Keeping the cache outside of the build directory allows build-time dependencies
149
+
to be reused across fvdb clean-build cycles and saves build time. [See the CPM documentation for more detail](https://github.com/cpm-cmake/CPM.cmake?tab=readme-ov-file#cpm_source_cache)
150
+
151
+
#### Build Commands
158
152
159
153
You can either perform an install:
160
154
```shell
@@ -166,6 +160,23 @@ or if you would like to build a packaged wheel for installing in other environme
166
160
./build.sh wheel
167
161
```
168
162
163
+
The build script automatically detects the CUDA architectures to build for based on the available GPUs on the system. You can override this behavior by setting the `--cuda-arch-list` option.
164
+
165
+
```shell
166
+
./build.sh --cuda-arch-list=8.0;8.6+PTX
167
+
```
168
+
169
+
#### Build Modifiers
170
+
171
+
The build script supports the following build modifiers:
172
+
173
+
- `gtests`: Enable building the gtest C++ unit tests.
174
+
- `benchmarks`: Enable building the benchmarks.
175
+
- `editor_skip`: Skip building the nanovdb_editor dependency.
176
+
- `editor_force`: Force rebuild of the nanovdb_editor dependency.
177
+
- `debug`: Build in debug mode with full debug symbols and no optimizations.
178
+
- `strip_symbols`: Strip symbols from the build (will be ignored if debug is enabled).
179
+
- `verbose`: Enable verbose build output for pip and CMake.
169
180
170
181
### Running Tests
171
182
@@ -204,76 +215,11 @@ python -m http.server
204
215
Please see the guide [`Clangd forIntellisensein fVDB`](docs/markdown/clangd.md)
205
216
206
217
207
-
## Usage Examples
208
-
The [examples](examples) directory contains a number of useful illustrations using the `fvdb` Python package. The sections below show some notable examples and their outputs. Run all commands from the directory containing this README.
209
-
210
-
### Trilinear sampling of grids
211
-
```
212
-
python examples/sample_trilinear.py
213
-
```
214
-
This script generates a grid with scalars at the corners of each voxel and samples this grid at points. The visualization below shows the points colored according to their sampled values as well as the values at grid corners.
<figcaptionstyle="text-align: center; font-style: italic;">Splat the normals at the blue points into the center of each grid cell. The green arrows are the splatted normals</figcaption>
229
-
</p>
230
-
231
-
232
-
### Tracing voxels along rays (hierarchical DDA)
233
-
```
234
-
python examples/ray_voxel_marching.py
235
-
```
236
-
This script demonstrates finding the first `N` voxels which lie along a ray (returning thier index as well as their entry and exit points).
237
-
<palign="center">
238
-
<img src="docs/imgs/readme/rayvox.png" style="width: 70%;"alt="fVDB ray voxel marching">
239
-
<figcaptionstyle="text-align: center; font-style: italic;">Find the voxels (yellow) which intersect the pink rays eminating from the green dot.</figcaption>
240
-
</p>
241
-
242
-
243
-
### Tracing contiguous segments along rays
244
-
```
245
-
python examples/ray_segment_marching.py
246
-
```
247
-
This script demonstrates finding the first `N` continuous segments of voxels which lie along a ray (returning thier index as well as their entry and exit points).
248
-
<palign="center">
249
-
<img src="docs/imgs/readme/rayseg.png" style="width: 70%;"alt="fVDB ray voxel marching">
250
-
<figcaptionstyle="text-align: center; font-style: italic;">Find the contiguous segments of voxels (red and blue lines) which intersect the cyan rays eminating from the pink dot.</figcaption>
251
-
</p>
252
-
253
-
254
-
### Backpropagating through sampling and splatting
255
-
```
256
-
python examples/overfit_sdf.py
257
-
```
258
-
This scripts fits SDF values at a grid corner to the SDF of a mesh using gradient descent.
<figcaptionstyle="text-align: center; font-style: italic;">SDF values at grid corners (colored dots) fitted using gradient descent to the SDF of a mesh.</figcaption>
262
-
</p>
263
-
264
-
The following scripts also show how to bakcprop through splatting and sampling with fVDB:
265
-
```
266
-
python scripts/debug_grad_trilerp.py
267
-
```
268
-
```
269
-
python scripts/debug_grad_splat.py
270
-
```
271
-
272
218
## Code Structure
273
219
The main source code forfVDB livesin the [src](src) directory. There are several important files here:
274
220
*`src/python/Bindings.cpp` exposes functionality directly to Python. It is mainly a wrapper around the core classes such as `fvdb::GridBatch` and `fvdb::JaggedTensor`.
275
-
*`src/GridBatch.h` contains the implementation of `fvdb::GridBatch` which is the core data structure on which fVDB is built. A `GridBatch` acts as a map between `(i, j, k)`integer coordinates and offsets in linear memory. This mapping can be used to perform a host of operations. The methods in this class are mostly lightweight wrappers around a set of CPU and CUDA *kernels*. The function prototypes for these kernels are defined in `src/detail/ops/Ops.h`.
276
-
*`src/detail/ops/Ops.h` contains the function prototypes for the main kernels used by fVDB. Host and device kernel implementations are provided in the `src/detail/ops/*.cu` source files.
221
+
*`src/GridBatch.h` contains the implementation of `fvdb::GridBatch` which is the core data structure on which fVDB is built. A `GridBatch` acts as a map between `(i, j, k)`voxel coordinates and offsets in linear memory. This mapping can be used to perform a host of operations. The methods in this class are mostly lightweight wrappers around a set of CPU and CUDA *kernels*. The functionprototypesforthese kernels are definedin`src/detail/ops/*.h`.
222
+
*`src/detail/ops/*.h` contains the functionprototypesforthe main kernels used by fVDB. Host and device kernel implementations are providedin the `src/detail/ops/*.cu`source files.
277
223
*`src/detail/autograd` contains C++ implementations of PyTorch autograd functions fordifferentiable operations. `#include <detail/autograd/Autograd.h>` includes all of the functionsin this directory.
278
224
*`src/detail/utils/nanovdb` contains a number of utilities which make it easier to use NanoVDB.
279
225
@@ -303,3 +249,5 @@ Please consider citing this when using *f*VDB in a project. You can use the cita
303
249
```
304
250
305
251
## Contact
252
+
253
+
For questions or feedback, plesae use the [GitHub Issues](https://github.com/openvdb/fvdb-core/issues) for this repository.
0 commit comments