.nvdb and .wvdb

Two formats, two jobs. Which one to ship, and how to go between them.

Both are supported by @pmndrs/vdb/tools, for different jobs (D14). The full-resolution vs 128³ demo splits one volume between the two, with GPU bytes, file size and error per side.

.nvdb.wvdb
WhatNanoVDB's file format: grid images in a small containermjurczyk's WebVDB delivery format (spec v0.5)
DataSparse tree at full resolution; Float, Fp4, Fp8, Fp16, FpN, HalfDense bricks at several LODs, resampled to a target resolution (8-bit texels in the dense renderer source)
Read on the GPUDirectly: the file's grid image is what the pool holds, byte for byteAfter a conversion to 3D textures (dense source) or to a NanoVDB grid (sparse source)
ReadNvdbFile, readNvdbStreamreadWvdb, WvdbStreamReader
WritewriteNvdbwriteWvdb, vdbToWvdb, nvdbToWvdb, bakeWvdb
Progressive loadingvdbBakeCoarseFirst: one file, [<name>.lod48, <name>]Native: LODs are stored coarsest first, and byte ranges per LOD
SizeMeasured: at equal resolution, FpN is 474 KiB on the smoke sample790 KiB on the same sample

Which to use

  • Use .nvdb for the data you render. It is the exact format: nothing is resampled, and the GPU reads the bytes you wrote. It is the format of VDBGridPool, VDBVolumeMaterial and the sparse source.
  • Use .wvdb when you already have it, or when you want his delivery path: it has coarse-first streaming and an existing user base. The dense frame-renderer source reads it.
  • From a .vdb, go to .nvdb with buildFromVdb (then quantize to shrink it), or to .wvdb with vdbToWvdb.

Between them

  • .wvdb to .nvdb: wvdbDenseToNvdb(wvdbDenseVolume(file)) converts a LOD voxel for voxel into a Float grid (texel k becomes k / 255, zero texels inactive), each axis with its own voxel size (a bake rounds each side's texel count on its own), so the grid sits where the .wvdb box puts it. It also returns sparseSourceOptions (the texture index box, the dense stats and the box), to spread into the vdbSparseSource options so the sparse copy lines up with the dense source.
  • .nvdb to .wvdb: nvdbToWvdb(image, options). It samples over the bbox, point-sampled by default like his CLI (D27); pass sampling: 'box' for sources much finer than the texel grid.

Provenance

.wvdb reading, writing and baking are ported from mjurczyk/openvdb (MIT), pinned at 75e7345 (v0.26.0). Where the code departs from his, the divergence is recorded in DIVERGES.md.