• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            永遠也不完美的程序

            不斷學習,不斷實踐,不斷的重構……

            常用鏈接

            統計

            積分與排名

            好友鏈接

            最新評論

            復習一下D3D渲染流程

                   
            摘自http://www.cnblogs.com/ixnehc/articles/1282350.html
            我歸納一下就是:準備頂點和圖元數據----》傳到D3D渲染管線----》處理頂點數據(固定、shader)----》幾何處理(裁剪、背面剔除、光柵化)----》像素處理(紋理采樣)----》著色
            牢記這個:

            Direct3D Graphics Pipeline

            The graphics pipeline provides the horsepower to efficiently process and render Direct3D scenes to a display, taking advantage of available hardware. This figure conceptually illustrates the building blocks of the pipeline:

            Direct3D graphics pipeline diagram

            Pipeline Component Description Related Topics
            Vertex Data Untransformed model vertices are stored in vertex memory buffers. Vertex Buffers (Direct3D 9), IDirect3DVertexBuffer9
            Primitive Data Geometric primitives, including points, lines, triangles, and polygons, are referenced in the vertex data with index buffers. Index Buffers (Direct3D 9), IDirect3DIndexBuffer9, Primitives, Higher-Order Primitives (Direct3D 9)
            Tessellation The tesselator unit converts higher-order primitives, displacement maps, and mesh patches to vertex locations and stores those locations in vertex buffers. Tessellation (Direct3D 9)
            Vertex Processing Direct3D transformations are applied to vertices stored in the vertex buffer. Vertex Pipeline (Direct3D 9)
            Geometry Processing Clipping, back face culling, attribute evaluation, and rasterization are applied to the transformed vertices. Pixel Pipeline (Direct3D 9)
            Textured Surface Texture coordinates for Direct3D surfaces are supplied to Direct3D through the IDirect3DTexture9 interface. Direct3D Textures (Direct3D 9), IDirect3DTexture9
            Texture Sampler Texture level-of-detail filtering is applied to input texture values. Direct3D Textures (Direct3D 9)
            Pixel Processing Pixel shader operations use geometry data to modify input vertex and texture data, yielding output pixel color values. Pixel Pipeline (Direct3D 9)
            Pixel Rendering Final rendering processes modify pixel color values with alpha, depth, or stencil testing, or by applying alpha blending or fog. All resulting pixel values are presented to the output display. Pixel Pipeline (Direct3D 9)

            Direct3D System Integration

            This figure shows the relationships between a Window application, Direct3D,GDI, and the hardware:

            Direct3D system relationship diagram

            Direct3D exposes a device-independent interface to an application. Direct3D applications can exist alongsideGDI applications, and both have access to the computer's graphics hardware through the device driver for the graphics card. UnlikeGDI, Direct3D can take advantage of hardware features by creating a hal device.

            A hal device provides hardware acceleration to graphics pipeline functions, based upon the feature set supported by the graphics card. Direct3D methods are provided to retrieve device display capabilities at run time. (See IDirect3D9::GetDeviceCaps and IDirect3DDevice9::GetDeviceCaps.) If a capability is not provided by the hardware, the hal does not report it as a hardware capability.

            For more information about hal and reference devices supported by Direct3D, see Device Types (Direct3D 9).

            *.首先Device的使用者要準備好頂點數據,也就是一個頂點的數組,稱為A 
            *.然后這個數組A被傳入device的渲染管線
            *.device內部依次對每個頂點進行處理,有兩種模式,固定管線和shader模式,所謂固定管線就是device內部實現的一個固定的程 序,用戶只能通過設定各種參數(一些RenderState)來控制它,當然這不夠靈活,所以有了shader模式,也就是說,用戶需要寫一個程序片段 (所謂vertex shader),傳給device,然后device使用這個片段對每個頂點進行處理.這個程序片段是在顯卡上執行的.
            *.傳入的頂點數組A的每一個元素被轉換后,存儲到另一個數組B中.數組B中的每個元素必須至少包含一個透視空間的位置,用來做裁剪.
            *.數組B被傳入到device的下一個計算階段,在這個階段里,數組B中的(被轉換過的)頂點被組織成一個個三角形,然后對這些三角形進行裁 剪(利用頂點數據里包含的那一個透視空間的位置),背面剔除(注意背面剔除和頂點的法線是沒關系的),最后剩下的三角形被保存到一個數組C中.(注意在這 個階段里頂點數組變成了三角形數組)
            *.數組C被傳入到下一個計算階段,光柵化,對于數組C中每一個三角形,首先把它們從透視空間映射到屏幕空間,然后找出它們在屏幕上覆蓋的像素 (一個三角形覆蓋的像素的數量有可能是很多的),對于每一個像素,根據它在三角形中的位置,通過三角形的頂點進行線性插值,計算出一個像素數據(注意像素 數據是通過三角形的頂點數據插值而來,所以它們的數據類型是一致的),所有三角形算出來的像素數據最后被存儲到一個數組D中.(在這個階段里,三角形的數 組變成了像素數據數組)
            *.數組D被傳入到下一個計算階段,在這個階段里,device會對這些像素做一些初步的過濾,主要是進行stencil test(根據stencil
            buffer上的值)和z-test(根據這個像素的Z值和z-buffer上的值進行比較),根據測試結果會對stencil buffer進行一些修改(使用一組render state來控制這個過程),通過這些test的像素被存儲到數組E.
            *.數組E被傳入到下一個計算階段,在這個階段里,device對每個像素數據進行處理,這個階段也有兩種模式,固定管線和shader模式, 與頂點處理階段類似,用戶也可以寫一個程序片段,來對每一個像素數據進行處理,稱為pixel shader.像素數據可能包含各種類型的數據,但經過這一階段的處理后,輸出是很簡單的,一般就是一個顏色值和一個alpha值(透明度),也可以輸出 一個Z值,不過好像不常用.在pixel shader里還可以使用專門的指令來放棄某一個像素的后續處理.所有的像素數據被處理后,結果存在一個數組F中.
            *.數組F進入下一個階段,在這一個階段里,進行alpha test(根據像素的alpha 值),alpha test是最后一個test了,通過了alpha test的像素可以保證繪制到屏幕上去,通過test的像素會把它們的z值更新到z-buffer中去(具體由一組render state控制),通過test的像素被存入數組G
            *.數組G進入下一個階段,在這個階段里,主要是把數組G里的像素和屏幕上已有的像素進行混合,具體混合的方式有多種多樣,由一系列render state進行控制.混合以后的像素就被"畫"到屏幕上了

            posted on 2009-05-11 22:21 狂爛球 閱讀(4221) 評論(2)  編輯 收藏 引用 所屬分類: 圖形編程

            評論

            # re: 復雜一下D3D渲染流程 2009-05-11 23:06 chib

            @@ 標題??  回復  更多評論   

            # re: 復習一下D3D渲染流程 2009-05-12 10:25 Sail Tsao

            原來標題是復習.....汗一個....  回復  更多評論   

            日韩精品无码久久久久久| 国产香蕉久久精品综合网| 九九久久自然熟的香蕉图片| 久久ZYZ资源站无码中文动漫| 久久91综合国产91久久精品 | 久久久久久曰本AV免费免费| 无码人妻精品一区二区三区久久| 久久久久国产精品| 久久99九九国产免费看小说| 久久国产精品久久精品国产| 欧美伊人久久大香线蕉综合69| 人妻无码αv中文字幕久久琪琪布| 精品久久人人爽天天玩人人妻| 亚洲AV无码成人网站久久精品大| 久久成人影院精品777| 一本色道久久HEZYO无码| 人妻中文久久久久| 欧美综合天天夜夜久久| 久久综合给合久久狠狠狠97色69| 天天做夜夜做久久做狠狠| 国产国产成人精品久久| 中文字幕亚洲综合久久菠萝蜜| 97精品伊人久久久大香线蕉| 亚洲AV无码久久| 欧洲人妻丰满av无码久久不卡| 欧美日韩精品久久久久| 国内精品久久久久久麻豆 | 亚洲精品乱码久久久久久久久久久久 | 色8久久人人97超碰香蕉987| 亚洲国产成人久久精品99| 国产高潮国产高潮久久久91| 久久九九亚洲精品| 国产精品久久99| 亚洲国产精品久久久久网站| 色综合久久精品中文字幕首页| 国产精品青草久久久久婷婷| 久久精品国产亚洲欧美| 香蕉久久夜色精品国产小说| 国产精品成人99久久久久| 91精品观看91久久久久久| 久久精品这里只有精99品|