c++ - Direct3D9 Rendering a D3DFMT_A8 texture -
I have a texture using the D3DFMT_A8 format. I want to present it as if the color is white (i.e., RGB The components are all 255) and use textured data for alpha mixing.
I would like to do this without writing a pixel shader (without making any changes with existing shader, and working with a fixed-fiber pipeline).
I can combine alpha to work like any other texture, although the RGB components are all black while I am considered white in color ...
Looks like color / alpha operations D3DFMT_A8 as the color component of texture RGB (0,0,0).
So you have to select the color component from the alpha / vector color and alpha components:
Then you can deploy the color texture:
_d3d9Device.SetTextureStageState (1, D3DTSS_COLOROP, D3DTOP_MODULATE) _d3d9Device .Setlet Stagegett (1, D3D TTSCLORAR1, D3DTARTERTNT) _D 3D 9 devices. ResistanceStastState (1, D3 DTSSCLORAGR2, D3DTATtecher)
Of course, alpha blending must be enabled:
_d3d9Device .SetRenderState (D3DRS_ALPHATESTENABLE, false) _d3d9Device.SetRenderState (D3DRS_ALPHABLENDENABLE, it is true) _d3d9Device.SetRenderState (D3DRS_SRCBLEND, D3DBLEND_SRCALPHA) _d3d9Device.SetRenderState (D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA)
Comments
Post a Comment