SGI Techpubs Library

IRIX 6.5  »  Books  »  Developer  »  
OpenGL Optimizer Programmer's Guide: An Open API for Large-Model Visualization
(document number: 007-2852-002 / published: 1998-06-09)    table of contents  |  additional info  |  download
find in page

Chapter 1. OpenGL Optimizer Overview

OpenGL Optimizer is a programmer's toolkit (API, library, and suite of tools). The toolkit makes it easier for the application developer to draw large models interactively through creative uses of culling, multi- threading, level-of-detail (LOD) rendering, and so on. Optimizer applications can render high-quality images at any scale: from individual parts, to subassemblies, to entire, complex mechanisms. This is especially useful for CAD-type applications where it is usually necessary to visualize large data sets.

OpenGL Optimizer is built on top of OpenGL. A single OpenGL Optimizer command calls several OpenGL commands. The benefit to the developer is that the OpenGL Optimizer API already knows the most efficient way to organize the data.

OpenGL Optimizer uses Cosmo 3D scene graphs to organize its data. Cosmo 3D is a scene graph API which provides multi-thread processing of scene graph data, back face culling, engines, and sensors. For more information about Cosmo3D, see the Cosmo3D Programmer's Guide.

This chapter explains how OpenGL Optimizer approaches the challenge posed by large CAD data sets in the following sections:

The Optimizer Challenge and Solution

Over the past few decades, Computer Aided Design (CAD) and other 3D modelling tools have become prominent elements of the mechanical design process. As a result, designers nowadays create components that exceed the interactive visualization capabilities of existing graphics software and hardware. This section first looks at the challenge of large data sets and explains how OpenGL Optimizer solves the problem. It then gives an overview of the OpenGL Optimizer tools you can use in your application.

The Challenge: Large Data Sets

CAD and engineering analysis data tend to be complex; it is meant to communicate engineering information, not visualization information. The data sets are quite large, particularly when the design team is interested in viewing a whole assembly instead of a few parts.

Assume that the number of pixels per triangle is, on average, ten. Then only about 100,000 triangles can appear at any instance on a 1024 x 1024 screen. High-end graphics hardware can easily render frames with this many triangles at 20 Hz, that is, at rates sufficient for continuous motions. However, a large data set may include millions of triangles, so less than one tenth of a model can be visible at any time.

The Solution: OpenGL Optimizer

Quickly finding the right set of triangles and producing rendering commands is a central processing task for a CAD application and is a central purpose of the OpenGL Optimizer library. OpenGL Optimizer provides the highest quality image possible while minimizing the amount of work required of the graphics hardware. This is accomplished, among other techniques, by organizing the data to determine what will not be seen and therefore should not be drawn (culling).

Figure 1-1 shows the interior of a model that can be manipulated with OpenGL Optimizer at interactive rates. The parts shown are those hidden by the shell of the model; when the model is viewed from outside, they are removed from the graphics pipeline by occlusion culling.

Figure 1-1. Interior Parts From a CAD Model That Can Be Manipulated Interactively Using OpenGL Optimizer (Data courtesy of SDRC)

Figure 1-1 Interior Parts From a CAD Model That Can Be Manipulated Interactively Using OpenGL Optimizer (Data courtesy of SDRC™)

To accurately represent the surfaces in the design data set requires selecting triangles that provide appropriate detail without artificial cracks. To this end, OpenGL Optimizer tools provide control over tessellation, mesh simplification, and surface connectivity information (topology).

The OpenGL Optimizer Toolset

OpenGL Optimizer is not a single tool (like a debugger). Instead, it consists of individual tools the developer can use to optimize an application. OpenGL Optimizer could be compared to a hardware store that offers the tools for building. But, just as you need to choose the proper tools for a job and apply them to the raw materials, you have to choose the proper tools for optimizing your application and then apply them appropriately.

OpenGL Optimizer tools modify an application so that it sends only essential graphical information down the graphics pipeline and so that it interacts with the scene graph efficiently using multiple processors.

To minimize the memory footprint of the scene graph, geometric objects can be represented as abstract mathematical expressions. When you want to render the objects, you can, for example, tessellate—that is, approximate them by sets of triangles. OpenGL Optimizer can also be used to perform view frustrum culling, occlusion culling, or both. In effect, more processing is being done before rendering, as OpenGL Optimizer in effect renders only what's necessary. As a result, the application needs more CPU cycles (for the preprocessing) but less space in fast memory.

The approach of the OpenGL Optimizer toolkit is to treat a scene graph as a mutable object to be manipulated and altered frequently; such calculations are essential to practical visualization of large CAD data sets.

The OpenGL Optimizer tools are usually encapsulated as C++ classes. The tools can be grouped according to what they do. This section first provides some conceptual information on the graphics pipeline, then explores how OpenGL Optimizer can help improve performance in the following subsections:

Figure 1-2 shows the relation of OpenGL Optimizer components to the operating system.

Figure 1-2. OpenGL Optimizer Architecture

Figure 1-2 OpenGL Optimizer Architecture

Optimizing the Graphics Pipeline

This section first presents the stages of the graphics pipeline, then discusses bottlenecks in the pipeline:

Pipeline Stages

The graphics pipeline consists of several stages, from host application to display on the screen:

  1. Generate and organize data to be displayed. The organizational structure for OpenGL Optimizer applications is a Cosmo3D scene-graph. If you use abstract surfaces to define objects, you must tessellate them before further processing.

    OpenGL Optimizer tools facilitate these tasks.

  2. Traverse the data and produce graphics data. For OpenGL Optimizer applications, this typically means generating OpenGL commands, often guided by considerations of occlusion and representational priority.

    OpenGL Optimizer and Cosmo3D scene graph tools share these tasks.

OpenGL tools perform the tasks in the last three stages:

  1. Transform object-description coordinates into an appropriate viewing context; for example, apply lighting effects, perform perspective transformations, and transform data into screen-space primitives (points, lines, and polygons).

  2. Rasterize screen-space primitives into a frame buffer. Perform per-vertex and per-pixel operations such as texture lookups, shading calculations, and depth testing.

  3. Display the contents of the frame buffer, typically on a monitor screen.

For further discussion of the graphics pipeline, see section 6.5, “Hardware for OpenGL,” and section 6.6, “Maximizing OpenGL Performance,” in Programming OpenGL for the X Window System. OpenGL Optimizer implements many of the tuning suggestions discussed in section 6.6. See also the OpenGL Programming Guide and OpenGL on Silicon Graphics Systems.

Bottlenecks in the Pipeline

Ideally, the graphics software uses the hardware at its full potential so that processing is not slowed by a bottleneck at any stage and data flows through the stages of the pipeline at a uniform rate. There are three types of bottlenecks:

  1. Host: Generate- and traverse-stage limits are set by the efficiency of the software and the performance of the CPU(s). Generating and organizing data for later stages in the graphics pipeline, and scene graph traversal are CPU-intensive operations.

  2. Transform: Transform-stage limits are set by the rate at which the graphics hardware (or software) can process vertices. For a single lighting source, the transform stage for one vertex takes approximately 100 floating-point operations.

  3. Fill: Rasterize-stage limits are set by the rate at which the hardware can update the frame buffer.

Machines running OpenGL Optimizer applications typically have special-purpose graphics hardware to implement the transform, rasterize, and display stages. In this manual, the term “graphics hardware” is used to refer to only the OpenGL stages of the graphics pipeline, that is, transform, rasterize, and display.

The pipeline rendering rate is always determined by the slowest stage. Tuning a stage that is not a bottleneck does not affect performance. In fact, when tuning an application, you might find that by adding processing to stages that are not rate-controlling, you can improve the quality of images without affecting the rendering rate.

The OpenGL Optimizer toolkit provides tools that typically minimize both host and transform bottlenecks. In many cases the same tool affects both a host bottleneck and transform bottleneck. Typically large CAD applications are not fill limited.

Tools to Optimize the Generate Stage

OpenGL Optimizer provides the following tools for optimizing the generate stage:

  • A powerful multiprocess control “harness,” which can be used independently of any graphics application. All aspects of OpenGL Optimizer are designed to work with this MP harness.

  • Classes to facilitate multiprocess traversals of the scene graph with arbitrary callbacks. These classes allow application speeds to scale with processor count.

  • A transaction manager that coordinates scene graph modifications by several processes, and maintains logical consistency in a complex, multiprocessor context.

  • Higher-order geometric primitives, called reps, that you can include in the scene graph. Figure 1-3 shows the set of reps included in OpenGL Optimizer. From left to right, the following reps are shown:

    Cuboid

    Cylinder

    Cone

    Sphere

    Torus

    Ruled Surface

    Swept Surface (here with a superquadric curve for cross section)

    Coons Patch

    Hermite Spline Surface

    NURBS Surface

    Figure 1-3. Higher-Order Surface Representations With Trimmed Pieces

    Figure 1-3 Higher-Order Surface Representations With Trimmed Pieces

    Higher-order surfaces are required to accurately represent CAD data. Direct support for them allows OpenGL Optimizer applications to handle large design data sets without sacrificing design integrity. Direct support for higher-order surfaces also facilitates alteration of surface shapes, as illustrated in Figure 1-4, which shows NURBS surfaces that differ by moving two control points.

    Figure 1-4. NURBS Surfaces Deformed From One Another by Moving Two Control Points

    Figure 1-4 NURBS Surfaces Deformed From One Another by Moving Two Control Points

  • Tessellators for rendering higher-order geometric primitives. A tessellator in OpenGL Optimizer is an independent object, not derived from a rep, that is applied to a rep to produce a renderable object. The separation of tessellators from reps allows your application to tessellate reps, and avoid storing large, renderable objects. You can also apply one of several tessellators to a given rep, depending on your need, or apply one tessellator to a set of reps.

  • Topology data structures to easily maintain continuity of adjacent higher-order surfaces as you modify your model and stitch surfaces together, thus preventing the appearance of cracks during tessellation.

Tools to Optimize the Traversal Stage

For optimizing the traversal stage, OpenGL Optimizer provides tools that perform these tasks:

  • Organize a scene graph spatially, facilitating rapid culling operations and interactions with the graph.

  • Restructure the scene graph for efficient highlighting and picking.

  • Subdivide large csGeoSets into smaller pieces defined by common rendering features, such as proximity to each other or similarly oriented normal vectors.

  • Sort the scene graph to minimize attribute-specification overhead in the graphics hardware.

  • Minimize the amount of data characterizing surface normals.

  • Reduce OpenGL command overhead.

  • Easily define arbitrary actions on a scene graph using the Visitor Behavioral Pattern (see Design Patterns: Elements of Reusable Object-Oriented Software in “Recommended Background Reading”).

Tools to Optimize the Transform Stage

Optimizer offers the following tools for optimizing the transform stage:

Occlusion Culler

An occlusion culler removes, before the transform stage, objects in the scene graph that are occluded by closer objects. Culling is performed automatically; no preprocessing of the scene graph is required.

Figure 1-5 shows the exterior of a model containing many parts that have been removed from the graphics pipeline by the occlusion culler. Only the shell needs to be rendered; the culled geometry is shown in Figure 1-1.

Figure 1-5. Shell That Occludes the Objects Shown in Figure 1-1 (Data courtesy of SDRC™)

Figure 1-5 Shell That Occludes the Objects Shown in Figure 1-1 (Data courtesy of SDRC™)

Simplifiers

Simplifiers decimate the set of triangles that define a model image. OpenGL Optimizer provides a new advanced simplification technology, known as the Successive Relaxation Algorithm, which gives you control over high-quality polygon mesh reduction. You can also use the faster, Rossignac simplification algorithm if you are not greatly concerned about object distortion.

Figure 1-6 shows the effects of the Successive Relaxation Algorithm as the number of triangles diminishes to nearly one tenth the original number. Essential structure is preserved in the lowest resolution image, which is appropriate for use when the object is viewed from greater distances.

Figure 1-6. Simplification From 4629 to 2002 to 483 Triangles

Figure 1-6 Simplification From 4629 to 2002 to 483 Triangles

Mesh Optimizers

Mesh optimizers reduce the number of vertices that have to be processed to render a given set of triangles. You can remove redundant vertex information by combining adjacent triangles into triangle strips (tristrips), triangle fans (trifans) or a combination of both.

Tessellators

Tessellators that approximate higher-order geometric primitives by a set of triangles. The accuracy, that is, how closely the original surface matches the tessellated surface, is controlled by a user-specified tolerance with adjustable levels of detail.

Figure 1-7 shows tessellations of a swept surface generated with various tolerances. The number of triangles used to approximate the surface ranges from 16,544, to 5,400, to 528, to 120.

Figure 1-7. Tessellations of a Higher-Order Surface: 16,544 to 120 triangles

Figure 1-7 Tessellations of a Higher-Order Surface: 16,544 to 120 triangles

Scene-Graph Manipulation and Other Tools

A scene-graph manipulation tool can be used to insert level-of-detail nodes. In addition, OpenGL Optimizer provides advanced shading and reflection mapping capabilities for applications where image quality is essential.

OpenGL Optimizer Programmer's Guide: An Open API for Large-Model Visualization
(document number: 007-2852-002 / published: 1998-06-09)    table of contents  |  additional info  |  download

    Front Matter
    About This Guide
    Part I. Getting Started
    Part II. High-Level Strategic Tools for Fast Rendering
    Part III. Specific Tools for Fast Rendering
    Part IV. Managing and Rendering Higher-Order Geometric Primitives
    Part V. Traversers, Low-Level Geometry Processing, and Multiprocessing
    Part VI. Utilities and Troubleshooting
    Part VII. Appendices
    Glossary
    Index


home/search | what's new | help