I try to blend two textures with alpha channels in a material script and apply a kind of 'peekhole' via an alpha mask.
For example, take the following textures:
box1.png

box2.png

I need to combine those texture, so they look like this:

After that is done, I want to apply an alpha mask to the material:
mask.png

So that the final texture looks like this:

Please note, that all textures are the same size (320x180).
I tried to do this with a material skript, but I was unable to achieve my goal. I didn't even manage to combine the textures box1 and box2 properly (which should be fairly easy), not to mention to apply the alpha mask.
Any assistance would be appreciated, as from this point on it will be trial and error for me, and with the extensive options the matarial scripts offer, that could take a while and would be very unsatisfying for me.
So if anyone could explain how to do this properly and/or provide a material script example, that would be great.
Edit:
With this material script I managed to display the combined textures box1.png and box2.png, but it needs two passes and the alpha mask is still missing. I'm sure it can be done in a single pass, using multi-textures, but I don't know how.
Code: Select all
material /test
{
technique
{
pass
{
scene_blend alpha_blend
texture_unit
{
texture box1.png
}
}
pass
{
scene_blend alpha_blend
texture_unit
{
texture box2.png
}
}
}
}


