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 / PNG not able to have transparency so using black.. but doesn't work either

Author
Message
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 28th Jun 2013 21:53 Edited at: 28th Jun 2013 22:05
I made a PNG. I tried it with transparency and it didn't work. So I used the PNG while using a black background with no transparency.. but that doesn't work either




I'm using this image.



The set object command with the 3rd paramiter set to 1 is supposed to make anything that is black in the image to be transparent according to the DarkBasic Pro help. But I can't get it to work. Any ideas ?

This is what I see. Keep in mind, there is supposed to be stars shining around that sun. but instead you see the stars fade out do to the Plain covering it up. I want only the sun to show, not all of the whole picture.



Here is another picture to explain better what I mean.. taking away the stars and turn the background white and you can see that the SUN plain is not transparent like it should be.

Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 28th Jun 2013 22:13
No worries; you simply have to switch on object transparency; and export a normal PNG file with an alpha channel.

Use this function: SET OBJECT TRANSPARENCY objectID, mode

See documentation for mode settings. Zero will make the object opaque.

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 28th Jun 2013 22:18 Edited at: 28th Jun 2013 22:25
Quote: "No worries; you simply have to switch on object transparency; and export a normal PNG file with an alpha channel.

Use this function: SET OBJECT TRANSPARENCY objectID, mode

See documentation for mode settings. Zero will make the object opaque."


That's the problem, I did all that. It didn't work. I used a transparent PNG file for it the first time I tried all this. So I remade this image I posted in the OP because the DBP Help says to make the transparent areas black. Well that didn't work either.
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Jun 2013 22:25
I don't know why your set object command doesn't work. But here is a alpha transparent version...

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 28th Jun 2013 22:25 Edited at: 28th Jun 2013 22:30
I'll try that now. Thanks Pincho.

EDIT UPDATE : @ Pincho - Your PNG wont even load in windows viewer or GIMP.

I'm using DBP U77
Pincho Paxton
23
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Jun 2013 22:31
It loads in my widows viewer. I don't have gimp.

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 28th Jun 2013 22:33 Edited at: 28th Jun 2013 22:34
OK I remade another texture.. But this time took your advice and set background transparent. This time it worked. Not sure why or how, but it does.



Thanks for the help guys.
Chris Tate
DBPro Master
17
Years of Service
User Offline
Joined: 29th Aug 2008
Location: London, England
Posted: 28th Jun 2013 22:51 Edited at: 28th Jun 2013 22:54
The reason is because the SET OBJECT command's transparency feature is completely different to the SET OBJECT TRANSPARENCY feature. The SET OBJECT command will render all non-zero (black) pixels; the SET OBJECT TRANSPARENCY command sets how to use the alpha channel of the image.

Even if your original method worked, most of the dark pixels would still be visible since all of those grey tones are not black.

At least that is what it seems, what API functions have been used in these commands and how, can only be answered by a TGC developer or the source code in the open source library.

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 28th Jun 2013 22:52
Yea I am looking more into this for future reference. Thanks for the info. I have bookmarked this thread.
wattywatts
17
Years of Service
User Offline
Joined: 25th May 2009
Location: Michigan
Posted: 29th Jun 2013 00:02
For future reference you could also just ghost object on and set object light and ambient to 0 since ghost object doesn't display black.

http://mattsmith.carbonmade.com/
Mobiius
Valued Member
23
Years of Service
User Offline
Joined: 27th Feb 2003
Location: The Cold North
Posted: 29th Jun 2013 00:44
Quote: "since ghost object doesn't display black."

Ghost object can do negative alpha-blending.

This is my current project, check it out! [href]forum.thegamecreators.com/?m=forum_view&t=204576&b=8[/href]
This is my website, check it out! [href]http:\\www.TeamDefiant.co.uk[/href]
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Jun 2013 13:34 Edited at: 29th Jun 2013 13:35
You all seem to have overlooked the fact that the original PNG file doesn't have an alpha channel. (According to MicroSoft's DXTex viewer and Texture Maker anyway. )

Here's the same image with alpha added (using Texture Maker):

JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 29th Jun 2013 14:54 Edited at: 29th Jun 2013 14:55
Quote: "Green - You all seem to have overlooked the fact that the original PNG file doesn't have an alpha channel. (According to MicroSoft's DXTex viewer and Texture Maker anyway."


Actually my friend it's you who overlooked...

I wrote this in an above post.

Quote: "I used a transparent PNG file for it the first time I tried all this. So I remade this image I posted in the OP because the DBP Help says to make the transparent areas black."


Thanks for trying to help though.
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 29th Jun 2013 16:30 Edited at: 29th Jun 2013 16:31
Here's the corrected image, with alpha channel and without the color distortion.


chafari
Valued Member
20
Years of Service
User Offline
Joined: 2nd May 2006
Location: Canary Islands
Posted: 29th Jun 2013 16:37
Hi there.
Some time ago, I tried to make an animated gif to work setting object transparency, but gif didn't work as I expected, so I made something like this...I hope it can help




I'm not a grumpy grandpa
Green Gandalf
VIP Member
21
Years of Service
User Offline
Joined: 3rd Jan 2005
Playing: Malevolence:Sword of Ahkranox, Skyrim, Civ6.
Posted: 29th Jun 2013 18:13
Quote: "Actually my friend it's you who overlooked..."


I'm obviously spending too much time in the garden and not enough time studying what's been said - that's two days in a row I've made a daft post.

Quote: "Thanks for trying to help though."


It can get rather trying at times though.

Quote: "Here's the corrected image, with alpha channel and without the color distortion."


That's what happens when one does things in a rush. Thanks for correcting that detail.
JackDawson
14
Years of Service
User Offline
Joined: 12th Jul 2011
Location:
Posted: 30th Jun 2013 04:55
That's awesome guys. Thanks for the comments and the image help.


I posted in another thread about making the SUN from scratch. But.. its an utter fail.. need help on that one if you can.

http://forum.thegamecreators.com/?m=forum_view&t=206427&b=1
Mage
Valued Member
19
Years of Service
User Offline
Joined: 3rd Feb 2007
Location:
Posted: 30th Jun 2013 05:00
Quote: "That's what happens when one does things in a rush. Thanks for correcting that detail."

You had the better idea of fixing it in the first place.

Login to post a reply

Server time is: 2026-07-06 18:37:48
Your offset time is: 2026-07-06 18:37:48