利用者:Kevindietrich/OpenVDBSmokeExport

提供: wiki
移動先: 案内検索

OpenVDB Smoke Cache

Abstract

This project aims at implementing the OpenVDB file format as an alternative cache format for the point cache.

Screenshots

Dev-smoke-openvdb-tree.png Dev-smoke-openvdb-cache-ui.png

Conversion to and from VDBs

Each field from the simulation domain gets converted to a sparse VDB volume. The dense arrays from the smoke simulation are dumped into an OpenVDB tree according to some threshold, which is hard-coded to 0.001 (smaller values are then considered "empty space", in most cases this threshold is well enough).

When reading a cached file, the sparse VDB volumes are converted back to a dense volume.

The following fields are written to files if they are generated (depending on the simulation settings):

  • "color"
  • "density"
  • "heat"
  • "heat old" (the temperate at the previous fame)
  • "flame"
  • "fuel"
  • "react" (reaction coordinates, used for fire)
  • "velocity"
  • "shadow"(the shadows of the volume computed for viewport rendering)
  • "texture coordinates" (used for turbulence)

If high resolution is enabled, the corresponding low resolution fields are suffixed with " low".

Compression

By default compression is set to "Active Mask", which means only consider active values (non-empty space in most cases) to be written. More specifically, the active bit masks of every node in the tree is used as the codec key for compression. This setting is not exposed to avoid UI-bloat, also it's interesting to have as a pure default.

On top of that it is possible to use Zip compression, or Blosc compression if OpenVDB was built with Blosc support. The only real difference between the two is that Blosc is multi-threaded, and therefore performs fast compression/decompression ; apart from this, file sizes should be about the same between ZIP and Blosc.

It is also possible to turn off compression altogether.

Another flag is available to write floating-point grids as half precision floating-point, which should help reducing file sizes.

Workflow with other software

Files written by Blender are legitimate .vdb files, only use the default grid types defined by the OpenVDB library, and thus can be opened by any other software which support VDB volumes. A metadata called "creator" and set to "Blender/Smoke" is written in every file to help knowing where the file comes from upon reading.

Currently, importing caches from other software is not supported, as it was deemed out of the scope of this project for it might require drastic changes to the smoke simulator itself.