Masking + Fog.....

Hi All,
Having some problem when masking a few textures with fog enabled. Actually, i am masking some textures over some previous textures (as if masking textures in real world). 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.

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

Use destination alpha for the mask and when you compute the fragment color use destination alpha to blend the incomming color with what’s in the framebuffer.

(dst_alpha, one_minus_dst_alpha)

There are other options but it depends a lot on what you’re doing. Blending is a flexible operation so it helps if yo understand exactly what you want w.r.t. the arithmetic before planning your passes & blending.

[This message has been edited by dorbie (edited 02-05-2004).]