Real-Time Shader Programming

Part II: Pixel Shader Reference

QUICK OVERVIEW

Just as vertex shaders operate on a single vertex, pixel shaders operate on a single pixel. Pixel shaders' instructions break down into two categories: those that work on the color and alpha blending and those that work on texture addressing. Generally you can perform a color and/or alpha blending operation or a texture addressing operation with a single pixel shader instruction.

While vertex shaders are straightforward, pixel shaders are a bit more idiosyncratic since they more closely mimic the underlying hardware, and the hardware is evolving. Pixel shader versions 1.0 though 1.3 tend to show the influence of hardware manufactured by NVIDIA, while version 1.4 exposes the way the ATI hardware works. Version 2.0 shaders introduce yet another level of features while removing or subsuming some of the capabilities of the previous versions and provide a better experience.

Like vertex shaders, you can reference individual pieces of a register; in the case of pixel shaders, these are specified by rgb and a instead of xzy and w. Unlike vertex shaders, component swizzles are not supported by the pixel shader specification until PS 2.0.

In PS 1.0 1.3, the r, g, and b components are treated together as a single RGB color component, while the a component is treated as alpha, which can be routed separately. Whereas with PS 1.4 and 2.0, you can mask out or extract the components independently.

DirectX 9 update

DirectX 9 introduced some significant changes with...

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Frame Grabbers
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.