Vertex Shaders and Pixel Shaders

Pixel Rasteriser

The final part of the pipeline takes data from the vertex processing step and puts it into the frame buffer as pixel values. Placing triangles on the frame buffer isn't quite as easy as I'm making it sound. Before reaching the pixel rasterizer, the triangles are usually converted into scan lines, then the pixels in the scan line are passed through the rasterizer, one at a time. Actually, modern hardware often has a number of pixel rasterization blocks that will write more than one pixel at a time; however, this is transparent to the API user, so there's no real need to worry about it.

The pixel rasterizer will take all of the information passed through from the vertex processor and compute a final pixel color, based on these values. A basic example of its usage might be to take the diffuse color and multiply it with the texture color (using the texture coordinates to retrieve a color from the current texture). A more complicated method might also add on a color from a reflection texture, using a second set of texture coordinates.

Differences Between DX7 And DX8 Pipelines

For this part of the article, I'll introduce a few pieces of terminology to make my life simpler, and I'll tell you what they are, to make your life simpler. The DX7 pipeline is commonly called the fixed-function pipeline, and from now on, I'll just call it the FF pipeline. The DX8 pipeline introduces shader architecture in the guise of vertex shaders and pixel shaders, so from now on I'll just call the DX8 pipeline the shader pipeline.

FF Vertex Processing

The FF pipeline is an extension of a very rigid system of vertex processing. The original vertex transformation pipeline can be traced right back to DX3, when there were only three types of vertices that you could use: the untransformed, unlit vertex; the untransformed and lit vertex; and, the transformed and lit vertex. From this basic structure the flexible vertex formats appeared, which now form the basics of the fixed-function pipeline in DX8. Flexible vertex formats allow you to set up vertices with a few basic properties defined. The following diagram shows an oversimplified version of the fixed-function vertex processor.

The fixed function vertex processor.

These pretty much correspond to the main types of processing as described in the introduction to vertex processing. The simplification of the diagram occurs from skimming over fixed-function support for matrix palette skinning and vertex blending, but these are basically additions to the transformation pipeline.