XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Help or ideas please: Performing Color addition of one 2d texture over another.

Last post 9/18/2009 6:21 AM by Magesterium. 2 replies.
  • 9/15/2009 8:54 PM

    Help or ideas please: Performing Color addition of one 2d texture over another.

    Is it possible to perform a color addition effect on a defined section of a Texture2D item?

    I have built a tile engine for a 2D top down style game (old final fantasy/Zelda types).
    I have also incorporated a weather and time of day system that modifies the the color attribute for all world items, tiles etc, depending on time of day or weather conditions. Up to this point I was pleased with the results, but now I have hit a snag.

    I want to include flickering lit up areas, one solution is to place an image and use the Alpha channel. Doing this washes out some of the colors and removes some contrast. Ideally I would like the image to perform color addition over the image below itself, maintaining contrast.

    However, I have no idea how to impliment color addition within XNA.

    Are there any methods that I might not be aware of that can support comparing two textures and adding their color values?

    Any ideas or help would be much appreciated.

    J.
  • 9/15/2009 10:03 PM In reply to
    • (2342)
    • premium membership MVP
    • Posts 1,226

    Re: Help or ideas please: Performing Color addition of one 2d texture over another.

    Are you using SpriteBatch?  If you are, you can use SpriteBlendMode.Additive to use an additive blending effect.  This will add the color of the texture being drawn with the color in the backbuffer and place the result in the back buffer.  I think this is what you're going for. 
    Matt Pettineo | DirectX/XNA MVP


    Ride into The Danger Zone | PIX With XNA Tutorial
  • 9/18/2009 6:21 AM In reply to

    Re: Help or ideas please: Performing Color addition of one 2d texture over another.

    Hurrah!
    Can't believe I missed that one! Thanks for the pointer. My brain has become mush, there are too many things I want to do with my programme.

    Cheers.
Page 1 of 1 (3 items) Previous Next