View Full Version : Blending clouds and sun

05-29-2002, 02:03 PM
I have a bitmap containing clouds (blue background with white clouds) and a sun (black background with white sun). How can I blend these to give the effect of the clouds going over the sun but the sun coming out when it goes over the clouds' blue background?

05-30-2002, 02:02 AM
okay, if u just have a sky plane... it's pretty easy

draw two quads on the "ceiling":

farther one will have the sun texture mapped onto it blackpixels => alpha=0 there else alpha=1

closer quad: map the cloud texture to it, alpha=(red+green intensity)/2.0
//this'll make the blue pixels have alpha=0, and white pixels alpha=1 etc http://www.opengl.org/discussion_boards/ubb/smile.gif

and u should be done

won't be the best looking, but u should be done

if u want to learn about good cloud stuff http://www.gamedev.net/community/forums/topic.asp?topic_id=86024

btw, i don't check this forum often... so if u have a question or something e-mail me.

05-30-2002, 10:49 AM
Thanks a bunch, I will give this a try.