Sign in to follow this  
Eldritch

Problems with blending

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

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this