Archived

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

Transperency

This topic is 5149 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

Or modulate the alpha channel by the Texture Factor and just update the Texture Factor with SetRenderState. It''s really fast and doesn''t require shaders. It does however limit you to using a single alpha value for your entire object, but that''s likely fine in this case.


Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
Why not just change the alpha value in the D3D material? You'll then need to set that material ie

pd3dDevice->SetMaterial(&m_mat);

[edited by - jpardon on November 8, 2003 4:31:52 PM]

Share this post


Link to post
Share on other sites
quote:

Couldn''t you explain using texture factor more detail



The following explaination is from the SDK documentation:

quote:

D3DRS_TEXTUREFACTOR
Color used for multiple-texture blending with the D3DTA_TFACTOR texture-blending argument or the D3DTOP_BLENDFACTORALPHA texture-blending operation. The associated value is a D3DCOLOR variable. The default value is opaque white (0xFFFFFFFF).



Here is some code:


m_pD3DDevice->SetRenderState(D3DRS_TEXTUREFACTOR, D3DCOLOR_RGBA(ucRedColor, ucGreenColor, ucBlueColor, ucAlphaColor));
m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_ADD);
m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TEXTURE);
m_pD3DDevice->SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TFACTOR);


_______________________________________
Understanding is a three edged sword...

Share this post


Link to post
Share on other sites
Actually, I tend to interchange the following four Texture Operations fairly often depending on the desired look of the effect:

quote:

D3DTOP_MODULATE
Multiply the components of the arguments.


D3DTOP_MODULATE2X
Multiply the components of the arguments, and shift the products to the left 1 bit (effectively multiplying them by 2) for brightening.


D3DTOP_MODULATE4X
Multiply the components of the arguments, and shift the products to the left 2 bits (effectively multiplying them by 4) for brightening.

Addition
D3DTOP_ADD
Add the components of the arguments.





_______________________________________
Understanding is a three edged sword...

Share this post


Link to post
Share on other sites
I didn''t mean to imply that ADD was bad and MODULATE was always right. What I meant was that in the majority of cases like this, MODULATE is the way to go. Typically they have an image that''s either completely opaque, or an image with an alpha channel and the want to be able to fade it out, so MODULATE would be the most likely candidate.

Stay Casual,

Ken
Drunken Hyena

Share this post


Link to post
Share on other sites
quote:

I didn''t mean to imply that ADD was bad and MODULATE was always right.



Ken, I thought that your comment about modulate was quite helpful and I didn''t take it any other way. I posted the different Alpha Blending, operations from the SKD, so Jok would understand the difference.

_______________________________________
Understanding is a three edged sword...

Share this post


Link to post
Share on other sites