6 registered members (AndrewAMD, rki, Mino, Martin_HH, squik, Ayumi),
1,126
guests, and 7
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
bmap_to_alpha does not work after pixel_to_bmap.
#311332
02/19/10 15:18
02/19/10 15:18
|
Joined: Jul 2007
Posts: 53 Germany
Henning
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2007
Posts: 53
Germany
|
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.
|
|
|
Re: bmap_to_alpha does not work after pixel_to_bmap.
[Re: jcl]
#312502
02/25/10 08:33
02/25/10 08:33
|
Joined: Jul 2007
Posts: 53 Germany
Henning
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2007
Posts: 53
Germany
|
Hello Jcl,
thank you for the quick response, but using prepared alpha maps does not solve my problem, because I want to generate the ground textures at run-time. I have a 24x24km area and a feature map showing yellow for main roads, grey for secondary roads, blue for water, two shades of green for wood and so on. From this I want to calculate 8 different alpha maps for the multi-texture terrain. But besides that I am a little afraid that it might have too much impact on FPS. So, as a workaround I prepared normal tex maps by hand, but that does not look so good.
Best regards Henning
By the way, A7 is a great tool, exactly what I looked for since 25 years, when I started with VRML.
|
|
|
Re: bmap_to_alpha does not work after pixel_to_bmap.
[Re: jcl]
#316450
03/24/10 09:05
03/24/10 09:05
|
Joined: Jul 2007
Posts: 53 Germany
Henning
OP
Junior Member
|
OP
Junior Member
Joined: Jul 2007
Posts: 53
Germany
|
Or create a new 32-bit BMAP with bmap_create(...), and use it as write target. That would be the normal way to manipulate a source image and save it under a different name. Perfectly, that works. Thanks.
|
|
|
|