X-Gen Shader Programming Column

The second X-Gen Shader Programming Article by Wolfgang Engelis is now available on XGI’s Developper website and is dedicated to Gradient Intrinsics. Wolfgang Engel is the author of “Programming Vertex and Pixel Shaders” (published by Charles River) and the editor of ShaderX book series.

The gradient intrinsics ddx() and ddy() are used to detect the rate of change of a given register across adjacent pixels in horizontal ( ddx ) and vertical directions ( ddy ). They help to answer the question “how much does this value change from pixel to pixel, in either the screen-x or screen-y position”. The GPU provides these values by differing the neighboring pixels. That is, if you evaluate ddx(Var) , the graphics card will provide the difference between the value of Var at the current pixel and its value at the pixel next door. It is a straight linear difference, made efficient by the nature of the graphics card architecture.

The gradient intrinsics open the door to new anti-aliasing techniques in screespace never used before in games. Leveraging the potential of these instructions will be the challenge for the next generation of video games.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>