• Advertisement

Archived

This topic is now archived and is closed to further replies.

Alpha Bypassing

This topic is 5563 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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

Share this post


Link to post
Share on other sites
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 mesh

p_D3Ddevice->SetMaterial( &pMeshMaterials[0] ); //Set the material being used to render the mesh

p_D3Ddevice->SetTexture( 0, pMeshTextures[0] ); //Set the texture being used to render the mesh

pMesh->DrawSubset(0); // Render the mesh;




Kamikaze

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement