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 / Transparency won't work!

Author
Message
Witch Bomber
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 29th Oct 2003 00:33
I am using a 3d model in a 2d platform game. I use the "set camera to image" command and then paste the image to the screen each loop.
The problem is, I have a black square around my object on the screen. If I set the transparency flag to one, it makes no difference, the black pixels are still drawn. If I set the camera backdrop to a color and then set the image colorkey to that color these pixels are still drawn. What do I have to do to only see the object and not the backdrop?

The leprechaun tells me to burn things
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 29th Oct 2003 00:58
I believe the trouble is that you do not have a pure black background, make sure the background is RGB(0,0,0)

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
Witch Bomber
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 29th Oct 2003 01:05
That's not the problem.
I've tried

and it doesn't work. the square (which is definitely rgb(0,0,0) - I've tested with the point command) is still there!

The leprechaun tells me to burn things
Codger
23
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 29th Oct 2003 01:24
One last thing

replace
Paste image Image Number,x,y,1
with
Sprite Sp#,x,y,Image number

System
PIII 650 MZ H.P. Pavillion
394 Mem GeForce 4 400MX
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 29th Oct 2003 01:28
Unfortunately for you, DBPro only adds the transparency/alpha levels when you use GET IMAGE or LOAD IMAGE.

I would suggest that you use a little routine that I've written to reset alpha levels in images, but I know that currently DBPro won't let you convert an image to a memblock if it's in use by a camera view.

About the only thing that I can think of is to paste the image to a background bitmap, use GET IMAGE to pick it back up again (adding the alpha levels) then paste it back to the main display with transparency. This would kill your framerate though.

It seems that I'm just full of bad news today
Witch Bomber
23
Years of Service
User Offline
Joined: 25th Jan 2003
Location: Scotland
Posted: 29th Oct 2003 01:36
Thanks IanM!
I just realised how to do it.
I first of all set the camera view to the bottom corner of the screen (fortunately the object isn't very big on screen)
At the start of the loop, before the cls command, I use get image so I am effectively putting the output from the camera into the image, except since it is using the get image command the transparency now works.

The leprechaun tells me to burn things

Login to post a reply

Server time is: 2026-07-26 16:04:14
Your offset time is: 2026-07-26 16:04:14