Hello,

I tried to make a multitexture terrain by reading a color coded feature map, convert each feature area to an alpha map and apply this with the proper texture on the terrain. I.e. where the feature map has blue color, water texture will show.

But after painting white color pixels onto a map, it cannot be converted to an alpha map with bmap_to_alpha. It works, when you do not paint on that map before. I tried several workarounds, store and reload the map, bmap_blit it to another name, etc.
The only working solution is to create a new one with bmap_create, but then - surprise - it is upside down.

So, I think I found two problems. No reports anywhere in the forum.

Version: Commercial 7.82
Here some code (inputPic should be black at 1,1, elsewhere some color):

#include <acknex.h>
#include <default.c>

BMAP* inPic = "inputPic.tga"; // 32x32 pixel, 24 bit tga, no alpha
//BMAP* wAlpha = "lila.tga";
BMAP* wAlpha;
var format;
var wPix;

function main () {
wait (1);

format = bmap_lock (inPic,0);
wPix = pixel_for_vec (vector (255,255,255),100,format);
pixel_to_bmap (inPic,1,1,wPix);
bmap_unlock (inPic);
bmap_save (inPic, "output1.tga");

wait (-1); // give some time for saving

wAlpha = bmap_create ("output1.tga");
// bmap_blit (wAlpha,inPic,NULL,NULL);

bmap_to_alpha (wAlpha, 100); // now 32 bit with alpha
bmap_save (wAlpha, "output2.tga");

sys_exit (NULL);
}

I would be pleased to get a simpler solution.