「利用者:Kevindietrich/AlembicBasicIo」の版間の差分

提供: wiki
移動先: 案内検索
(Import)
 
(1版 をインポートしました)
 
(相違点なし)

2018年6月29日 (金) 06:16時点における最新版

Alembic Basic IO

Abstract

The project aims at porting the Alembic import/export patch from Dwarf Labs and Esteban Tovagliari to a state that fits the current Blender paradigms. Only basic functionalities are included in the patch. Some more features can be added, but is secondary goal, and can be achieved anytime (before or after a merge in master branch).

Simply put:

What this project is about

Implementation of operators to import and export Alembic data from/to Blender for use in a production pipeline alongside other software. In addition, data streaming of imported objects can be supported where applicable through modifiers and constraints. Imported and streamed objects shall remain on a read-only state.

What this project is not about
  • Caching Blender specific data for Blender specific usage.
  • Scene level integration of Alembic as the de facto Blender specific data caching system.

What this entails, for example, is the following: if a Blender hair simulation is exported through the export operator to Alembic, if/when the file is imported back through the import operator, no Blender hair system will be created. Similarly for any application specific data like particles, subdivision sufaces (modifiers), materials, lights, ...

Import and Export operators


Those operators are found respectively in the File -> Import and in the File -> Export menu.

Import

Alembic Import Options

This reads an Alembic archive and creates objects in the current Blender scene. The object hierarchy is also set based on the hierarchy present in the file.

  • Supported object types:
    • Cameras
    • Curves
    • Empties (including Maya locators and the likes)
    • Meshes
    • Points (read as a Mesh object with only vertices)

The importer automatically adds a cache modifier and/or cache constraint (see below) to the imported objects if the "Is Sequence" option is checked or either the data, the parent transform or both are not constant in the Alembic archive.


Export

Alembic Export Options

This creates an Alembic archive based on the active scene.

  • Supported object and data types:
    • Camera
    • Curve
    • Hair
    • Mesh
    • NURBS
    • Particles


Data streaming

Cache File Data-Block

Since Alembic archives might be referenced by multiple modifiers and constraints at once, and in order to simplify keeping each and every of these potential cache file users in synchronisation, a new data-block, CacheFile, was added. This data-block stores various properties related to cache files. Although it is added during this project, this data-block shall remain separate from any Alembic specific properties, with some possible future exceptions ; the reason being that other file (cache) formats, such as OpenVDB, might be used in the feature in a similar fashion as the Alembic caches.

This data-block is made available through the new "Mesh Sequence Cache" modifier and the new "Transform Cache" constraint (see below). It supports animations (keyframes, drivers...), and is hooked to the dependency graph, such that objects which depend on it are updated when necessary.

The cache file properties are (see the "Mesh Sequence Cache" UI or the "Transform Cache" UI):

  • Is Sequence: defines whether or not the cache is split into a sequence of files.
  • Override Frame: defines whether to choose a custom frame to lookup the data inside the cache (by default the current scene frame is used)
  • Frame: the frame used to lookup the data
  • Scale: value to shrink or enlarge objects with respect to the world's origin. This is only applicable through a "Transform Cache" constraint.

A refresh operator (next to the "File Path" property) is available, to reload the file pointed to by the data block, and to recreate the object path list that is used to select the object in the cache constraint and cache modifier.

Data Animation

Mesh Sequence Cache UI

Data animations are supported by a new modifier, "Mesh Sequence Cache", similar to the "Mesh Cache" modifier. Despite its name, this modifier supports meshes and curves. It also handles file sequences, as well as meshes and curves with varying number of vertices/control points.

The modifiers properties are:

  • Object Path: the path to the Alembic object inside the archive
  • Verts/Faces/UV/Color: the type of data to read for a mesh object respectively: vertices, polygons, UV layers and Vertex Color layers.


Transform Animation

Transform Cache UI

To be able to stream animations made at the transformation matrix level (for example rigid bodies, or camera movements), a new constraint, "Transform Cache", was added. It is similar in usage as the mesh cache modifier, just operates on a different type of data. The scale property only affects the object through this constraint.


Compiling Alembic (Linux)


First off, we need the dependencies: Alembic requires ILMBase and Boost (or C++11). If the reader already compiles Blender then Boost and ILMBase should already be built and installed on their system.

Alembic

The officially supported of Alembic is 1.6.0 and can be downloaded from https://codeload.github.com/alembic/alembic/tar.gz/1.6.0

Firstly create a build directory, can be in-source:

cd path/to/alembic-1.6
mkdir build
cd build

Then let's setup CMake:

cmake \
	-DUSE_HDF5=OFF \
	-DUSE_MAYA=OFF \
	-DUSE_BINARIES=OFF \
	-DALEMBIC_SHARED_LIBS=OFF \
	-DALEMBIC_LIB_USES_BOOST=ON \
	-DBOOST_ROOT=/opt/lib/boost \
	-DILMBASE_ROOT=/opt/lib/openexr \
	-DCMAKE_INSTALL_PREFIX=/opt/lib/alembic \
	..

Finally, build and install the library:

make -j8 && make -j8 install
HDF5

HDF5 support in Alembic is legacy, prone to bugs and crashes, and is not officially supported by Blender. If you wish to still compile with HDF5 support, here is how it can be done for a stable build.

The supported verion of HDF5 is 1.8 (patch version 16 or above), and its source code can be obtained from https://www.hdfgroup.org/HDF5/release/obtainsrc.html#src

The library should be configured using the following command line:

./configure --prefix=/opt/lib/hdf5-1.8.16/ --with-pic --disable-shared --enable-production --disable-debug --enable-threadsafe --with-pthread=/usr/include,/usr/lib

Then simply do the following to build and install the library:

make -j8 && make -j8 install