Commit fb34c26
TSDF + ESDF + Occupancy + Decay + fast marching cubes
Add native CUDA kernels and Python wrappers for TSDF and ESDF
reconstruction, occupancy mapping, dynamic-scene decay, and a fast
sparse-compact marching-cubes variant. These features sit on top of
the TorchResource allocator-routing change (parent PR, which
supersedes the nanoVDB allocator-overrides approach) and share a
common `PersistentTSDFState` + `BuildPointTruncationShell` substrate.
Topology + state primitives
src/fvdb/detail/ops/BuildPointTruncationShell.{cu,h}
Shared primitive that turns `(points, base_grid, truncation_margin)`
into the set of voxels within the truncation shell. Used by both
depth and LiDAR TSDF integrators.
src/fvdb/detail/ops/PersistentTSDFState.{cu,h}
Grow-on-touch state holder for incremental integration: wraps a
monotonically-growing live grid with fixed-shape tsdf / weights /
optional feature sidecars and exposes a `grow` method that
expands the grid + sidecars atomically while preserving values
at already-live voxels.
src/python/PersistentTSDFStateBinding.cpp
Pybind11 binding for the above.
Integrators
src/fvdb/detail/ops/IntegrateTSDF.{cu,h} (modified)
Depth TSDF integrator now uses `BuildPointTruncationShell` and
`PersistentTSDFState`, and exposes a new N-frame batched entry
point `integrateTSDFBatch` that grows the union grid one frame
at a time and copy-forwards sidecars through the
persistent-state object. Bit-identical to the per-frame loop
(pinned by `test_integrate_tsdf_frames_matches_sequential`).
src/fvdb/detail/ops/IntegrateTSDFFromPoints.{cu,h}
Native LiDAR / range-sensor TSDF integrator: per-point thread
HDDA-walks the union grid and `atomicAdd`s a running-sum into
(sum_w_sdf, sum_w, sum_w_feat) accumulators within the
truncation (and optionally free-space) band. Single-frame,
with-features, and N-frames-batched variants.
src/fvdb/detail/ops/IntegrateOccupancyFromPoints.{cu,h}
LiDAR occupancy mapping with free-space carving and log-odds
updates. Single-frame and N-frames-batched variants. Same
ray-walk structure as the LiDAR TSDF integrator.
ESDF
src/fvdb/detail/ops/ComputeESDF.{cu,h}
Euclidean Signed Distance Field from an integrated narrow-band
TSDF. Composition pattern is
`dilateGrid -> esdfSeed -> N sweeps of 26-N min-propagation`,
reusing the topology-op primitives.
src/fvdb/detail/ops/DirtyMaskFromSidecars.{cu,h}
Per-voxel dirty-mask primitive that lets the incremental ESDF
variant scope work to just the voxels whose sidecars changed.
Marching cubes
src/fvdb/detail/ops/MarchingCubesFast.{cu,h}
Sparse-compact, packed-key marching cubes for fp32 / fp16 CUDA.
`marchingCubes` now dispatches to this for eligible inputs and
to `marchingCubesLegacy` (the previous default, kept verbatim)
otherwise.
src/fvdb/detail/ops/MarchingCubes.{cu,h} (modified)
Routes through to the new fast path.
Python surface
fvdb/functional/_meshing.py
Wrappers for the new N-frame + with-features + LiDAR variants
of TSDF integration, occupancy mapping (single + frames), and
ESDF (single + incremental).
fvdb/functional/_topology.py
Wrapper for `dirty_mask_from_sidecars_single`.
fvdb/grid.py
New methods on `Grid`: `decay_and_prune`,
`integrate_tsdf_frames`, `integrate_tsdf_with_features`,
`integrate_tsdf_from_points` (+ frames + with-features
variants), `integrate_occupancy_from_points` (+ frames),
`compute_esdf`, `compute_esdf_incremental`. `decay_and_prune`
is implemented entirely in Python on top of existing fvdb
sidecar + topology primitives.
fvdb/functional/__init__.py
Export the new functional names.
src/python/Bindings.cpp, src/python/GridBatchOps.cpp
Register the new C++ bindings.
Tests
tests/unit/test_persistent_tsdf_state.py
tests/unit/test_compute_esdf.py
tests/unit/test_dirty_mask.py
tests/unit/test_integrate_occupancy.py
tests/unit/test_decay_and_prune.py
tests/unit/test_basic_ops.py (extended)
Cover the new primitives, the persistent-state invariants
(`grow` semantics, sidecar carry-forward), bit-identity of the
batched-vs-sequential TSDF paths, atomic-noise tolerance for
the LiDAR/occupancy variants, and fp16-vs-fp32 numerical
agreement for the new marching-cubes fast path.
Rebase notes (feat/nanovdb-torch-resource base, Aug 2026)
Three mechanical adaptations to API drift since this commit was
written, no behavioral change:
- fvdb::HDDAVoxelIterator was renamed; the two point-cloud
integrators now use fvdb::HDDALeafVoxelIterator, the alias whose
contract matches their per-leaf-voxel sidecar indexing
(getValue(ijk) - 1).
- nanovdb's raw-pointer buildVoxelBlockManager overload was removed
in favor of a VoxelBlockManagerHandle API. ComputeESDF keeps its
firstLeafID / jumpMap arrays in torch tensors (same pool as all
other fvdb allocations) and launches the public
BuildVoxelBlockManagerFunctor directly -- the identical launch the
handle-based builder performs. The handle itself can't own
TorchDeviceBuffers yet because its accessors static_cast from
deviceData(), which TorchDeviceBuffer types as uint8_t*.
- nanovdb::tools::cuda::VoxelBlockManager is now templated on
Log2BlockWidth rather than BlockWidth; the ESDF sweep kernel
passes ESDF_BLOCK_WIDTH_LOG2.
Signed-off-by: Francis Williams <francis@fwilliams.info>
Signed-off-by: Jonathan Swartz <jonathan@jswartz.info>1 parent 2ef632b commit fb34c26
33 files changed
Lines changed: 9227 additions & 130 deletions
File tree
- fvdb
- functional
- src
- fvdb/detail/ops
- python
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | 13 | | |
59 | 14 | | |
60 | 15 | | |
| |||
73 | 28 | | |
74 | 29 | | |
75 | 30 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
94 | 37 | | |
95 | 38 | | |
96 | 39 | | |
| |||
111 | 54 | | |
112 | 55 | | |
113 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
114 | 73 | | |
115 | 74 | | |
116 | 75 | | |
| |||
145 | 104 | | |
146 | 105 | | |
147 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
148 | 128 | | |
149 | 129 | | |
150 | 130 | | |
| |||
163 | 143 | | |
164 | 144 | | |
165 | 145 | | |
| 146 | + | |
166 | 147 | | |
167 | 148 | | |
168 | 149 | | |
| |||
183 | 164 | | |
184 | 165 | | |
185 | 166 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
192 | 202 | | |
193 | 203 | | |
194 | 204 | | |
| |||
262 | 272 | | |
263 | 273 | | |
264 | 274 | | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
265 | 279 | | |
266 | 280 | | |
267 | 281 | | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
268 | 289 | | |
269 | 290 | | |
270 | 291 | | |
| |||
290 | 311 | | |
291 | 312 | | |
292 | 313 | | |
| 314 | + | |
293 | 315 | | |
294 | 316 | | |
295 | 317 | | |
| |||
0 commit comments