Blending two images

Hi, i would like to blend two images (the first is the base image, the second is a b/w image), and let the b/w image to act as a alpha map.
Any suggestion ?

Please don’t crosspost.

I believe i did not.

Originally posted by penetrator:
I believe i did not. ??

Oh well, if posting the same question on another forum of another web site around the world is considered cross-posting than … i did.

Use the R value (G and B would be the same) to control the alpha value of the incoming fragment in your fragment shader.

first texture lookup fetches the color fragment from your original image (call it say, fragcolor)
second texture lookup fetches the equivalent grayscale fragment (call it say, fragbw)

then set fragcolor.a = fragbw.r.
the closer the grayscale fragment is to white the more opaque your output fragment.

I think that should work.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.