Code Monkey home page Code Monkey logo

vdb-rs's Introduction

โ˜๏ธ vdb-rs

Actions Status Latest version Documentation Lines of code MIT Contributor Covenant

Banner

This crate provides a rust native implementation of the VDB file format, following the original OpenVDB implementation.

Usage

Add this to your Cargo.toml:

[dependencies]
vdb-rs = "0.6.0"

This crate currently only supports VDB reading and parsing of a relatively large section of the VDB test assets, while it currently only supports reading the data an nothing more, the longer term goal for this is to reach feature parity with the C++ OpenVDB crate. Implementation of features however is use-case limited, so contributions in areas that are missing are welcome.

Known missing features

  1. Multi-pass I/O (PointDataGrid)
  2. VDB Writing
  3. Older OpenVDB versions
  4. DDA tracing (with example)
  5. Delay loading

Broken files

These are test files from the OpenVDB website; https://www.openvdb.org/download/. Most file seem to be loading correctly and displaying correctly in the bevy example that's provided with this library.

The only failing files are the ones containing a "points" grid. They all fail on ParseError::InvalidNodeMetadata which seem to be related to the lack of Multi-Pass I/O, though most need to be investigated.

  • "boat_points.vdb-1.0.0/boat_points.vdb" ("speedboat" grid loads correctly)
  • "bunny_points.vdb-1.0.0/bunny_points.vdb"
  • "sphere_points.vdb-1.0.0/sphere_points.vdb"
  • "waterfall_points.vdb-1.0.0/waterfall_points.vdb"

vdb-rs's People

Contributors

dependabot[bot] avatar emiliolaiso avatar jasper-bekkers avatar marijns95 avatar rosaliedewinther avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

yorickdejong

vdb-rs's Issues

Allocation failure on parsing of BLOSC compressed VDB data

The uncompressed and zip code paths are correctly loading, the BLOSC code path results in what looks like wrong data loading / interpretation.

let num_compressed_bytes = reader.read_i64::<LittleEndian>()?;
[src\reader.rs:141] num_compressed_bytes = -1143914305352105984

Example assets:
Uncompressed: fire from https://www.openvdb.org/download/ โœ…
Zip: bunny_cloud from https://www.openvdb.org/download/ โœ…
BLOSC: Tornado Looping from https://jangafx.com/software/embergen/download/free-vdb-animations/ โŒ

compressed_count = 0 causes panic

Hi,

I tried to run the bevy example in the library. I'm using macOS 13.3 and ran the following command:

cargo run --example bevy ~/Downloads/TornadoLoopingVDB/TornadoLooping/TornadoVDB/tornado_0000.vdb

This produces the following error:

thread 'Compute Task Pool (5)' panicked at /Users/yorickdejong/vdb-rs/src/reader.rs:240:17:
assertion `left == right` failed
 left: 0
right: 30
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Encountered a panic in system `bevy::setup`!
Encountered a panic in system `bevy_app::main_schedule::Main::run_main`!

It seems that the compressed count is 0, instead of 30:

    fn read_compressed_data<T: Pod>(
       reader: &mut R,
       _archive: &ArchiveHeader,
       gd: &GridDescriptor,
       count: usize,
   ) -> Result<Vec<T>, ParseError> {
       Ok(if gd.compression.contains(Compression::BLOSC) {
           let num_compressed_bytes = reader.read_i64::<LittleEndian>()?;
           let compressed_count = num_compressed_bytes / std::mem::size_of::<T>() as i64;

           trace!("Reading blosc data, {} bytes", num_compressed_bytes);
           if num_compressed_bytes <= 0 {
               let mut data = vec![T::zeroed(); (-compressed_count) as usize];
               reader.read_exact(cast_slice_mut(&mut data))?;
               assert_eq!(-compressed_count as usize, count);
               data

The vdb file can be downloaded from this link (it's the tornado): https://jangafx.com/software/embergen/download/free-vdb-animations/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.