Jump to content
  • Advertisement
Sign in to follow this  
Eldritch

Problems with blending

This topic is 3592 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

Hi all! I am having some problems with some alpha blending functionality that I am trying to work with. I will try to explain it all as best I can without any images (don't have anywhere to upload to). First off, I have one texture (128x128) which represents an image (can be anything). This texture is RGB. Second, I have an RGBA texture representing a filled circle in the middle. What I want to achieve is this: I want to render the RGB image (first) with the second (RGBA) image so that only the part of the first image that "can be seen" in the circular area of the second image is displayed, the rest is fully transparent (the alpha channel of the second image has this layout, that the outer parts are transparent). I know I can achieve this by using an alpha channel in the first image, but that is not what I want to do. Anyone got any good tips?

Share this post


Link to post
Share on other sites
Advertisement
I'm no expert, but if I recall correctly, you can just turn off the depth test for that draw, so that the fragments beneath the hole aren't thrown out.

Share this post


Link to post
Share on other sites
Google for multitexturing. Basically you bind both textures at the same time to different texture units and set up two sets of texture coords. The final RGBA value will be texture1RGBA * texture2RGBA, so your mask texture just needs to be a white circle with an appropriate alpha texture.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!