Explanation of Pixel and Vertex Shaders.

Discussion in 'Links' started by Glidefan, Oct 28, 2003.

Thread Status:
Not open for further replies.
  1. Glidefan

    Glidefan Don Booze Staff Member

    Likes Received:
    GTX 1070 | 8600M GS
    A forum user (MiSerYsEcHo) made an interesting thread for Pixel & Vertex shaders. Here is a "sticky" form of it for reference.

    Vertex and Pixel Shaders Explained
    The purpose of this thread is to briefly familiarize you with the vertex and pixel shader functions in modern graphics cards. Anyone reading a graphics card review these days have come across these two words numerous times, and unless you have a small understanding of what these functions are, and what they do for your video games, reading a review can be a frustrating experience. Providing an accurate description of these functions without being too technical is a rather tough experience in itself, but I am going to try to do this to the best of my limited knowledge...here we go...

    The Vertex shader = Objects in a 3D scene are typically described using triangles, which in turn are defined by their vertices. A vertex shader is a graphics processing function used to add special effects to objects in a 3D environment by performing mathematical operations on the objects' vertex data. Before DX8, vertex shading effects were so computationally complex that they could only be processed offline using render farms. Now, developers use Vertex Shaders to breathe life and personality into characters and environments, such as fog that dips into a valley and curls over a hill; or true-to-life facial animation such as dimples or wrinkles that appear when a character smiles. People talk about pixel shaders alot these days, but the vertex shader gave birth to the pixel shader, just as important of a discovery as hardware transform and lighting was a few years earlier.

    Pixel shaders = A Pixel Shader is a graphics function that calculates effects on a per-pixel basis. Depending on resolution, in excess of 2 million pixels may need to be rendered, lit, shaded, and colored for each frame, at 60 frames per second. That in turn creates a tremendous computational load. Modern cards process this load through Pixel Shaders. Per-pixel shading brings out a high level of surface detail-allowing you to see effects beyond the triangle level. Rather than simply choosing from a pre compiled palette of effects, developers can create their own. Pixel Shaders provide developers with the control for determining the lighting, shading, and color of each individual pixel, allowing them to create some really cool effects.
    DirectX 8 brought us pixel shader 1.0, 1.1, 1.2, and 1.3.
    DirectX 8 allowed programmers to write shader programs up to 12 instructions in length. After DX8's release, it was determined by programmers and Microsoft themselves that 12 instructions werent quite enough. So immediately after DX8's release, MS gave birth to DirectX 8.1, and introduced us to a new shader...PS 1.4
    PS 1.4 allowed programmers to now write shaders at nearly twice the size of DX8 shaders...up to 22 instructions in length. So now you have to remember that cards that are DX8(Ti series) support pixel shader 1.0, 1.1, 1.2, and 1.3, but not 1.4. Cards that are DX8.1(Radeon 8500 and up) support all of the same shaders as are required in DX8, but also support PS 1.4
    Now that we have DirectX 8 and 8.1 covered briefly, lets talk a little about DirectX 9.
    DirectX 9 brings us some new features in the way of pixel and vertex shaders version 2.0. These new shaders have a much higher instruction count in comparison to their directX 8.1 bretheren, and allow game programmers to pull off some even cooler effects then they were able to before. however, the real key feature of DirectX 9 is the introduction of RGBA values in 64 (16-bit FP per color) as well as 128-bit (32-bit FP per color) floating point precision. This large increase of color precision allows a suprisingly new amount of visual effects and picture quality. For those of you reading graphics reviews on the web, or possibly visiting tech forums to find out what the latest buzz is, DirectX 9 cards are diffinately the topic of discussion. People having cards from only one generation ago are more times then not made to feel that they are in desperate need of an upgrade. While this is an expensive pattern to fall into, it happens easily to most people considering themselves to be an enthusiast. To the writer of this thread, it can all seem absurd at times, the vast majority of games that are available to us today, barely take advantage of the DirecX 8 API, much less DirectX 9. You could probably count the number of publicly available DX9 titles on one hand....
    So why all the fuss?, because thats how it's always worked. Hardware manufacturer's count on it. The online communities beat it into you. You will believe that you need the latest and greatest. After all, it sucks to never be able to watch all of those cool demos, or join in on discussions regarding one of those few DX9 games that may have just been introduced. I myself have never seen the Dawn demo run on my own, or anybody elses, computer. As silly as it sounds, I feel like a half geek instead of a full fledged geek because of it
Thread Status:
Not open for further replies.

Share This Page