Quote:Original post by jikbar
I think he means
D3DTSS_ALPHARAG1, D3DTOP_MODULATE should be D3DTSS_ALPHAOP, D3DTOP_MODULATE
Since modulate is the operation you want to make, and not the source colour
Exactly. Sorry for being unclear.
Let's look some more at your stage states.
/* This block looks alright.You multiply the texture color with the diffuse color.*/TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_MODULATE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_DIFFUSE );/* This is what I mentioned above.You set ALPHAARG1 to MODULATE which doesn't make sense.Then you set the RESULTARG to DIFFUSE, which will cause the resulting alphaof this stage to be the diffuse alpha, no operation made. I think this shouldbe changed to the commented block below.*/TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTOP_MODULATE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_RESULTARG, D3DTA_DIFFUSE );/*TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_DIFFUSE );*//* RESULTARG will be set to CURRENT by default which is the only way yourstage operation will end up in the next stage. If you set RESULTARG tosomething else only that single argument is carried on.*/// Detail texture (2 layer)/* Here you set the COLOROP twice. The last operation will overwrite the firstso the first of them is useless. Is this your intention?*/TheGraphics.GetDevice()->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_ADDSIGNED );TheGraphics.GetDevice()->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_BLENDDIFFUSEALPHA );TheGraphics.GetDevice()->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );TheGraphics.GetDevice()->SetTextureStageState( 1, D3DTSS_COLORARG2, D3DTA_CURRENT );/* See the previous alpha block about ALPHAARG1. Here you set RESULTARG toCURRENT which is the default value so it doesn't have to be set. Tryreplacing this block with the commented block below.*/TheGraphics.GetDevice()->SetTextureStageState( 1, D3DTSS_ALPHAARG1, D3DTOP_MODULATE );TheGraphics.GetDevice()->SetTextureStageState( 1, D3DTSS_ALPHAARG2, D3DTA_TEXTURE );TheGraphics.GetDevice()->SetTextureStageState( 1, D3DTSS_RESULTARG, D3DTA_CURRENT );/*TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAOP, D3DTOP_MODULATE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE );TheGraphics.GetDevice()->SetTextureStageState( 0, D3DTSS_ALPHAARG2, D3DTA_CURRENT );*/
Remember, the arguments are processed by the operation and the result ends up in current. Resultarg is waht is passed on to the next stage or to the draw.