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.

Newcomers DBPro Corner / Is alpha-channeling possible in 3d?

Author
Message
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 28th Jun 2003 20:28 Edited at: 28th Jun 2003 20:34
Fact
.PNG images have alpha transparency. This can be used as a sprite with the command set sprite alpha 1,255 .

Question
However how do you do this with a textured 3d object? And dont say ghost object on coz that sucks .

Thanks in advance (just realised that if u highlight this smily it goes sad, isn't that cool?)
Uriel The Ignoble
21
Years of Service
User Offline
Joined: 13th Jun 2003
Location: In a tiny box in the attic
Posted: 29th Jun 2003 01:16
whats wrong with ghost object? i think its spiffy ^_^

Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 29th Jun 2003 10:40
Ghost object makes everything semi-transparent, and you cant use the colour black, basically it looks crap. On the other hand .PNG images allow you to have a lot more control of this, a good example of this would be The Magic Land game.

Is it not possible?
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 29th Jun 2003 13:05
I just read the tutorial on the "blue background" and sprites. It says that DirectX 8.1 now renders sprites just as if they were a 3d object, or plain. Hence if sprites can use alpha channeling, why not objects?
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 29th Jun 2003 13:19


This is to try an examplain what I mean. Both images of the "1" are the same, however one is a sprite and one is an object. See the difference?
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Jun 2003 15:17
SET OBJECT TRANSPARENCY is what you are looking for I believe
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 29th Jun 2003 16:29
On the other hand, if it's a true alpha channel you want and not simple transparency you need to use the following code:



The RGB value for the colorkey is the same as the one you used in the alpha channel so it must be a grey colour. For example if you used 128, 128, 128 in your image then you'd have a nice translucent image. Also, alpha channels only work for PNG, TGA and TIF files.

Using your above example, I'd put something like this:



"Computers are useless they can only give you answers."
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 29th Jun 2003 20:51 Edited at: 29th Jun 2003 21:06
Thanks for the replies. Yes it does do 'alpha channeling' , however theres a catch . It sort of screws it up a bit.



I think it might have something to do with the order in which they are drawn...

Thanks again!
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 29th Jun 2003 21:55 Edited at: 29th Jun 2003 22:05


Thats a pic of driving backwards. Interesting... Hmmmm...
They only messs up in one direction, and for some reason one of them is in the opposite direction to the rest. Any thoughts (or facts) on the subject are extremely welcome?

I have tried commands such as disable zdepth, but it doesn't help. Do you think this might be a bug :-Y ?
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Jun 2003 09:20
What exactly do you want it to look like?

"Computers are useless they can only give you answers."
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jun 2003 10:01
interesting effect none the less.

could you describe the method your using to acheive this result?

Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 30th Jun 2003 11:49 Edited at: 30th Jun 2003 11:49
@Exeat
I want it to look always the same, and like the one when it goes backwards.

@indi
I made an example project showing the way I acheived this result.
It includes everything and is only 5kb, please have a look.

ftp://dbpro:dbproiscool@zdtech.sytes.net/dbforum/Alpha-channeling.zip

Thanks
indi
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: Earth, Brisbane, Australia
Posted: 30th Jun 2003 13:40
I see the result.

Do u want to have a decal or series of plains somehow work to display the number.


I have a snippet to create plains that appear to be sprites as they are glued to the camera if this is what you mean?

If u want a plain above the object you could always use a limb or an internal limb and glue an object to it.

what result in a perfect world do you want to achieve?

Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 30th Jun 2003 13:45
umm... i don't know what your really after at, but if u want to texture an object and don't want the black parts of the textures to apear use the following code:



Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 10GB HD, Riva TNT2 Ultra 32mb
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 30th Jun 2003 14:30 Edited at: 30th Jun 2003 14:33


What I am trying to get at...

The speedometer (in the picture above) is a sprite and shows the image has alpha-transparency and proves that the image works.

I want to have mud spraying up from the back of the car.
I want to use alpha transparency on the mud particles.
I do not want to use ghost object.

So I textured the mud objects with the same number "1" texture (which I have just proved worked, however in the final game it will be a picture of dirt), testing to see if alpha transparency works on objects, just like it does on sprites. And it does not.

As you can see from the image (above), alpha transparency works for the first object but when you have move than one object (with alpha transparency enabled) behind each other, it messes it up. In other words when they overlap, it screws up.

So here's the question...

Forget the speedometer, how do I apply an alpha-transparent image (.png) to an object and not get messed up results like the picture above when they overlap?

Thats all, Thanks!
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 30th Jun 2003 14:39
Has anyone download the example I made?
All I want to know is how to get rid of the funny outline around the number ones. I have the feeling this is a bug, perhaps I will e-mail rich .

Anyone?
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Jun 2003 16:55
Hold on a minute, I'll take a look at your example.

"Computers are useless they can only give you answers."
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 30th Jun 2003 17:24
Unfortunately I've never seen anything like that, I even removed the alpha channel completely and just made the black area transparent and it still has those crappy outline things. The strangest part is that it doesn't show up from certain angles so I have no idea why it happens, sorry.

Might be a bug, so Lee@DarkBasic.com would probably be the person to email. Make sure to include the example code and a thorough description of what should and shouldn't happen.

Also, tell me if he ever finds a solution because I'd really like to know what's wrong now lol.

"Computers are useless they can only give you answers."
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 30th Jun 2003 19:04
Thanks Exeat, yeh I probably will e-mail rich.
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 30th Jun 2003 19:29
Ok, I just sent him an e-mail, hope its in the next patch
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 1st Jul 2003 08:08
Uhh yeah Rich probably isn't the person to email, he's just the webmaster. Too late now though, I'm sure he'll forward it to Mike though.

"Computers are useless they can only give you answers."
Oliver
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: Switzerland
Posted: 1st Jul 2003 17:00
Well I sent it to Lee@DarkBasic.com, surely thats not rich or mike's e-mail address? :-s
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 1st Jul 2003 17:32
the problem lies in your image. you've included a shadow in your image which makes yout graphic card to see that the shadow is part of the "1". so thats the reason why it looks so weird when 2 images overlap each other. i suggest to don't use shadow for images that gonna overlap each other.

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 10GB HD, Riva TNT2 Ultra 32mb
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 2nd Jul 2003 04:51
Fair enough Oliver, I thought you emailed it to Rich when you said: "yeh I probably will e-mail rich.",

And that's not true Mussi, I created another image completely from scratch without the alpha channel and still got the same effect.

"Computers are useless they can only give you answers."
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 2nd Jul 2003 15:10
:-s

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 10GB HD, Riva TNT2 Ultra 32mb

Login to post a reply

Server time is: 2024-09-20 13:34:55
Your offset time is: 2024-09-20 13:34:55