Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Alpha Channel is Lost

Author
Message
Bulleyes
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 13th Jun 2004 17:41
blah.tga shown below is an image with alpha channel. When I try to load it like the following,

load bitmap "blah.tga", 1
set current bitmap 1
get image 1, 0, 0, bitmap width(1)-1, bitmap height(1)-1
set current bitmap 0

The alpha channel no longer exist in the image #1. It could be either load bitmap doesn't load the alpha channel, or get image does't copy the alpha channel from the bitmap.

What I need to do is the ability to cut a certain portion of the TGA file as an image, while still preserving its alpha channel.

Any help will be appreciated. Thanks!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Mussi
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 13th Jun 2004 17:51
I believe the get image command doesn't copy alpha channels.
load the .tga file in as an image and use the memblock commands to cut a certain portion of.



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 13th Jun 2004 18:29
It's not the GET IMAGE that's at fault here. Bitmaps don't have an alpha layer, so when you load an image that does have one, it gets dropped when it's loaded

*** Coming soon - Network Plug-in - Check my site for info ***
For free Plug-ins, source and the Interface library for Visual C++ 6, .NET and now for Dev-C++ http://www.matrix1.demon.co.uk
Bulleyes
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 13th Jun 2004 20:44
Yeah, I am trying to use memblock to copy the image like what Mussi suggested. Strange, the image doesn't copied fully as I expected. I tried the most straightforward case, like the code below,



What I expect is I should get the same texture. But the output is, I get only part of the texture on the plain object.

Any ideas?

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Mussi
22
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 13th Jun 2004 21:39
try running your program in 32-bit mode



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 80GB HD 7200rmp U133, Geforce 4 Ti4400 128mb
Bulleyes
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 13th Jun 2004 21:54
Nope, it doesn't help.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
las6
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Finland
Posted: 13th Jun 2004 22:25
Quote: "What I expect is I should get the same texture."


what size is your texture?
I'd recommend keeping them at power-of-2 sizes. for example: 32,64,128,256,512 x 512.
Otherwise DBpro will either scale the texture or add empty areas when you texture an object with it. the extra ",1" command in load / get Image and I think in make image from memblock too will affect this, as it stops DBpro from making mipmaps from the texture. To be able to generate mipmaps, the texture needs to be in power-of-2 size, and DBpro will do that for you unless you stop it.


| Keyboard not detected. Press F1 to continue. |
Bulleyes
22
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 14th Jun 2004 06:19 Edited at: 14th Jun 2004 06:42
Thanks las6! It works when I change my texture to a power of 2 size, or load the image with the 1 flag. But I still don't get it why does it behave this way? I don't understand why do I get partial texture on my object if I don't do these. What I am curious is, the first two dwords in both memblocks still return the actual image size, even though only partial texture appeared on the object.

Thanks!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
las6
22
Years of Service
User Offline
Joined: 2nd Sep 2002
Location: Finland
Posted: 14th Jun 2004 13:17
Quote: "I don't understand why do I get partial texture on my object if I don't do these. "


Dunno about that. I usually get the texture, and then empty space (black) around it to make it a power-of-2 sized texture.
Guess it's somekind of workaround, so don't expect perfect results.

It's just a lot easier to keep everything in the power-of-2 sizes. When you do need a differently sized image, just add black borders and edit the model UV's to reflect that.


| Keyboard not detected. Press F1 to continue. |

Login to post a reply

Server time is: 2025-05-28 03:27:36
Your offset time is: 2025-05-28 03:27:36