   Texture Alpha Layer strangeness
  I having troubles getting a texture with an alpha channel to show up correctly.  Below is the code I''m using to set the alpha parameters.  What the problem is, there is a white glow around my sprites.  Does anyone know how to fix this?gDevice->SetRenderState(D3DRENDERSTATE_SRCBLEND,D3DBLEND_SRCALPHA);gDevice->SetRenderState(D3DRENDERSTATE_DESTBLEND,D3DBLEND_INVSRCALPHA);gDevice->SetRenderState(D3DRENDERSTATE_ALPHABLENDENABLE,TRUE);gDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);gDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);gDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_CURRENT);gDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_MODULATE);gDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);gDevice->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_DIFFUSE); 
  The white glow is because of filtering.  Imagine the following pixels, solid black, and transparent white.0xFF000000 0x00FFFFFFNow let''s stretch and filter them0xFF000000 0x80808080 0x00FFFFFFWe now have a 50% transparent medium grey around our black object... That''s no good.  Ensure you fill your canvas with color, not just draw to the edge of visible pixels.Newer versions of photoshop replace transparent parts with white, just to be annoying, and thus hinder this process... Use Photoshop 5.5.Newer versions of photoshop, when saving TGAs, save with premodulated alpha... ie:  If you have black with alpha of 50%, it actually writes out 50% alpha and grey.  You could figure out how to make it stop doing that, or just stick with Photoshop 5.5.;  So I got it working with a premultiplied white by using the folwoing SetTextureState flags.  Can anyone varify that this proper code or let me know a better way.  The art seems to look ok, but I''m not totaly sure.gDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_BLENDTEXTUREALPHA);gDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);gDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE | D3DTA_COMPLEMENT);gDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_BLENDTEXTUREALPHAPM);gDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE);gDevice->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_DIFFUSE | D3DTA_COMPLEMENT);;  Ok, I think this will be my last post on this subject.  I played with the premultiplied alpha more and came up with this set of code based off of the formula:r * alpha / 0xffg * alpha / 0xffb * alpha / 0xffIt seem to work great now.  Can anyone tell me if I''m doing this even close?gDevice->SetTextureStageState(0,D3DTSS_COLOROP,D3DTOP_MODULATE);gDevice->SetTextureStageState(0,D3DTSS_COLORARG1,D3DTA_TEXTURE);gDevice->SetTextureStageState(0,D3DTSS_COLORARG2,D3DTA_DIFFUSE);gDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_BLENDTEXTUREALPHA);gDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1,D3DTA_TEXTURE | D3DTA_ALPHAREPLICATE);gDevice->SetTextureStageState(0,D3DTSS_ALPHAARG2,D3DTA_DIFFUSE | D3DTA_ALPHAREPLICATE | D3DTA_COMPLEMENT);;quote:Can anyone tell me if I''m doing this even close?What effect are you trying to produce?   _______________________________________Understanding is a three edged sword...;  I am trying to draw a texture in 2D with an alpha layer that has been premultiplied because of Photoshop.  The texture is a picture loaded from a png file. 