Mix two image with alpha map

Oct 24, 2011 at 11:48 AM

dear sir:

for exmaple, I have a background bitmap; a foreground bitmap; and an alpha bitmap; how to do : 

foreground * alpha + background * ( 1 - alpha )

this expression is usual 3D game mix two textures to the final texture.

thanks a lot.

Oct 24, 2011 at 12:22 PM

I'm afraid you cannot do that with xTile: all tiles within a layer are rendered using either standard alpha blending or additive blending. You cannot specify a separate alpha channel, other than the one implicitly stored in your PNG tile sheet images.

Oct 24, 2011 at 12:44 PM


If I select just "alpha"

is it say that the current expression is :              Foreground * (  Foreground. alpha channel ) +  Background *( Background . alpha channel )

or         Foreground * (  Foreground. alpha channel ) +  Background *( 1 - Foreground . alpha channel )

Colinvella, thanks for your time 

Oct 24, 2011 at 1:39 PM

The second one for Alpha blended tiles

The first one for Additive blended ones

You can set the blend mode of each tile individually. By default all tiles are Alpha blended

Oct 25, 2011 at 5:48 AM

I see, thanks.

Oct 27, 2011 at 3:34 AM

Your project is very well.

Now, I use your .tide map in my ActionScrip project as background map.

I suggest that convert your .tide XML attribute name from "TileSheet Ref" to "TileSheetRef",  Adobe AS3 is ugly, AS3 read this attribute name just "Ref", lost the string before space.

Thans for your time.

Oct 27, 2011 at 8:11 AM

I'd rather not change the .tide format, unless there's a very valid reason, as it would otherwise break the loading of older maps.

You could perhaps do a simple string search-and-replace operation prior to parsing the map XML. Alternatively, you can save a copy of your map to the Flixel format. This creates a .txt file for each layer of your map, which you can render using the Flixel engine for Flash.