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 / Image transparency problem

Author
Message
Gunslinger
19
Years of Service
User Offline
Joined: 29th May 2007
Location:
Posted: 9th Feb 2012 02:00
Hello,
i got a small problem with my images.
First try as PNG:

load image "xyz.png", 222, 1
paste image 222, 0, 0

Problem: My transparent background (in photoshop) is all black now.

Second try as bmp:
Saving my bmp in photoshop with a green (0,255,0) background

set image colorkey 0, 255, 0
load image "xyz.bmp", 222, 1
paste image 222, 0,0

Background still black too.

I have no clue what i'm doing wrong.
I searched all threads in this board, nothing helps.
If i open the png image with the windows image viewer, its transparent.
if i open the bmp, the background is still 0, 255, 0.

So i think it must be the code.

Anyone?
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 9th Feb 2012 02:38 Edited at: 9th Feb 2012 02:55
A PNG in photoshop must be on two layers. Then on the bottom layer click the little eye to hide the bottom layer. Then save it.

EDIT: oh wait, you pasted it. I think set sprite fixes that. Yes, just tested it, and it works. make your images sprites, use set sprite, and paste them, now they are transparent.

Gunslinger
19
Years of Service
User Offline
Joined: 29th May 2007
Location:
Posted: 9th Feb 2012 03:33
Working perfect, thanks
Ramon156
14
Years of Service
User Offline
Joined: 13th Jul 2011
Location: Netherlands
Posted: 19th Apr 2012 00:34
I save as *.BMP with a black background to use transparency. Using the sprite command works great, but there are several things.

1 )*.BMP is LARGE in file size. 4,2MB versus 800KB TARGA (same file)

2) Making parts in the file black goes transparent wich is pretty annoying if you want that part to be shown on screen. Black text etc.

I've tried using the TGA files with black and transparent "color" to be transparent but I can't get this to work properly. The transparency just shows up black in game, blocking my whole screen.

Hope someone can help as the above posts are not working for me.

+ having a *.BMP pasted on a plane as blood splats works good, but the plane is not transparent and shows up grey. Any help is greatly appreciated.
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 19th Apr 2012 00:47
Just so you know, if you add an extra parameter to the 'paste image' command then you can use the PNG transparency without needing sprites. e.g. 'paste image 222, 0, 0, 1'.

As for using the image with transparency as a texture as I believe Ramon156 is talking about, simply use the 'set object transparent' command. The first parameter represents the object ID and the second parameter represents the transparency mode out of, I believe, 6 possible modes. 2 and 4 seem to generally work best for alpha transparency from memory.


Previously TEH_CODERER.
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 19th Apr 2012 01:08
set object transparency
Andrew_Neale
16
Years of Service
User Offline
Joined: 3rd Nov 2009
Location: The Normandy SR-2
Posted: 19th Apr 2012 02:02
Apologies. I actually typed that at first and then changed it. *facepalm*


Previously TEH_CODERER.
Ramon156
14
Years of Service
User Offline
Joined: 13th Jul 2011
Location: Netherlands
Posted: 19th Apr 2012 16:13 Edited at: 20th Apr 2012 15:16
Thank you!
As you guys described it should work, but if PS does not save transparency with stock settings in a TGA file it's kinda impossible!! )
That was also the problem I was facing.

Here's a link for anyone with the same problem in PS to save transparency in a TGA file.

http://tutorials.robbiegee.com/ps_tga.htm


Edit -
Also a nice video on youtube that explains on how to do this.

http://www.youtube.com/watch?v=FjkYaMZGAeU

You don't necessarily need to open a file, you can also create a new file and use this way to set transparency in the TGA.


Maybe that was very newbie-related but this had me going for a few days.


Another small addition. When you place a plane on the exact same position on a polygon from a wall you can encounter textures fading and glitching. You could fix this by moving it as little as 0.1 from the wall, creating a very itty bitty tiny gap between the wall and the plane. But my guess is there should be an easier way to get this done?
I've tried every option in the set transparency command.
2,4,6 seem to give the best result.

Login to post a reply

Server time is: 2026-07-11 12:00:01
Your offset time is: 2026-07-11 12:00:01