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.

2D All the way! / pngs/bmp transparency

Author
Message
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 29th Mar 2004 18:47
just been playing about with the sprites and struggling to get the background transparent. I know black is transaparent but my sprites have a lot of i need to show.

ive seen (Set image colorkey red,green,blue) but this doesnt work, im using DBC. How do i set what colour i want transparancy to be?

Morloc
AJay
21
Years of Service
User Offline
Joined: 24th Jan 2004
Location:
Posted: 29th Mar 2004 19:12
Im not sure if this is what you mean, but if you open a bmp file in MSPaint, you can go into the attributes menu and change the trancparency color.


-AJay-

P4 3.2GHZ, 256MB DDR Ram, 64MB NVidea G-Force 4, Sound Blaster Live, 40 Gig HD Thanks to Coding Area

the_winch
22
Years of Service
User Offline
Joined: 1st Feb 2003
Location: Oxford, UK
Posted: 29th Mar 2004 19:18
I think set image color key is a dbpro command. If you have black in your image and want it visable you need to make it a really dark grey. Just keep increasing the rgb values of the colour until dbc doesn't make it transparant.
UnderLord
22
Years of Service
User Offline
Joined: 2nd Aug 2003
Location:
Posted: 29th Mar 2004 19:42
Well in DBP you need to use a flag when you load image it has to have like ",1,1" and i think then it will go transparent but if not mess with sprite commands i know that i think the "sprite" command will do this i think.

The search continues.

Current project - A space game
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Mar 2004 20:57
0,0,0 is transparent..3,3,3 is best for black inside sprites.

Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 29th Mar 2004 21:52
so basically i cant decide on the colour for transparency?

what about png's? does this mean i wont be able to get gradual fades to transparent?

Also how do i get opaque sprites ie like huds?

Morly

Morloc
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 29th Mar 2004 22:36 Edited at: 29th Mar 2004 22:41
You sould be able to use PNGs just fine for selective transparency and translucency.

Remember to turn off filtering when loading...

load image "my.png", imageID, 1

And turn on transparency effects for the object...

set object transparency objectID, 1

It's pretty easy to build a HUD this way as a combination of opaque, transparent, and translucent colors. Just load the texture in and assign it to a plain. [Why a plain? Because you can shake, shudder, and roll it easily.]
--
TAZ

Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 29th Mar 2004 22:47
Png's don't work in DBClassic. You can use Ghost Object in 3D, and that's all. You can make some nice effects with Ghost Object though. You can use Ghost object with plains, that will give you a 2D game with transparency, but you have to write the 2D game using 3D objects. Huds use plains with Ghost object.

Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 30th Mar 2004 00:10 Edited at: 30th Mar 2004 00:58
just look at adding an object plain and think it will work. I have it scrolling and can get the background on there as well but can i make it transparent allowing the background to show through. do i need to make the background a 3d plain as well? i tried the ghost function but it doesnt deem to go transparant

heres what i have so far



Morloc
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 30th Mar 2004 01:11
still cant get the ghost function to work . it kinda works but the fog bmp get brighter/ larger each movent until its one solid band

code is still as above atm

Morloc
zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 30th Mar 2004 07:30
Quote: "Png's don't work in DBClassic."


That bites. We need to move all the DBC questions to another web site so they don't make me look bad.
--
TAZ

Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Mar 2004 11:10
Maybe your problem has to do with set object.



MAKE OBJECT PLAIN 4,600,30
set object 4,1,0,1,1,1,1,0.........Try this, look it up, alter it.

POSITION OBJECT 4,0,-4,80
TEXTURE OBJECT 4,50
LOCK OBJECT ON 4
ghost object on 4, 5

Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 30th Mar 2004 11:54
hmm I'll try that later pincho, sounds promising. I did wonder if it was the scroll object function that was screwing it.

Also (not sure if this should be in the 3d section). say if i did go the 2d/3d way how do you get the different layers to be all the same size so when you look at it straight on they all fit 1024x768? plus where does the camera sit and at what angle (i dont want any perspective) also if i add 2d sprites into the mix where do they sit in relation to everything else. I'll try and do a sketch to explain what i mean.

Morly

Morloc
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Mar 2004 15:47
If you make a 2D game using 3D objects you make your plains the same size as the images. You leave the camera where it is. You position your plains ....x,y,z = 500. Z=500 moves the plains away to pixel sizes..(Well it does with 800*600 res) Then you point the camera at the plain, Set Camera to Object Orientation. Sprites stay the same as usual, using screen coords. If you have a background at z=500 then you can put your plains at z=499. There's no visible difference.

Pincho.

zircher
22
Years of Service
User Offline
Joined: 27th Dec 2002
Location: Oklahoma
Posted: 30th Mar 2004 22:30 Edited at: 31st Mar 2004 01:33
Pincho nailed it. Imagine you're a Disney animator working with cells. You lay down your background layers, your middle scene layers, and finally your character layer (sprites.)

Have you seen the Shadow of the Beast parallax demo?
--
TAZ

[edit for typos]

Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 30th Mar 2004 22:32
hiya im not having much luck getting the object transparant. I think im gonna have to leave it and maybe play around another time.

as for doing it in 3d layers i think ill stick to 2d after the lack of success with 3d

Morloc
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Mar 2004 23:49
Are you using a .bmp? Is it a good .bmp. Some programs like Paint have two options to save bmp's, one option messes them up, the other option works. Windows bmp's work...OS bmp's seem to mess up. Also, some graphic cards don't use transparency, but they are really old.

Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 31st Mar 2004 02:16
my gfx card is a gforce 440 so it should handle it fine. Ive just tried a bmp but it does the same thing. basically it shows the plain and it is kinda transparant but then it seems to expand as though your turn up the brilliance on it.

ive got no movement with it ie no scroll but it still does it.

can you put a snippet of code and a text graphic that you know would work so i can compare it and see if theres any difference as ive tried every combination of settings. and it wont go transparent.

you sure dbc will do transparent 3d plains?

Morloc
Morloc
21
Years of Service
User Offline
Joined: 21st Mar 2004
Location: UK
Posted: 31st Mar 2004 02:47
got it to work. I had a last stab at it and went back to basics. I think it gives weird results if you just load a bitmap. i just made the background a plain and then the fog in front and it works , it also scrolls fint too. result dont know if it help but i did read an old zircher post which was similar and said to set camera to auto off.

thanks again all.

Morloc
Tapewormz
22
Years of Service
User Offline
Joined: 15th Sep 2002
Location: Winnipeg, Mantoba, Canada
Posted: 31st Mar 2004 03:49 Edited at: 31st Mar 2004 03:50
I think color 0 on your pallet (no matter what color color 0 is) is the transparent color. For any png I've made, this is the case.

Quote: " Timesoft - Your wife is death. How? NO idea.
But it is murder. REVENGE!!!!!!!!!"

Hands down the funniest synopsis for a game ever. All your base are belong to us!

Login to post a reply

Server time is: 2025-08-09 02:11:51
Your offset time is: 2025-08-09 02:11:51