Skip to content

Commit 26abaef

Browse files
authored
Large README update (openvdb#299)
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>
1 parent 37a8858 commit 26abaef

File tree

1 file changed

+61
-113
lines changed

1 file changed

+61
-113
lines changed

README.md

Lines changed: 61 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,44 @@
11
# *ƒ*(VDB)
22

3+
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.
37

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).
58

69
<p align="center">
7-
<img src="docs/imgs/fvdb_teaser.png" style="width: 40%;"alt="fVDB Teaser">
8-
<!-- <img src="docs/imgs/readme/av_screenshot.png" style="width: 100%;"alt="fVDB Teaser"> -->
9-
<figcaption style="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>
10+
<img src="docs/imgs/fvdb_teaser.jpg" style="width: 90%;"alt="fVDB Teaser">
1011
</p>
1112

12-
*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.
1313

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.
2614

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.
2819

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.
3021

31-
fVDB is currently supported on the matrix of dependencies in the following table.
32-
33-
| OS | PyTorch | Python | CUDA |
34-
| ---------- | ----------- | ----------- | ----------- |
35-
| Linux Only | 2.8.0-2.9.0 | 3.10 - 3.13 | 12.8 - 13.0 |
22+
## Learning to Use *f*VDB
3623

37-
#### Hardware
24+
After [installing *f*VDB](#installing-fvdb), we recommend starting with our [documentation](https://fvdb.ai/).
3825

39-
A CUDA-capable GPU with Ampere architecture or newer (i.e. compute capability >=8.0) is recommended
40-
to run the CUDA-accelerated operations in ƒVDB. A GPU with compute capabililty >=7.0 (Volta) is the
41-
minimum requirement but some operations and data types are not supported.
26+
Beyond the [documentation](https://fvdb.ai/), the walk-through [notebooks](notebooks) in this repository
27+
can provide an illustrated introduction to the main concepts in *f*VDB.
4228

43-
### Package Installation with pip
4429

45-
Currently, pip wheels are built with PyTorch 2.8.0 and CUDA 12.9 only. Versions for Python 3.10-3.13
46-
are provided.
30+
## Installing *f*VDB
4731

48-
Install fvdb_core using the following pip command.
32+
The `fvdb-core` Python package can be installed either using published packages with pip or built
33+
from source.
4934

50-
```
51-
pip install fvdb_core==0.3.0+pt28.cu129 --extra-index-url="https://d36m13axqqhiit.cloudfront.net/simple" torch==2.8.0 --extra-index-url https://download.pytorch.org/whl/cu129
52-
```
35+
For the most up-to-date information on installing *f*VDB's pip packages, please see the
36+
[installation documentation](https://fvdb.ai/installation.html).
5337

5438
## Building *f*VDB from Source
5539

40+
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+
5642
### Environment Management
5743

5844
ƒ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
11096

11197
Our provided [`Dockerfile`](Dockerfile) constructs a container that pre-installs the dependencies needed to build and run ƒVDB.
11298

113-
In the fvdb-core directory, build the Docker image:
99+
1. In the fvdb-core directory, build the Docker image:
114100
```shell
115101
docker build -t fvdb-devel .
116102
```
117103

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.
119105
```shell
120106
docker run -it --mount type=bind,src="$(pwd)",target=/workspace fvdb-devel bash
121107
cd /workspace;
@@ -130,31 +116,39 @@ In order to extract an artifact from the container such as the Python wheel, que
130116

131117
#### **OPTION 3** Python Virtual Environment
132118

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.
134122

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:
136124

137125
```shell
138126
python -m venv fvdb
139127
source fvdb/bin/activate
140128
pip install -r env/build_requirements.txt
141129
TORCH_CUDA_ARCH_LIST="7.5;8.0;9.0;10.0;12.0+PTX" ./build.sh install -v
142130
```
131+
143132
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+
144134
---
145135

146136
### Building *f*VDB
147137

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
149139

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.
151141

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`)
155143

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
158152

159153
You can either perform an install:
160154
```shell
@@ -166,6 +160,23 @@ or if you would like to build a packaged wheel for installing in other environme
166160
./build.sh wheel
167161
```
168162

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.
169180

170181
### Running Tests
171182

@@ -204,76 +215,11 @@ python -m http.server
204215
Please see the guide [`Clangd for Intellisense in fVDB`](docs/markdown/clangd.md)
205216
206217
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.
215-
<p align="center">
216-
<img src="docs/imgs/readme/trilerp.png" style="width: 40%;"alt="fVDB trilinear interpolation demo">
217-
<figcaption style="text-align: center; font-style: italic;">Trilinearly interpolate the corner values at the points.</figcaption>
218-
</p>
219-
220-
221-
### Trilinear splatting into grids
222-
```
223-
python examples/splat_trilinear.py
224-
```
225-
This script splats normals of a point cloud onto grid centers. The green arrows represent the values of the normals splatted onto each grid center
226-
<p align="center">
227-
<img src="docs/imgs/readme/splat.png" style="width: 40%;"alt="fVDB trilinear splatting demo">
228-
<figcaption style="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-
<p align="center">
238-
<img src="docs/imgs/readme/rayvox.png" style="width: 70%;"alt="fVDB ray voxel marching">
239-
<figcaption style="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-
<p align="center">
249-
<img src="docs/imgs/readme/rayseg.png" style="width: 70%;"alt="fVDB ray voxel marching">
250-
<figcaption style="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.
259-
<p align="center">
260-
<img src="docs/imgs/readme/fitsdf.png" style="width: 70%;"alt="fVDB SDF fitting">
261-
<figcaption style="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-
272218
## Code Structure
273219
The main source code for fVDB lives in the [src](src) directory. There are several important files here:
274220
* `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 function prototypes for these kernels are defined in `src/detail/ops/*.h`.
222+
* `src/detail/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.
277223
* `src/detail/autograd` contains C++ implementations of PyTorch autograd functions for differentiable operations. `#include <detail/autograd/Autograd.h>` includes all of the functions in this directory.
278224
* `src/detail/utils/nanovdb` contains a number of utilities which make it easier to use NanoVDB.
279225
@@ -303,3 +249,5 @@ Please consider citing this when using *f*VDB in a project. You can use the cita
303249
```
304250
305251
## 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

Comments
 (0)