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 / Transparent Planes

Author
Message
Agent
21
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 18th Nov 2010 09:29
Ok this one seems like a silly question, but I just can't figure it out...

I have a plane, and it's textured with a PNG file with an alpha channel.

The transparent parts of the plane are being textured default white, instead of remaining transparent.

What?
Brk_oth
20
Years of Service
User Offline
Joined: 8th Aug 2005
Location: Australia
Posted: 18th Nov 2010 10:07
try this:
set object transparency objNum,1

No signature found...
Agent
21
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 18th Nov 2010 10:36
Yeah that doesn't work, which is what's confusing me. The color key is set to black, which is the part of the image that I want to be transparent.

What might I be missing?
Agent
21
Years of Service
User Offline
Joined: 7th Sep 2004
Location: Sydney, Australia
Posted: 18th Nov 2010 10:37
Disregard, figured it out - thanks anyway
Brk_oth
20
Years of Service
User Offline
Joined: 8th Aug 2005
Location: Australia
Posted: 18th Nov 2010 11:56
also, png's store an alpha channel, so if you set your images up right you dont need to bother with the set image color key command.

No signature found...
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 18th Nov 2010 12:27
Quote: "Disregard, figured it out - thanks anyway"

Could you share how you solved the problem? It might help someone else in the future.

Also I have problems with closure...

zappi
15
Years of Service
User Offline
Joined: 16th Oct 2010
Location: with your mother
Posted: 18th Nov 2010 15:41
try to use "ghost object on"
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 18th Nov 2010 15:46
In most (I think any image with a alpha channel it seems to work) cases using Set Alpha Mapping On obj, 100 will work.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.
Brk_oth
20
Years of Service
User Offline
Joined: 8th Aug 2005
Location: Australia
Posted: 19th Nov 2010 00:45 Edited at: 19th Nov 2010 00:47
In my game im currently working on, this is all the code I use to load and texture with an alpha channel:


@zappi
ghost object on will work, EXCEPT then your whole object is ghosted. (but if you want that effect, then its good)

@sasuke
I replaced my line of "set object transparency" with yours of "set alpha mapping on" and that does work also. That command will only give the desired effect if you are using a png with an alpha channel, otherwise its only just changing different levels of transparency on the object.
Thanks sasuke for introducing me to that command, because the ability to change the percentage will come in handy later.

No signature found...
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 19th Nov 2010 00:55 Edited at: 19th Nov 2010 00:55
What is interesting is combining the two commands:

set alpha mapping on 1,100
set object transparency 1,2

With this you can get the desired effect and control the alpha level.

A dream is a fantasy, if you achieve that fantasy it was never a dream to begin with.

Login to post a reply

Server time is: 2026-07-21 18:59:03
Your offset time is: 2026-07-21 18:59:03