I see, it's simple when it's explained like this In fact, I thought the utilisation of D3DTA_ALPHAREPLICATE didn't allow me to use vertex color but rather SRCBLEND=D3DBLEND_ONE. If (for example) I want to change only the alpha of the texture, can I use a another method that modulate the AlphaOp ?
I thought to use D3DTA_TFACTOR (or D3DTOP_BLENDFACTORALPHA) with D3DRS_TEXTUREFACTOR like this : [source lang="vb"] D3DDevice8.SetRenderState D3DRS_TEXTUREFACTOR, D3DColorRGBA(255, 255, 255, 100) ' Alpha = 100 for example. D3DDevice8.SetTextureStageState 0, D3DTSS_ALPHAOP, D3DTOP_SELECTARG1 D3DDevice8.SetTextureStageState 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE Or D3DTA_TFACTOR D3DDevice8.SetTextureStageState 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT[/source]
But the operation seem to work with the black transparent texture.
Edit : Finally I'll see it later, this is not essential for my project, my biggest problem is already solved and I thank you again for that.
I don't understand why I used D3DRS_DESTBLEND=D3DBLEND_ONE to rendering the texture and I don't tried D3DRS_SRCBLEND=D3DBLEND_ONE.. It's so obvious now that I look stupid
Thank you very much for all your help, I'd probably still to find the problem. I haven't yet understood all the logics of blending color for the moment but it will come, I already understood the logic that you tried to explain me
If that doesn't bother you I keep your code in C++, I think this is a good example for me when I will turn to this language.
However, I have a last question because it's the only thing I didn't quite understand. The D3DTA_ALPHAREPLICATE doesn't allow to use vertex color because he take the informations only in the texture ?
Hi and sorry for my absence (I had some problems with my pc).
This blending stage seem to work with the RGB blending, but the Alpha stay problematic. See here. There are two problems, the alpha is too low and the blending of two color is incorrect when one of two isn't opaque (In fact, in the situation the opaque color became transparent).
I understood what you want to do but I'm not sure that the stage 1 is useful here (The ColorOp in the stage 1 is disable by default, so in this situation is ineffective, no ?).
Edit : The problem with blending of two colors has been resolved, there remains the problem of alpha too low.. See here.
Yes, I know it's possible, but I don't understand exactly how Shilbert told me to do that. Use the same texture in 2 stages to separate opaque pixel and transparent pixel (with a different blending operation for each) or 2 textures in 2 stages for blending between them ?