   C++ Dx9 Transparent/Alpha Textures
  Hi guys, if i have a texture that i want to be semi transparent, how do i accomplish this, what texture bit are we dealing (e.g. ambient diffuse, etc), and how do i load it in. I just have no idea!I have had a look around but most of the code i'm looking for is intwined with other stuff.NB i load in .x files, and i need a way of doing this for animated and static meshes.Thanks in advanceJamesCobras   
  You'll want to use the Texture Tool that comes with the DX9 SDK to convert the texture to DXT5 format, then load it into your game using D3DXCreateTextureFromFile() or whatever (I assume you know how to do this, and to set the texture and all that). If you're using the fixed function pipeline, you need to set the proper render states. Typically that would be:device->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);device->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA); For programmable pipelines, I can only really help you if you're using the D3DX Effects framework because that's all I'm familiar with. When you're setting up your technique, you'll want to add these lines to your pass:AlphaBlendEnable = True;SrcBlend = SrcAlpha;DestBlend = InvSrcAlpha;I believe, but cannot prove, that if you're writing shaders without the D3DX Effects framework, then you would just use the SetRenderState() calls as if it were a fixed function pipeline.And the most important part, when doing the programmable shader stuff, is that your pixel shader must be written to output the alpha for this to have any effect. Usually, this is no big deal. If all you're doing is sampling the texture and outputting the results, then you're already done. However, if you're doing further lighting calculations or anything like that, just make sure that you're preserving the alpha from the sampled texture.   ;  is there anyway of changing the alpha value of the texture in game before rendering ? That would be really useful, the above code i'll try out in a bit.Thanks guys.JamesCobras   ;  I'm sure you can change the texture, but it probably wouldn't be easy. You'd probably have to lock it and change the pixels, or something.There are some easy alternatives, though, depending on what you want to do. For instance, there's nothing preventing you from writing out a different alpha value in the shader. So, if you have an object that is normally opaque (texture-wise) but you want to draw the whole thing at 50% opacity, then you can just have the shader output 0.5 as the alpha value. I don't know how it'd be done with the fixed function pipeline stuff, but I'm sure there's a way.   