2013-07-04 17:47:56 +00:00
|
|
|
..
|
2013-09-26 19:04:57 +00:00
|
|
|
Copyright 2013 Pixar
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
|
|
with the following modification; you may not use this file except in
|
|
|
|
compliance with the Apache License and the following modification to it:
|
|
|
|
Section 6. Trademarks. is deleted and replaced with:
|
|
|
|
|
|
|
|
6. Trademarks. This License does not grant permission to use the trade
|
|
|
|
names, trademarks, service marks, or product names of the Licensor
|
|
|
|
and its affiliates, except as required to comply with Section 4(c) of
|
|
|
|
the License and to reproduce the content of the NOTICE file.
|
|
|
|
|
|
|
|
You may obtain a copy of the Apache License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the Apache License with the above modification is
|
|
|
|
distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
KIND, either express or implied. See the Apache License for the specific
|
|
|
|
language governing permissions and limitations under the Apache License.
|
2013-07-04 17:47:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
API Overview
|
|
|
|
------------
|
|
|
|
|
|
|
|
.. contents::
|
|
|
|
:local:
|
|
|
|
:backlinks: none
|
|
|
|
|
|
|
|
|
2013-07-05 02:17:34 +00:00
|
|
|
Architecture Overview
|
|
|
|
=====================
|
|
|
|
|
2013-07-08 01:20:46 +00:00
|
|
|
Because the OpenSubdiv software is intended to run on a variete of computing
|
2013-07-05 02:17:34 +00:00
|
|
|
resources, the API architecture has to accomodate a fairly complex matrix of
|
|
|
|
interoperations. In order to achieve the requisite flexibility, the code structure
|
|
|
|
is both layered and modular.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
Opt-In Features
|
2013-07-30 02:14:19 +00:00
|
|
|
===============
|
2013-07-05 02:17:34 +00:00
|
|
|
|
2013-07-06 01:41:04 +00:00
|
|
|
One of the fundamental requirement of all our API's design patterns is the opt-in
|
|
|
|
implementation of features. Because most of the algorithms are used within the
|
|
|
|
constraints of interactive applications, we want to provide optimal code paths
|
|
|
|
wherever possible.
|
|
|
|
|
|
|
|
Therefore, client-code should always have the option to opt-out of the memory and
|
|
|
|
processing costs of any given feature that is not used.
|
2013-07-05 02:17:34 +00:00
|
|
|
|
|
|
|
----
|
|
|
|
|
|
|
|
Layers
|
2013-07-30 02:14:19 +00:00
|
|
|
======
|
2013-07-05 02:17:34 +00:00
|
|
|
|
2013-07-08 01:20:46 +00:00
|
|
|
From a top-down point of view, OpenSubdiv is comprised of 3 layers : **Hbr**,
|
|
|
|
**Far** and **Osd**.
|
2013-07-05 02:17:34 +00:00
|
|
|
|
2013-07-08 01:20:46 +00:00
|
|
|
.. image:: images/api_layers.png
|
|
|
|
|
|
|
|
The color groupings indicate inter-layer functional dependencies:
|
|
|
|
|
|
|
|
* Osd depends on Far, but not on Hbr
|
|
|
|
* Far depends on Hbr
|
|
|
|
* Hbr has no dependencies
|
|
|
|
|
|
|
|
It is therefore possible to use functionality from Hbr without introducing any
|
|
|
|
dependency on either Far or Osd.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
2013-07-05 02:17:34 +00:00
|
|
|
Representation vs. Implementation Layers
|
|
|
|
****************************************
|
|
|
|
|
|
|
|
One of the core performance goals of our subdivision algorithms is to leverage
|
|
|
|
interactive performance out of massively parallel code execution wherever
|
|
|
|
possible. In order to support a large diversity of discrete compute devices through
|
2013-07-18 16:52:31 +00:00
|
|
|
multiple dedicated SDKs, it is critical to distill the computations into the
|
|
|
|
smallest and simplest kernels possible. These can in turn be safely ported and
|
2013-07-05 02:17:34 +00:00
|
|
|
optimized for each of the hardware platforms.
|
|
|
|
|
2013-07-08 01:20:46 +00:00
|
|
|
.. image:: images/api_representations.png
|
2013-07-05 02:17:34 +00:00
|
|
|
|
|
|
|
This separation of general purpose against hardware-specific code is translated into
|
|
|
|
two types of layers : the **implementation** layer against the **representation**
|
|
|
|
layers.
|
|
|
|
|
|
|
|
----
|
|
|
|
|
2013-07-30 02:14:19 +00:00
|
|
|
Data Flows
|
|
|
|
**********
|
|
|
|
|
|
|
|
Data flows are mostly 1-directional, from top to bottom as a number of algorithms
|
|
|
|
are preparing the coarse mesh data to be refined and passing their results to
|
|
|
|
the next element in the processing chain.
|
|
|
|
|
|
|
|
.. image:: images/api_data_flow.png
|
|
|
|
:align: center
|
|
|
|
|
|
|
|
----
|
|
|
|
|
2013-07-05 02:17:34 +00:00
|
|
|
Multiple Representations
|
|
|
|
************************
|
|
|
|
|
|
|
|
The coarse mesh of a subdivision surface is represented by a collection of
|
|
|
|
components that maintain relationships to each other.
|
|
|
|
|
|
|
|
.. image:: images/api_mesh_data.png
|
|
|
|
:align: center
|
|
|
|
|
|
|
|
For instance:
|
|
|
|
- vertex to incident edge
|
|
|
|
- edge to origin and destination vertex
|
|
|
|
- face to edges
|
|
|
|
|
|
|
|
This allows authoring applications to easily access "neighboring" components
|
|
|
|
in order to make topology edits or manipulate properties of the components
|
|
|
|
themselves. The key to achieving efficient many-core processing is to reduce data
|
|
|
|
interdependencies. However, by definition, the bulk of topological mesh data is
|
2013-07-18 16:52:31 +00:00
|
|
|
the very description of these connections (dependencies) between vertices.
|
2013-07-05 02:17:34 +00:00
|
|
|
|
|
|
|
.. image:: images/api_serialized_data.png
|
|
|
|
:align: center
|
|
|
|
|
|
|
|
This is why OpenSubdiv provides specific representations for mesh data:
|
|
|
|
- Hbr is a half-edge relational representation
|
|
|
|
- Far is a serialized representation
|
|
|
|
|
2013-07-18 16:52:31 +00:00
|
|
|
A typical workflow would be to manipulate the topology in authoring applications,
|
|
|
|
maybe using Hbr meshes for common editing operations. Once the topology of the mesh
|
|
|
|
has stabilized, it is processed into a serialized form that can then be evaluated
|
|
|
|
at interactive framerates. The serialized form is embodied by Far, which can then
|
|
|
|
be migrated by the device-specific functions in Osd.
|
|
|
|
|
|
|
|
.. image:: images/api_workflows.png
|
|
|
|
:align: center
|
2013-07-04 17:47:56 +00:00
|
|
|
|
|
|
|
----
|
|
|
|
|
2013-07-30 02:14:19 +00:00
|
|
|
Feature Adaptive Subdivision
|
|
|
|
============================
|
2013-07-04 17:47:56 +00:00
|
|
|
|
2013-07-30 02:14:19 +00:00
|
|
|
Because of the high-performance apsects, one of the main goals of the OpenSubdiv
|
|
|
|
set of APIs is to compartmentalize subdivision rules from interpolation
|
|
|
|
computations, which can then be dispatched to discrete compute devices, including
|
|
|
|
a variety of GPUs.
|
2013-07-04 17:47:56 +00:00
|
|
|
|
2013-07-30 02:14:19 +00:00
|
|
|
The data paths for the feature adaptive algorithm layered over the OpenSubdiv
|
|
|
|
architecture:
|
2013-07-04 17:47:56 +00:00
|
|
|
|
2013-07-30 02:14:19 +00:00
|
|
|
.. image:: images/osd_layers.png
|
2013-07-04 17:47:56 +00:00
|
|
|
|
2013-07-30 02:14:19 +00:00
|
|
|
Hbr serves both as an advanced topological description and the custodian of the
|
|
|
|
Catmull-Clark (and Loop) subdivision rules. Far is then used to leverage these
|
|
|
|
rules in order to produce serialized topological tables.
|
2013-07-04 17:47:56 +00:00
|
|
|
|
2013-07-30 02:14:19 +00:00
|
|
|
The remaining computations have been reduced to extremely simple forms of
|
|
|
|
interpolation, which can be dispatched to a variety of discrete computation
|
|
|
|
platforms.
|