I write some codes but I don't really get it. Help!!
Device->SetRenderState(D3DRS_ALPHABLENDENABLE, true); //Open alpha blending
Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA); //Source factor
Device->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_INVSRCALPHA); //Destination factor
Device->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE); //blending parameter 1
Device->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE); //blending parameter 2
Device->SetTextureStageState(0, D3DTSS_ALPHAARG0, D3DTA_CONSTANT); //blending parameter 3
Device->SetTextureStageState(0, D3DTSS_ALPHAOP,D3DTOP_MODULATE); //parameter 1 times blending parameter 2
- The factor D3DBLEND_SRCALPHA is (as, as, as, as). I don't understand why isn't it (rs, gs, bs, as). What does it mean by (as, as, as, as)? Does it use alpha value to displace other colors' values? I don't think it does. So what does it mean?
- The factor D3DBLEND_SRCALPHA is (as, as, as, as). Does it blend any color channel or it just blend alpha channel?
- What is separate blending?
- Can I set my own blending factor for D3DRS_DESTBLEND and D3DRS_SRCBLEND?
- I don't understand the calculation about D3DTOP_MODULATE. MSDN said arg1 multiply arg2 but how? My texture(D3DTA_TEXTURE) has a 255 value of alpha and the alpha in vertex(D3DTA_DIFFUSE) has a value of 255. How does it multiply to get 255 (cause the result is opaque)? Also, how do they multiply 64 by 255 to get 64? Any full calculation?
- I want to multiply arg1, arg2 and arg3 together. I want to blend the alpha of my texture with the vertex alpha and the constant alpha. Can I do that?
Help!!!! Also, thank you !!!!!!