HLSL Notes 1
Getting Started
Shader is a very powerful tool that enhanced the computer graphics. Since several years ago, computer graphic cards have supported hardware-accelerated shader. The picture below shows an example of shader effects.

Shader is written in a so-called shader language. The shader language files are complied and are put into the graphic hardware running in parallel. There are some different kinds of shader languages. OpenGL provided a C-liked shader language, called OpenGL Shader Language (GLSL). In Microsoft DirectX 9 or later, shaders are programmed by High Level Shader Language (HLSL).
Concept
In shader programming, pixels are processed in parallel. So in shading language, we are dealing with single pixels. To simply the shader programming, the shader can be written in the following formulation:
F(x,y,z) = value
It tell the system what color will be shown in the position (x,y,z).
Vertex Shader & Pixel Shader

Due to the limitation of hardware pipeline, shader are divided into different types, such as vertex shader and pixel shader. They are processed in sequence in the graphics pipeline. (The latest newest shader model, the unified shader model has already simplified and unified the shading programming) However, since there are still many machine that does not support the latest shader model, this note will focus just on shader model 2.0.
HLSL example
In HLSL, like C programming, there will be an entry function, such as main().
For example:
sampler2D inputTexture : register(s0);
float4 ps_main (float2 texCoord: TEXCOORD0) : COLOR
{
float4 color = tex2D(inputTexture, texCoord);
return color;
}
This shader do NOTHING changed like directly rendering.