View Full Version : blending two images
12-31-2004, 07:33 AM
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 ?
12-31-2004, 03:46 PM
Please don't crosspost.
01-01-2005, 02:13 AM
I believe i did not.
01-01-2005, 05:34 AM
Originally posted by penetrator:
I believe i did not. http://www.gamedev.net/community/forums/topic.asp?topic_id=291545 ??
01-01-2005, 06:34 AM
Oh well, if posting the same question on another forum of another web site around the world is considered cross-posting than ... i did.
01-03-2005, 05:27 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.