Instanced Tessellation Sample


Category:  Performance   Visuals
Min PC GPU: Fermi-based (GTX 4xx)
Min Tegra Device: Tegra 4

Description

This sample demonstrates how instancing can be used to efficiently tessellate objects in real-time.

APIs Used

Shared User Interface

The OpenGL samples all share a common app framework and certain user interface elements, centered around the "Tweakbar" panel on the left side of the screen, which lets you interactively control certain variables in each sample.

To show and hide the Tweakbar, simply click or touch the triangular button positioned in the top-left of the view.

Other controls are listed below:

Device Input Result
touch 1-Finger Drag Orbit-rotate the camera
2-Finger Drag Move up/down/left/right
2-Finger Pinch Scale the view
mouse Left-Button Drag Orbit-rotate the camera
Right-Button Drag Move up/down/left/right
Middle-Click Drag Scale the view (up:out, down:in)
keyboard Escape Quit the application
  Tab Toggle Tweakbar visibility
gamepad Start Toggle Tweakbar visibility
  Right Thumbstick Orbit-rotate the camera
  Left Thumbstick Move forward/backward. Slide left/right
  Left/Right Triggers Move up/down

Technical Details

This sample demonstrates how instancing can be used to efficiently tessellate objects in real-time.

The basic idea behind instanced tessellation through instancing is this:

  1. Create a vertex buffer object that contains a barycentric tessellation of a generic triangle.

  2. Use instancing to draw an instance of this generic tessellation for every triangle of the object to be tessellated. For every instance the instance data will be the three 3D vertices and other vertex attributes of one of the current object-triangle be tessellated.

  3. Inside a vertex program use the per instance data to evaluate whatever function using the additional per vertex barycentric coordinates.

Instancing Modes

There are two different modes of instancing demonstrated:

  1. Software Instancing

    One draw call is made for each triangle of the object. The per-instance data is passed as uniforms.

  2. Hardware Instancing

    One draw call is made to tessellate the whole object. Per-instance data comes in as vertex attributes using glDrawElementsInstanced(), glEnableVertexAttribArray(), glVertexAttribPointer(), and glVertexAttribDivisor().

    If the standard functions are not available glVertexAttribDivisorARB/NV or glDrawElementsInstancedARB/NV are used.

Future Work

Two potential areas of future work/demonstration of this approach include:

See Also


NVIDIA® GameWorks™ Documentation Rev. 1.0.200601 ©2014-2020. NVIDIA Corporation. All Rights Reserved.