View Full Version : Masking + Fog

01-28-2004, 06:51 AM
Whenever i mask a textures (mask + original) and keep fog enabled it gets coupled with the textures and i dont get proper mask image. The fog needs to be disabled for both cases to solve this problem as, if enabled it couples with both the textures. can anyone suggest a technique to solve this problem.
i have used the
glBlendFunc(GL_DST_COLOR,GL_ZERO) and glBlendFunc(GL_ONE, GL_ONE)
for puttin the mask and the original image respectively.

01-29-2004, 06:03 AM
It depends....

Alternately put the mask in destination alpha where your blend would look someting like (GL_DST_ALPHA, GL_ONE_MINUS_DST_ALPHA), but it's difficult to know what you want based on your description. If it's merely to mask contributions then the source alpha should work for. If you want to mask in additiona to doing additive blending as it seems might be the case then (GL_SRC_ALPHA, GL_ONE) should do the trick.

01-30-2004, 05:21 AM
Actually, i am masking some textures over some previous textures. for this i am using the traditional .. (black on white background) mask and the (object on black background) original image. For the mask image...the fog can be disabled and does not cause a problem..however for the original image (object on black) the fog calculations on the black background change its color and it does not get blended correctly...hence we see background of the texture in some colour (something like when fog coloured image is blended on similar other image). The object on the image disappears proper due to fog (just the "background blending" is causing some problem). I also tried some of the blending techniques but could not solve the problem. Hope someone could suggest a technique.

01-30-2004, 09:06 AM
I thought i would also put some screens. http://commandos3.gamerspulse.com/rr/photon/fog+mask1.jpg http://commandos3.gamerspulse.com/rr/photon/fog+mask2.jpg