Graphics Reference
In-Depth Information
proportional to visible geometric complexity but independent of temporal and lens
sampling.
15.7 Rendering with a Rasterization API
Rasterization has been encapsulated in APIs. We've seen that although the basic
rasterization algorithm is very simple, the process of increasing its performance
can rapidly introduce complexity. Very-high-performance rasterizers can be very
complex. This complexity leads to a desire to separate out the parts of the raster-
izer that we might wish to change between applications while encapsulating the
parts that we would like to optimize once, abstract with an API, and then never
change again. Of course, it is rare that one truly is willing to never alter an algo-
rithm again, so this means that by building an API for part of the rasterizer we are
trading performance and ease of use in some cases for flexibility in others. Hard-
ware rasterizers are an extreme example of an optimized implementation, where
flexibility is severely compromised in exchange for very high performance.
There have been several popular rasterization APIs. Today, OpenGL and
DirectX are among the most popular hardware APIs for real-time applications.
RenderMan is a popular software rasterization API for offline rendering. The
space in between, of software rasterizers that run in real time on GPUs, is cur-
rently a popular research area with a few open source implementations available
[LHLW10, LK11, Pan11].
In contrast to the relative standardization and popularity enjoyed among raster-
izer APIs, several ray-casting systems have been built and several APIs have been
proposed, although they have yet to reach the current level of standardization and
acceptance of the rasterization APIs.
This section describes the OpenGL-DirectX abstraction in general terms. We
prefer generalities because the exact entry points for these APIs change on a fairly
regular basis. The details of the current versions can be found in their respective
manuals. While important for implementation, those details obscure the important
ideas.
15.7.1 The Graphics Pipeline
Consider the basic operations of any of our software rasterizer implementations:
1.
(Vertex) Per-vertex transformation to screen space
2.
(Rasterize) Per-triangle (clipping to the near plane and) iteration over pix-
els, with perspective-correct interpolation
3.
(Pixel) Per-pixel shading
4.
(Output Merge) Merging the output of shading with the current color and
depth buffers (e.g., alpha blending)
These are the major stages of a rasterization API, and they form a sequence
called the graphics pipeline, which was introduced in Chapter 1. Throughout the
rest of this chapter, we refer to software that invokes API entry points as host
code and software that is invoked as callbacks by the API as device code. In the
context of a hardware-accelerated implementation, such as OpenGL on a GPU,
this means that the C++ code running on the CPU is host code and the vertex and
pixel shaders executing on the GPU are device code.
 
 
 
Search WWH ::




Custom Search