The Direct3D Transformation Pipeline
IntroductionThis white paper provides a technical explanation for Direct3D application developers on how to set the parameters of the Direct3D Transformation Pipeline by the direct manipulation of Direct3D matrices. OverviewDirect3D uses three transformations to change your 3D model coordinates into pixel coordinates (screen space). These transformations are world transform,view transform,and projection transform. World transform controls how model coordinates are transformed into world coordinates. World transform can include translations,rotations,and scalings,but it does not apply to lights. For more information on working with world transforms,see World Transform. View transform controls the transition from world coordinates into "camera space," determining camera position in the world. For an example of working with view transforms,see View Transform. Projection transform changes the geometry from camera space into "clip space" and applies perspective distortion. The term "clip space" refers to how the geometry is clipped to the view volume during this transform. For an example of working with projection transforms,see Projection Transform. Finally,the geometry in clip space is transformed into pixel coordinates (screen space). This transformation is controlled by the viewport settings. Clipping and transforming vertices must take place in homogenous space (simply put,space in which the coordinate system includes a fourth element),but the final result for most applications needs to be non-homogenous three-dimensional (3D) coordinates defined in "screen space." This means that both the input vertices and the clipping volume must be translated into homogenous space to perform the clipping and then translated back into non-homogenous space to be displayed. The three Direct3D transformations-world,view,and projection transform-are defined by Direct3D matrices. A Direct3D matrix is a 4x4 homogenous matrix defined by a D3DMATRIX structure. Although Direct3D matrices are not standard objects-they are not represented by a COM interface-you can create and set them just as you would any other Direct3D object. For more information on Direct3D matrices,see Transforms. The Transformation PipelineIf a vertex in the model coordinate is given by Pm = (Xm,Ym,Zm,1),then the transformations shown in the following figure are applied to compute screen coordinates Ps = (Xs,Ys,Zs,Ws). The seven stages are as follows:
Usage Tips
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |