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

            戰魂小筑

            討論群:309800774 知乎關注:http://zhihu.com/people/sunicdavy 開源項目:https://github.com/davyxu

               :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              257 隨筆 :: 0 文章 :: 506 評論 :: 0 Trackbacks

            前段時間曾經碰到過RT紋理繪制出來時需要透明的問題。當時也Google了一下,但是很少有人提起過這個問題。昨天看劍孤寒的空間的Galaxy2D引擎中使用RT的透明繪制,文章在這里。發現這個特性居然需要顯卡支持,馬上查過DX9SDK文檔,發現這樣一篇文章,已經告訴我們怎么做了:

            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渲染狀態可以讓Frame Buffer 混合器將RT中的Alpha通道與顏色通道分開混合。

            當D3DRS_SEPARATEALPHABLENDENABLE 設置為 FALSE(默認),RT渲染參數和操作會跟顏色通道一樣被應用到Alpha通道。 這項特性需要顯卡支持D3DPMISCCAPS_SEPARATEALPHABLEND 特性。記住,在之前設置D3DRS_ALPHABLEND以便打開Alpha混合。

               RT混合器的Alpha通道混合因子渲染狀態如下:

            D3DRS_SRCBLENDALPHA

            D3DRS_DESTBLENDALPHA

            其被定義在D3DBLEND枚舉中,D3DRS_SRCBLEND 和D3DRS_DESTBLEND也是這樣定義的。來源色與目標顏色將會有很多組合方式,主要依賴于D3DCAPS9中的SrcBlendCaps 和DestBlendCaps

            Alpha混合公式如下:

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

            其中:

                alphain為輸入alpha值

                srcBlendOp是D3DBLEND中的一個混合因子

                BlendOp是 D3DBLENDOP中的一個混合因子

                alphart是RT的alpha值

                destBlendOp是D3DBLEND中的一個混合因子

                renderTargetAlpha是最后混合后的alpha值

            posted on 2010-01-20 16:56 戰魂小筑 閱讀(2866) 評論(1)  編輯 收藏 引用 所屬分類: 游戲開發技術C++/ 編程語言

            評論

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

              回復  更多評論
              

            久久久久久久女国产乱让韩| 国产99久久久国产精品~~牛| 亚洲国产精品无码久久九九| 久久久久久久免费视频| 亚洲国产欧美国产综合久久| 久久久久久免费一区二区三区| 久久久精品波多野结衣| 亚洲成色www久久网站夜月| 国内精品久久久久久中文字幕| 香蕉久久夜色精品国产2020 | 久久午夜羞羞影院免费观看| 99久久中文字幕| 三级三级久久三级久久| 品成人欧美大片久久国产欧美| 婷婷久久综合| 国产999精品久久久久久| 国产亚洲精品自在久久| 久久国内免费视频| 国产精品99久久久久久猫咪| 久久国产免费观看精品3| 久久精品国产亚洲AV香蕉| 国产精品成人久久久久三级午夜电影 | 久久亚洲天堂| 国内精品久久久久久久涩爱| 77777亚洲午夜久久多喷| 成人久久免费网站| 久久人妻无码中文字幕| 久久久99精品成人片中文字幕 | 亚洲色欲久久久久综合网| 久久国产成人精品麻豆| www性久久久com| 浪潮AV色综合久久天堂| 午夜天堂av天堂久久久| 伊人色综合久久天天人手人婷 | 亚洲精品高清一二区久久| 久久99国产精品成人欧美| 久久国产福利免费| 久久久久久国产精品无码下载 | 精品久久久久久国产牛牛app| 久久国产精品99久久久久久老狼| 99久久免费国产特黄|