總是想看點(diǎn)新鮮的東西,或許是因?yàn)樯钐珕握{(diào)了。

大體看了下《用RenderMonkey 進(jìn)行shader開發(fā)》,學(xué)了點(diǎn)皮毛。
要真正理解這玩意兒,還得看DirectX Documentation.
Shaders
At a very high level, data enters the graphics pipeline as a stream of primitives and is processed by up to as many as three shader stages:
- A vertex shader performs per-vertex processing such as transformations, skinning, vertex displacement, and calculating per-vertex material attributes. Tessellation of higher-order primitives should be done before the vertex shader executes. As a minimum, a vertex shader must output vertex position in homogeneous clip space. Optionally, the vertex shader can output texture coordinates, vertex color, vertex lighting, fog factors, and so on.
- A geometry shader performs per-primitive processing such as material selection and silhouette-edge detection, and can generate new primitives for point sprite expansion, fin generation, shadow volume extrusion, and single pass rendering to multiple faces of a cube texture.
- A pixel shader performs per-pixel processing such as texture blending, lighting model computation, and per-pixel normal and/or environmental mapping. Pixel shaders work in concert with vertex shaders; the output of a vertex shader provides the inputs for a pixel shader. In Direct3D 9 some pixel operations (such as fog blending, stencil operations, and render-target blending) occur after the pixel shader is finished.
These stages are completely programmable using the High Level Shading Language (see HLSL). Authored HLSL shaders can be compiled at author-time or at runtime, and set at runtime into the appropriate pipeline stage.
All Direct3D 10 shaders are compiled with the shader model 4 target. Functions like D3D10CompileShader and D3D10CompileEffectFromMemory require a shader profile to tell the compiler which shader model to compile for.