Game Development Reference
In-Depth Information
When a cache file is opened, the bootstrap is read to check for compatibility. Then using the header offset, the
whole metadata array is read and transformed into a hash map. Chunks are read only on demand.
During the write process, chunks are immediately written to the disk, next to the last chunks of the cache, but
metadata is kept in RAM. Metadata is stored only when all of the chunks have been written, and then the bootstrap
section is updated with the header offset.
I/O Framework
On top of the low-level general-purpose cache format, we built a whole I/O framework capable of storing a full Maya
scene in a cache file and streaming data from the cache to memory on demand.
We define an object as an independent component in a 3D scene such as a mesh, a group of hairs, or a particle
system. Objects are split into several chunks referenced by a tag nomenclature. Atomicity is important for optimizing
memory occupation depending on the use case; therefore a chunk contains only a small indivisible part of an object.
The serialization and deserialization routines allow us to store and reconstruct any set of baked objects from the
cache.
The basic I/O procedures can be used to access geometry directly, but for reading complete sets and shots,
it is important to enforce strict memory occupation constraints. The framework contains a streaming component
in charge of loading complete objects on demand and discarding the least recently used objects when memory
occupation is too high.
Software Plug-ins
Our cache system is tightly integrated into most of the software packages used in production. The system is flexible
enough so that the same cache file can be used for various use cases.
Cache Export
In our production pipeline, Autodesk Maya was used to produce final models and animations; therefore the cache
export module was implemented as a Maya plug-in.
Any arbitrary scene hierarchy, or sub-part of a hierarchy, can be baked into a single cache file. We currently
support mesh, nurbs, locators, particles, and fur geometry exported from the commercial software Joe Alter Shave
and a Haircut. Objects are exported over an arbitrary number of frames into the same cache file. Static attributes, such
as mesh topology, and UV coordinates are stored once. Potentially animated attributes such as transform matrices,
deformed mesh vertex positions, and normals are stored for each frame.
As previously stated, objects are divided into numerous chunks. For example, the vertices of a mesh at a given
frame n are stored in a separate chunk from those for topology, or normals, or UV coordinates. We also store bounding
boxes and transforms separately.
Cache Preview
The cache preview offers real-time rendering of the geometry directly in the viewport and plays complex shots
interactively. In this mode, the software has no knowledge of the geometry as it is exposed only as OpenGL proxies.
Rendering is performed entirely in the plug-in and takes advantage of the streaming framework to load only what is
needed to render. Whereas in this mode editing the geometry is impossible, it is faster to load, render, and play than
classic Maya geometry and has a minimal memory footprint. Moreover, the on-demand nature of the frameworks
enables us to expose only bounding boxes, or points (see Figure 5-3 ) to further reduce memory occupation on multi-
gigabyte sets (see Figure 5-4 ). The preview mode is also available in The Foundry Nuke where it can be tremendously
useful during compositing.
 
Search WWH ::




Custom Search