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 / AVI Transparency in DBPro

Author
Message
Qweeg
20
Years of Service
User Offline
Joined: 23rd Sep 2004
Location: Kent
Posted: 7th Dec 2004 07:25
Is there anyway to get an AVI file to display as transparent? I know the AVI file format doesn't support transparency, but I thought I could use the PLAY ANIMATION TO IMAGE command followed by PASTE IMAGE (using the transparency flag) and if the background of the AVI file was black it would in effect be transparent - see attached code and file.

But it doesn't seem to work. If not are there other animation formats that are supported that also support transaprency?

Attachments

Login to view attachments
RalphY
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: 404 (UK)
Posted: 7th Dec 2004 21:43
Have you compressed the AVI? IIRC The transparency flag will only change true black (i.e. 0,0,0) to transparent, when compressing a video (or any image for that matter) what was once black can get changed to a different RGB value due to the compression algorithm. Try compressing the video differently, or try texturing a cube with the image you are playing the AVI too and then using the set alpha transparency command.

Hope this helps.
Qweeg
20
Years of Service
User Offline
Joined: 23rd Sep 2004
Location: Kent
Posted: 8th Dec 2004 07:02
Thanks Ralph, but the AVI wasn't compressed at all. If I extract a single frame from the animation and save as a bmp then transparency works as you expect. I also checked (using the color picker tutorial from the tutorials page of the website) that the background of the AVI is rgb(0,0,0) and it is. I also tried the texturing idea but still with no luck.

It seems as though image transparency only works if the image is a single frame (I also tried converting the AVI to MPG - with the same effect).

I guess usually animations include a background so this is not an issue, but because my animation is so that I can display text with a wobbling effect I don't want the background to display).

I guess my text will just have to be static for now
Rob B
20
Years of Service
User Offline
Joined: 13th Jan 2004
Location: Paola
Posted: 8th Dec 2004 08:02
I think RalphY is right.Make a plain object,ghost it,maybe lock it to the screen then texture it in the loop.Like..

RalphY
20
Years of Service
User Offline
Joined: 6th Sep 2004
Location: 404 (UK)
Posted: 8th Dec 2004 20:17
Yes ghosting should work as I have used this method in projects before. However if you say you can grab a single frame and convert it to a bmp and this works, why not simply make it loop through grabbing each frame one after the other converting it to a bmp?

I don't have DB on me at the moment but somthing like:
- start of main loop
- grab frame i and paste to bitmap 1
- set transparency and display bitmap
- increase i
- game code etc
- end of loop
Should do the trick.
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 8th Dec 2004 20:50
As for myself, I use avi files (compressed) to get animation transparencies.
(I used them to have a realistic flame on my candles)

Load the video
Set the commands for the Play animation on image ...
Set image transparencies
...

That's all.

Here an overview of my code:


Hope this will help you

Guido
http://www.vues3d.com
Qweeg
20
Years of Service
User Offline
Joined: 23rd Sep 2004
Location: Kent
Posted: 9th Dec 2004 06:10 Edited at: 9th Dec 2004 06:11
Thanks everyone for all your help.

Ghosting seems to do the trick, and is the simplest so I'll probably do that. Ralphy, I am sure your idea of grabbing each frame as a BMP in turn would work too. My only issue really is that as far as I can tell it should be possible to do exactly what Vues3D sugests - but it just doesn't seem to work for me. I know the background of the AVI is rgb 0,0,0 so setting the image colorkey should do the trick, but it doesn't.
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 9th Dec 2004 15:56
Could you post the part of code you handle for transparencies & loadin animation... I could try to modify it & find where changes must be done.

Guido
http://www.vues3d.com
BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 9th Dec 2004 21:44
One of the AVI codecs supports transparency (sorry, can't remember which one). But I don't know if DB would read the transparency data.

BatVink
Qweeg
20
Years of Service
User Offline
Joined: 23rd Sep 2004
Location: Kent
Posted: 14th Dec 2004 17:31
Vues,

Here is the code I have written to test the animation transparency.

I have attached the AVI file as well (as a zip file)

Thanks for your time

Attachments

Login to view attachments
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 16th Dec 2004 23:44
Glad to see the problem is solved!


You can now say you're not anymore newbee

Guido
http://www.vues3d.com
Indian Homie G
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: San Jose, CA
Posted: 24th Dec 2004 14:32
Hey guys I am having a similar issue... but the colorkey doesn't work for me!

AMD Athlon XP 3000+, S3 Deltachrome s8, 512 PC3200 RAM, 160 GB HD
Indian Homie G
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: San Jose, CA
Posted: 25th Dec 2004 03:57
HOw do I get colorkey to work?

AMD Athlon XP 3000+, S3 Deltachrome s8, 512 PC3200 RAM, 160 GB HD
Indian Homie G
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: San Jose, CA
Posted: 28th Dec 2004 01:34
?!?!? help! thanks

AMD Athlon XP 3000+, S3 Deltachrome s8, 512 PC3200 RAM, 160 GB HD
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 29th Dec 2004 21:10
what's the colour of the part you want to be transparent?

Guido
http://www.vues3d.com
Indian Homie G
20
Years of Service
User Offline
Joined: 23rd Jan 2004
Location: San Jose, CA
Posted: 30th Dec 2004 07:27
well its just plain black RGB(0,0,0)

AMD Athlon XP 3000+, S3 Deltachrome s8, 512 PC3200 RAM, 160 GB HD
Vues3d on Kalimee
20
Years of Service
User Offline
Joined: 12th May 2004
Location: NYON (SWITZERLAND)
Posted: 30th Dec 2004 20:34
In this case you'll better write down the code... this will help a lot !!

Guido
http://www.vues3d.com

Login to post a reply

Server time is: 2024-11-27 18:54:53
Your offset time is: 2024-11-27 18:54:53