总是想看点新鲜的东西,或许是因为生活太单调了。
大体看了下《用RenderMonkey 进行shader开发》,学了点皮毛。
要真正理解这玩意儿,还得看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.
posted on 2007-10-21 04:11
七星重剑 阅读(1295)
评论(0) 编辑 收藏 引用 所属分类:
Game Graphics 、
HLSL&ShaderMonkey