• <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>

            戰(zhàn)魂小筑

            討論群:309800774 知乎關(guān)注:http://zhihu.com/people/sunicdavy 開(kāi)源項(xiàng)目:https://github.com/davyxu

               :: 首頁(yè) :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理 ::
              257 隨筆 :: 0 文章 :: 506 評(píng)論 :: 0 Trackbacks

            前段時(shí)間曾經(jīng)碰到過(guò)RT紋理繪制出來(lái)時(shí)需要透明的問(wèn)題。當(dāng)時(shí)也Google了一下,但是很少有人提起過(guò)這個(gè)問(wèn)題。昨天看劍孤寒的空間的Galaxy2D引擎中使用RT的透明繪制,文章在這里。發(fā)現(xiàn)這個(gè)特性居然需要顯卡支持,馬上查過(guò)DX9SDK文檔,發(fā)現(xiàn)這樣一篇文章,已經(jīng)告訴我們?cè)趺醋隽耍?/p>

            Render Target Alpha (Direct3D 9)

            The frame buffer blender can now blend alpha channels independent from color-channel blending on render targets. This control is enabled with a new render state, D3DRS_SEPARATEALPHABLENDENABLE.

            When D3DRS_SEPARATEALPHABLENDENABLE is set to FALSE (which is the default condition), the render-target blending factors and operations applied to alpha are the same as those defined for blending color channels. A driver needs to set the D3DPMISCCAPS_SEPARATEALPHABLEND cap to indicate that it can support render-target alpha blending. Be sure to enable D3DRS_ALPHABLEND to tell the pipeline that alpha blending is needed.

            To control the factors in the alpha channel of the render-target blenders, two new render states are defined as follows:

            D3DRS_SRCBLENDALPHA 
            D3DRS_DESTBLENDALPHA 
            

            Like the D3DRS_SRCBLEND and D3DRS_DESTBLEND, these can be set to one of the values in the D3DBLEND enumeration. The source and destination blend settings can be combined in several ways, depending on the settings in the SrcBlendCaps and DestBlendCaps members of D3DCAPS9.

            The alpha blending is done as follows:

            renderTargetAlpha = (alphain* srcBlendOp) BlendOp (alphart* destBlendOp) 
            

            Where:

            • alphain is the input alpha value.
            • srcBlendOp is one of the blend factors in D3DBLEND.
            • BlendOp is one of the blend factors in D3DBLENDOP.
            • alphart is the render-target alpha value.
            • destBlendOp is one of the blend factors in D3DBLEND.
            • renderTargetAlpha is the final blended alpha value.

             

            翻譯如下:

               使用 D3DRS_SEPARATEALPHABLENDENABLE渲染狀態(tài)可以讓Frame Buffer 混合器將RT中的Alpha通道與顏色通道分開(kāi)混合。

            當(dāng)D3DRS_SEPARATEALPHABLENDENABLE 設(shè)置為 FALSE(默認(rèn)),RT渲染參數(shù)和操作會(huì)跟顏色通道一樣被應(yīng)用到Alpha通道。 這項(xiàng)特性需要顯卡支持D3DPMISCCAPS_SEPARATEALPHABLEND 特性。記住,在之前設(shè)置D3DRS_ALPHABLEND以便打開(kāi)Alpha混合。

               RT混合器的Alpha通道混合因子渲染狀態(tài)如下:

            D3DRS_SRCBLENDALPHA

            D3DRS_DESTBLENDALPHA

            其被定義在D3DBLEND枚舉中,D3DRS_SRCBLEND 和D3DRS_DESTBLEND也是這樣定義的。來(lái)源色與目標(biāo)顏色將會(huì)有很多組合方式,主要依賴(lài)于D3DCAPS9中的SrcBlendCaps 和DestBlendCaps

            Alpha混合公式如下:

            renderTargetAlpha = (alphain* srcBlendOp) BlendOp (alphart* destBlendOp)

            其中:

                alphain為輸入alpha值

                srcBlendOp是D3DBLEND中的一個(gè)混合因子

                BlendOp是 D3DBLENDOP中的一個(gè)混合因子

                alphart是RT的alpha值

                destBlendOp是D3DBLEND中的一個(gè)混合因子

                renderTargetAlpha是最后混合后的alpha值

            posted on 2010-01-20 16:56 戰(zhàn)魂小筑 閱讀(2866) 評(píng)論(1)  編輯 收藏 引用 所屬分類(lèi): 游戲開(kāi)發(fā)技術(shù)C++/ 編程語(yǔ)言

            評(píng)論

            # re: 解決Render Target中的Alpha通道繪制問(wèn)題 2010-01-21 18:27 yoya
            這篇文章是不是只是說(shuō)alpha和color的混合可以分開(kāi)進(jìn)行?如果不按照文中設(shè)置,只是alpha和color用的D3DRS_SRCBLEND和D3DRS_DESTBLEND的參數(shù)
            那么render target里面還是可以設(shè)置alpha啊?

              回復(fù)  更多評(píng)論
              

            久久国产午夜精品一区二区三区| 久久免费99精品国产自在现线 | 亚洲精品美女久久久久99小说 | 热久久最新网站获取| 久久这里都是精品| 久久午夜羞羞影院免费观看| 久久国产精品成人免费| 综合久久精品色| 久久综合综合久久97色| 欧美一区二区久久精品| 久久91综合国产91久久精品| 亚洲国产天堂久久综合| 99麻豆久久久国产精品免费| 看全色黄大色大片免费久久久| 久久丫忘忧草产品| 精品国产乱码久久久久久浪潮| 久久久久亚洲国产| 久久精品国产99国产精偷| 久久天天躁夜夜躁狠狠| 18岁日韩内射颜射午夜久久成人| 一本一本久久A久久综合精品| 99久久国产综合精品网成人影院| 伊人久久大香线蕉综合影院首页 | 久久伊人精品青青草原高清| 精品久久久久成人码免费动漫 | 久久久久久久综合综合狠狠| 国产高潮国产高潮久久久| 久久妇女高潮几次MBA| 久久综合日本熟妇| 午夜不卡888久久| 久久99精品综合国产首页| 久久久噜噜噜www成人网| 精品国产乱码久久久久久人妻 | 麻豆一区二区99久久久久| 伊人情人综合成人久久网小说| 久久精品国产亚洲7777| 国产精品免费久久久久久久久| 99久久精品国产高清一区二区 | 欧美亚洲国产精品久久| 久久精品极品盛宴观看| 丁香色欲久久久久久综合网|