Game Development Community

Blending with a mask

by hucomp · in Torque Game Builder · 12/02/2009 (4:35 am) · 1 replies

Hi folks!
Consider the following layers of an image:
i47.tinypic.com/egu6jd.gif
I need to make a texture transparent in a certain place with a shape of a mask. In a place where texture would be transparent, fragments of underlying animation should appear.
Lots of experiments with different combinations of source and destination blend factor didn't succeed, unfortunately. I do read carefully blending tutorial but without good examples it's hard for understanding.

Maybe somebody has good experience with blending and could advise how to achieve effect that I need?
Which combination of factors to use?
Which part of mask should be transparent, which colors to use on the rest area?
Is there any other way to make texture transparent with underlying animation?

#1
12/02/2009 (6:08 am)
Just using the blend factors in the editor won't do it
You will have to use the sources and modify the stuff there, make new blend modes and potentially implement multitexturing to get distinct mask + underlying texture.

whats commonly done without modification is that you take the alpha channel of the mask and apply it to the underlying image and then use the "alpha blend" on it (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

with 3 images it will get even more complex and you can no longer avoid implementing an own solution