   Printing 2D image (a character) without the background
  Hi !  (I use DirectX 9)I want to show a picture in a quad (or in a billboard) but the drawing is nota rectangular form (this is a cartoon character). This is not a 3D mesh and I did it with Paint Shop Pro (2D picture). How can I dismiss the background of my character (the sheet of paper, on which I draw) to see the remaining 3D scene ?I show the quad (or the billboard) in front of my 3D scene but I don't want to see a square with a picture in it, I want to see only the cartoon character.Can I use a special background color and remove it when rendering ?   
  Well if I get what you're saying correctly, you want the background of the cartoon character to be come transparent, only showing the background quad behind it.This is quite simple.You can ether use [1]Color Keying (A color in the image, usually magenta (255,0,255), is made transparent in the program) or [2]Alpha Channels (the image has information on how transparent the pixels (usually on a level of 0-255, which is 8 bit transparency) are in the image, I prefer this method)First, in Paint Shop Pro (I dont have it, I have PS CS2, but I'll give you generic tips), create a single layer out of the background (if its not already a layer), so there is a transparent background behind the picture. Then, begin to erase (use the pencil brush without antialiasing if you want to use color keying to reduce pink-wash as I like to call it, otherwise use a smoother brush) the "paper" around the character.(These steps are ONLY for color keying, otherwise go to the next paragraph)After the paper is gone and only the character is left on the transparent background, create a new layer and move it behind the cartoon character. Fill in the new layer with magenta (rgb value of 255,0,255).(These steps are for Alpha Channels)Save the image as a PNG 24 bit with transparency (alpha channel) or PNG 8 bit with transparency and a matte color like black (this creates a smaller image but makes the edges blockier). You can also use DDS if you know how to use that format, but its a bit harder and the images have to be in dimensions by the power of 2.(These steps are for Color Keying)Save the image as a PNG 8 bit or 24 bit WITHOUT transparency. 8 Bit will have less colors, but will be smaller. You can also use BMP or JPG if you wish, but I dont like those formats (JPG looks bad and bmp is too big).Now, in the program itself, instead of using  D3DXCreateTextureFromFile which I think you're using right now, use D3DXCreateTextureFromFileExThe definition of D3DXCreateTextureFromFileEx is:HRESULT D3DXCreateTextureFromFileEx(  LPDIRECT3DDEVICE9 pDevice,  LPCTSTR pSrcFile,  UINT Width,  UINT Height,  UINT MipLevels,  DWORD Usage,  D3DFORMAT Format,  D3DPOOL Pool,  DWORD Filter,  DWORD MipFilter,  D3DCOLOR ColorKey,  D3DXIMAGE_INFO * pSrcInfo,  PALETTEENTRY * pPalette,  LPDIRECT3DTEXTURE9 * ppTexture);Here's a generic usage:D3DXCreateTextureFromFileEx(m_pD3DDevice, "Path\\To\\Image.png",D3DX_DEFAULT, D3DX_DEFAULT, 0, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_DEFAULT,D3DX_DEFAULT, [SEE NOTES FOR THIS PARAMETER], NULL, NULL, &m_pReferencetoTexture);For Color keying, you will want to use D3DCOLOR_ARGB(255,0,255,255) in place of [SEE NOTES FOR THIS PARAMETER], otherwise use NULL.One more step.To use vertext transparency shading, you will have to set up your texture stage states and render states, which will look something like:m_pD3DDevice->SetTextureStageState(0,D3DTSS_COLOROP, D3DTOP_SELECTARG1);m_pD3DDevice->SetTextureStageState(0,D3DTSS_COLORARG1, D3DTA_TEXTURE);m_pD3DDevice->SetTextureStageState(0,D3DTSS_ALPHAOP,D3DTOP_SELECTARG1);m_pD3DDevice->SetTextureStageState(0,D3DTSS_ALPHAARG1, D3DTA_TEXTURE);m_pD3DDevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);m_pD3DDevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);m_pD3DDevice->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);m_pD3DDevice->SetFVF(D3DFVF_XYZRHW|D3DFVF_TEX1);For anything below DirectX 9, the use of SetFVF at the end wont probably work, but I could be wrong. I believe the function for SDK's below DX9 is m_pD3DDevice->SetVertexShader(D3DFVF_XYZRHW|D3DFVF_TEX1);I would read a few books on this to help clarify your questions further.Cheers!-Dyamios   ;  Thank you very much, I will try it tonight.It seems easy.   ;  My personal preference is using a magenta colour key, since I hate the way layers are done in Paint Shop Pro. Then it's just a case of passing the correct colour to D3DXCreateTextureFromFileEx().   ;  Personally, I prefer to use a file format with an alpha channel built in.  That way, what your graphics program thinks is transparant just is transparent, and you don't have to worry about the magenta getting messed up a little around the edges or anything.  Plus you can feather the outmost pixels for free.   ;Quote:Original post by Danny GilbertThank you very much, I will try it tonight.It seems easy.You're quite welcome!Cheers!-Dyamios   