Archived

This topic is now archived and is closed to further replies.

HellRiZZer

Blending Textures...

Recommended Posts

How can I blend textures together with a mask as shown at http://www.flipcode.com/tpractice/issue05.shtml ? Is it the same as NeHe''s lesson 27 or 30? Please direct to the tut that has blending with mask please.. Thanks.

Share this post


Link to post
Share on other sites
I think I''d do it by giving one texture the mask as an alpha channel and then blend the two textures together with SRC_ALPHA, ONE_MINUS_SRC_ALPHA. (Or the multitexturing equivalent of that, which should be a lot faster.)

Or do you mean, actually blending the textures together into a new texture which you can render? That would have to be done in software I suppose. Just do ResultPixelColor = Texture1PixelColor * MaskPixelColor + Texture2PixelColor * (1 - MaskPixelColor) for each pixel in the textures. (Assuming they''re of equal size and that the color values range from 0 to 1.)

Share this post


Link to post
Share on other sites