Alpha Maps with the Sprite class

Does anyone know how i would use an alpha map with the sprite class



Answer this question

Alpha Maps with the Sprite class

  • Jupek

    The Alpha channel of a sprite is set in the Sprite's Texture.
    When drawing a sprite, you should use



                            spr.Begin(SpriteFlags.AlphaBlend)
                            spr.Draw(texture, Rectangle.Empty, New Vector3(0, 0, 0), New Vector3(50, 0, 0), Color.White)                        
                            spr.End()

     


    It's your texture that will keep the alpha channels.

    Dustin.


  • gmeadows

    Right, That's done in the actual texture.

    basically, some file format support alpha channels, and some don't.  bmp supports alpha channels.

    If you open up your source textures in the SDK->Texture viewer, you can go to the view menu, and choose Alpha Channels.  If you want to get 'faded' sections of your texture, then you can paint to your alpha channel a different opacity of black to white.


  • pushpendra singh

    i was using dated texture image editors... my only bmp option is 24bit

    I loaded the bmp into the dx texture editor and then loaded the alpha map and saved as dds.


    Thanks for the help Dustin_H


  • wingba

    I already have a color key type transperency. magenta is compleatly transparent, but i want to use an alpha map so that i can make soft edges, and fades. ie Alpha, Red, Green, Blue  where the alpha value controls how transparent each pixel is.


  • Alpha Maps with the Sprite class