1. The difference between a fixed rendering pipeline and a programmable rendering pipeline:
1), fixed rendering pipeline--this is the standard Geometry & Illumination (T&L) pipeline, the function is fixed, it controls the world, vision, projection transformation and fixed lighting control and texture blending. T&l pipelines can be rendered with state control, matrix, illumination and mining parameters.     2), vertex shader--graphical developers can program the vertex and pixel operations in the rendering pipeline separately, without having to apply some fixed functions as before, instead of setting parameters to control the pipeline, first appearing with DX8, Includes PS and vs two parts. 2. In order to solve D3D or OpenGL support for different hardware vendors, to solve the problem of portability, can be achieved by abstracting the accelerator card function and defining the interface in a unified manner. As a result, people adopt a typical layering pattern (see: Design mode), dividing a set of applications into 3 tiers: application layer, hardware abstraction layer, hardware layer The application layer is the development body of the game and application developers who invoke the Unified Accelerator card API for upper-level development, regardless of the portability issue; The hardware Abstraction Layer Abstracts the acceleration of the hardware, facilitates encapsulation for application layer development, and opens to the application layer api; The hardware layer provides the hardware driver to the abstraction layer to achieve the effectiveness of the abstraction Layer acceleration function. This structure effectively separates the game and the application from the Hardware accelerator card, which is a good way to improve the porting ability of the program. Also, one benefit is that the knowledge reuse rate of development personnel is improved, thus reducing the development threshold for such software. The main function of the 3.3d accelerator card is to assist the CPU, which is responsible for transforming the vector image data (vertex collection) in memory, lighting calculation, cropping and so on, and finally the image is presented to the human eye by Rasterization. This process is called rendering d3d the entire rendering is divided into 9 steps, a combination of 9 steps, called the pipeline, or pipeline (see design mode of the pipeline mode). D3D Rendering Pipeline (Rendering Pipeline): Local coordinate transformations, world coordinate transformations, see coordinate transformations, back elimination, light-up, cut-and-shine projection, viewport calculation, and rasterization. whether it is a fixed rendering pipeline or a programmable pipeline, it takes these nine steps to: a programmable pipeline, as the name implies, that certain parts of the pipeline can be controlled. People can control and manage the rendering effect of the accelerator card by programming the shaders in the GPU. shaders are divided into vertex shaders and pixel shaders. Vertex shaders work when coordinate transformations and lighting calculations are performed pixel shaders work in rasterization. When people customize shaders, this pipeline is called a programmable pipeline. D3D also provides a default shader program, which is called a fixed pipeline when the game or application completely uses the default shader program. 4. Transform step: in a fixed pipeline, the transformation is divided into 2 steps: The local coordinate system to the world coordinate system and the world coordinate system to the observation coordinate system. local coordinate system: is a modeling coordinate system defined by tools such as 3DMAX when modeling World coordinate system: used to unify the position of each object in the scene, size and other specifications observing the coordinate system: the coordinate system of the camera. Local coordinate system to world coordinate system transform: This transformation is intended to unify the models that are designed under different modeling tools, or with different specifications, into a common coordinate system. The action, like the Qin Shihuang unified weights and measures. The action of the transformation from the local coordinate system to the world coordinate system, usually in the game design, by the game tool (such as the scene editor) to pre-calculate, and for each model is calculated a transformation matrix (that is, the record model in the game scene size, direction, position), called the World Coordinate transformation matrix. When rendering, these matrices are applied in real time to participate in the arithmetic notation: d3dxmatrix Worldmatrix; This matrix is read in from the file device->settransform ( D3dts_world, &worldmatrix); Note that using macro d3dts_world from the world coordinate system to the observation coordinate system transformation: This transformation action is actually done to simplify the operation. After this transformation, all the vertices can be converted directly to vectors, which is very convenient for some calculations. This action usually translates the camera to the world coordinate system origin, then rotates the cameraman so that its optical axis is aligned with the z axis of the world coordinate system. At the same time, all the geometry in the space is transformed with the camera to ensure that the camera's field of view is not changed. This transformation is called the framing transform, and the coordinate system is observed after transformation. The wording is as follows: d3dxmatrix ViewMatrix; D3dxvector3 position, TargetPoint, Worldup; &nbsP;          D3DXMATRIXLOOKATLH (&ViewMatrix,//[OUT], Computed transformation matrix &position,//Camera position &targetpoint,//camera's observation toward &worldup);//Camera's y orientation, i.e. head orientation device->settransform (D3DTS_VIEW, &ViewMatrix); Note the macro,d3dts_view in fact, the D3DXMATRIXLOOKATLH () function is just one of the function functions, note the suffix LH This represents a left-handed coordinate system, corresponding to a right-handed coordinate system, the difference is that the left-hand is the z axis is positive, the right hand is outward positive.         D3DXMATRIXLOOKATLH () function parsing: The return value for this function is the Same value returned in the POut parameter. The D3DXMATRIXLOOKATLH function can used as a parameter for another function. This function uses the following formula to compute the returned matrix. Zaxis = Normal (at-eye) Xaxis = Normal (out, zaxis) YAxis = Cross (Zaxis, Xaxis) xaxis.x yaxis.x zaxis.x 0 xaxis.y ya Xis.y zaxis.y 0 xaxis.z yaxis.z zaxis.z 0-dot (Xaxis, eye)-dot (YAxis, eye)-dot (Zaxis, eye) L 5.
(go) to fix the render pipeline and the programmable rendering pipeline