Alpha Bypassing

Started by
1 comment, last by L_dot_N 21 years, 4 months ago
I want to write to the AlphaChannel(Deep,...) and use Opcity(8 Bit SrcAlpha + InvScrAlpha) in a single pass. Has anyone done ist ?? I have done this before, but in a bad hack. I am rendering the scene into a texture. Setting the texture i am rendering in stage 0 and the base texture in Stage 1. Then im am "lrp" tex0.rgb and tex1.rgb by tex1.a. Then setting alpha to the value i want. It works but is not nice to read a texture witch is the aktuell rendertarget. And don´t try to EMBM the input tex0, maybe it works(ATI) but most times you see the titels, or artifacts. Has anyone a better idea for this ???
Advertisement
First change the alpha channel of the material being used by
the mesh. Then make the following:

  p_D3Ddevice->SetRenderState( D3DRS_ALPHABLENDENABLE,   true );p_D3Ddevice->SetRenderState( D3DRS_SRCBLEND,  D3DBLEND_SRCALPHA );p_D3Ddevice->SetRenderState( D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA );pMeshMaterials[0].Diffuse.a = 0.5f;              //Set the opacity of the meshp_D3Ddevice->SetMaterial( &pMeshMaterials[0] );  //Set the material being used to render the meshp_D3Ddevice->SetTexture( 0, pMeshTextures[0] );  //Set the texture being used to render the meshpMesh->DrawSubset(0);  // Render the mesh;  



Kamikaze
I ment I want to use the alpha channel for ohter thing than Opcity
By using
"p_D3Ddevice->SetRenderState( D3DRS_ALPHABLENDENABLE, true );"
I have Opctiy Alpha in the Rendertarget, but I want deep in alpha channel in a singel pass.

This topic is closed to new replies.

Advertisement