Tuesday, 15 April 2008

Vertex and Pixel shaders


These first few posts are not going to be in order, but, oh well, I'll get there, started this a few weeks ago, so need to catch up with the posting.

Had to first read up on vertex and pixel shaders, how they replace certain parts of the graphic pipeline. The picture shows how this is done, where
1. vertex shader replaces fixed function transform & lighting
2. pixel shader replaces the texture stages

Vertex Shader: called for each data tuple (position, normal, vertexColor, textureCoord 0...n). Their outputs are per vertex parameters which are linearly interpolated across each pixel of each triangle of a mesh.
As a note from the rocket commander tutorials, to calculate as much as possible in vertex shaders as it requires computation of less points

Pixel Shader: or fragment shader gets executed on each pixel, input is interpolated set of parameters, the output is the final colour to be passed to frame buffer.

Shaders: Tiny programs written in a javascript/c like languate, which run natively on a graphics card.




No comments: