# Tutorials

- Far Tutorials
  - 1. Basic Construction and Interpolation
    - Tutorial 1.1
    - Tutorial 1.2
  - 2. Uniform Refinement and Primvar Data Types
    - Tutorial 2.1
    - Tutorial 2.2
    - Tutorial 2.3
  - 3. Creating a Custom Far::TopologyRefinerFactory
    - Tutorial 3.1
  - 4. Construction and Usage of Far::StencilTables
    - Tutorial 4.1
    - Tutorial 4.2
    - Tutorial 4.3
  - 5. Construction and Usage of Far::PatchTables
    - Tutorial 5.1
    - Tutorial 5.2
    - Tutorial 5.3
- Osd Tutorials
  - Tutorial 0
- Hbr Tutorials
  - Tutorial 0
  - Tutorial 1
  - Tutorial 2

The tutorial source code can be found in the github.com repository or in your local `<repository root>/tutorials`.

### Far Tutorials

#### 1. Basic Construction and Interpolation

##### Tutorial 1.1

> This tutorial presents the requisite steps to instantiate a mesh as a Far::TopologyRefiner from simple topological data and to interpolate vertex data associated with the mesh. [code]

##### Tutorial 1.2

> This tutorial makes use of a different vertex data definition for use when vertex data is of arbitrary width. Uniform refinement is applied to data buffers of three types: two of fixed but different sizes and the third a union of the two that is dynamically sized and constructed. [code]

#### 2. Uniform Refinement and Primvar Data Types

##### Tutorial 2.1

> Building on the basic tutorial, this example shows how to instantiate a simple mesh, refine it uniformly and then interpolate both 'vertex' and 'varying' primvar data. [code]

##### Tutorial 2.2

> Building on the previous tutorial, this example shows how to instantiate a simple mesh, refine it uniformly and then interpolate both 'vertex' and 'face-varying' primvar data. The resulting interpolated data is output in Obj format, with the 'face-varying' data recorded in the UV texture layout. [code]

##### Tutorial 2.3

> Building on previous tutorials, this example shows how to instantiate a simple mesh, refine it uniformly, interpolate both 'vertex' and 'face-varying' primvar data, and finally calculate approximated smooth normals. The resulting interpolated data is output in Obj format. [code]

#### 3. Creating a Custom Far::TopologyRefinerFactory

##### Tutorial 3.1

> Previous tutorials have instantiated topology from a simple face-vertex list via the Far::TopologyDescriptor and its TopologyRefinerFactory. This tutorial shows how to more efficiently convert an existing high-level topology representation to a Far::TopologyDescriptor with a custom factory class. [code]

#### 4. Construction and Usage of Far::StencilTables

##### Tutorial 4.1

> This tutorial shows how to create and manipulate a StencilTable. Factorized stencils are used to efficiently interpolate vertex primvar data buffers. [code]

##### Tutorial 4.2

> This tutorial shows how to create and manipulate StencilTables for both 'vertex' and 'varying' primvar data buffers: vertex positions and varying colors. [code]

##### Tutorial 4.3

> This tutorial shows how to create and manipulate tables of cascading stencils to apply hierarchical vertex edits. [code]

#### 5. Construction and Usage of Far::PatchTables

##### Tutorial 5.1

> This tutorial shows how to compute points on the limit surface at arbitrary parametric locations using a Far::PatchTable constructed from adaptive refinement. [code]

##### Tutorial 5.2

> Building on the previous tutorial, this example shows how to manage the limit surface of a potentially large mesh by creating and evaluating separate PatchTables for selected groups of faces of the mesh. [code]

##### Tutorial 5.3

> Building on the previous tutorials for both PatchTables and StencilTables, this example shows how to construct a LimitStencilTable to repeatedly evaluate an arbitrary collection of points on the limit surface. [code]

### Osd Tutorials

#### Tutorial 0

> This tutorial demonstrates the manipulation of Osd Evaluator and BufferDescriptor. [code]

### Hbr Tutorials

Use of Hbr is no longer recommended -- these tutorials are included solely for historical reference.

#### Tutorial 0

> This tutorial presents, in a very succinct way, the requisite steps to instantiate an Hbr mesh from simple topological data. [code]

#### Tutorial 1

> This tutorial shows how to safely create Hbr meshes from arbitrary topology. Because Hbr is a half-edge data structure, it cannot represent non-manifold topology. Ensuring that the geometry used is manifold is a requirement to use Hbr safely. This tutorial presents some simple tests to detect inappropriate topology. [code]

#### Tutorial 2

> This tutorial shows how to subdivide uniformly a simple Hbr mesh. We are building upon previous tutorials and assuming a fully instantiated mesh: we start with an HbrMesh pointer initialized from the same pyramid shape used in hbr_tutorial_0. We then apply the Refine() function sequentially to all the faces in the mesh to generate several levels of uniform subdivision. The resulting data is then dumped to the terminal in Wavefront OBJ format for inspection. [code]