Jump to content
  • Advertisement

Archived

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

NotTaxes

ALPHA

This topic is 5937 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Howdy, Can someone tell me how to change the alpha value of a single pixel in DX8 texture? Ideally I would like to merge an alpha texture with a normal texture, but if it has to be done on a per-pixel basis that''s also fine. I already know how to use the texturestages to blend textures together and how to use the material settings to change the alpha of an entire texture. What I''m trying to do is optionally change the transparency of individual pixels in a texture before I render it (for example, a glowing portal where the center of it pulses with more or less transparency). I can use multiple textures and just animate, but it''s really tedious to create all those textures just to create an effect this simple! Thanks

Share this post


Link to post
Share on other sites
Advertisement
This thread is getting close to the answer to your question...

http://www.gamedev.net/community/forums/topic.asp?topic_id=90479

www.lp.org

Share this post


Link to post
Share on other sites
quite simple, just do a LockRect() on the texture, change the alpha values (it should be a 32bit texture), then Unlock() the texture. as long as you dont try reading from the texture, this should be pretty fast (as long as you dont do this for too many textures and try to only update when needed), memory efficent, and more compatible across video cards compared to using things like pixel shaders. if you feel that you need the previous alpha values to calculate the new values, then keep a local copy of the texture in a buffer(ie not a d3d8 texture, but a simple malloc''d or new''d buffer). this ensures that you dont get penalized for reading from vram (which is pretty heavy). also make sure you do all modifications during one lock per frame, too many locks will slow things down. especially when there is no need for it. you should know how to read and write 32bit argb values from a dx surface, otherwise you better do some research on that as well (its quite simple).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!