Fade the alpha blend
Okay I got a TnL quad over the screen and I have a few alpha blending states enabled.
I was wondering what value or what render state I would modify to literally fade the intensity of the alpha, ie. Make the quad go from transparent to solid as I update the frames.
[Edited by - Halsafar on June 10, 2005 5:09:28 PM]
I'm in a bit of a hurry right now, so this'll have to be brief [smile]
You could use materials (D3DMATERIAL9's) and alter the "a" component accordingly.
You could also, I think, use the D3DTS_TFACTOR (or something TFACTOR??) for the fixed-function blending states.
Or you could physically modify the vertices and/or texture alpha data.
It entirely depends on how your program is operating - the first one above will only work when you're using FF lighting, the second if you're not using shaders (?) and the last one has possible performance problems.
hth
Jack
You could use materials (D3DMATERIAL9's) and alter the "a" component accordingly.
You could also, I think, use the D3DTS_TFACTOR (or something TFACTOR??) for the fixed-function blending states.
Or you could physically modify the vertices and/or texture alpha data.
It entirely depends on how your program is operating - the first one above will only work when you're using FF lighting, the second if you're not using shaders (?) and the last one has possible performance problems.
hth
Jack
Okay when using a Screen QUAD D3DFVF_XYZRHW and D3DFVF_DIFFUSE. I can set the color of the DIFFUSE to any alpha and nothing changes...
Try Device->SetTextureStageState( 0, D3DTSS_ALPHAARG1, D3DTA_DIFFUSE );
And make sure Device->SetRenderState( D3DRS_ALPHABLENDENABLE, true );
And make sure Device->SetRenderState( D3DRS_ALPHABLENDENABLE, true );
Yah I got it working by adding texture coords and doing this:
::Graphics()->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG1);
::Graphics()->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
::Graphics()->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE); //Ignored
//Set the alpha to come completely from the diffuse
::Graphics()->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);
::Graphics()->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_DIFFUSE);
::Graphics()->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_TEXTURE); //Ignor
I am not sure if I need all those states.
Curious tho, what is the default value for those states so I can them back....
::Graphics()->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_SELECTARG1);
::Graphics()->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);
::Graphics()->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE); //Ignored
//Set the alpha to come completely from the diffuse
::Graphics()->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);
::Graphics()->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_DIFFUSE);
::Graphics()->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_TEXTURE); //Ignor
I am not sure if I need all those states.
Curious tho, what is the default value for those states so I can them back....
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement