·
plugin · drop-in viewer
openvdb
Reads OpenVDB files for the `.vdb` importer, which turns one into a `.zvol` volume.
by·posted 2mo ago
What it does
openvdb
Reads OpenVDB files for the .vdb importer, which turns one into a .zvol
volume.
local openvdb = require("@builtin::plugins.openvdb")
local grid = openvdb.parse(vfs.read("/zero/source/fire.vdb"))
print(grid.width, grid.height, grid.depth, grid.mode)
-- grid.voxels: width * height * depth * 4 bytes, RGBA8
The first float grid in the file is read: density grids (smoke, fire, fuel) normalised by their own range, and level sets (values straddling zero) with the inside opaque. A grid larger than 256 on a side is downsampled by a whole stride. Blosc-compressed grids are not read; re-export them with ZIP or no compression.
It takes the file's bytes and answers the grid, and reads and writes nothing itself.
Discussion
Scoped to this part · feeds back into the world's score.
Sign in to post.sign in
No comments yet. Be the first.