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 / Video as a animated texture

Author
Message
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 05:04
Im sure I saw a tut on how todo this, and cant find it.

is it possible to play a avi as a texture on an object or plain?
and if it is, how?

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Toilet Freak
23
Years of Service
User Offline
Joined: 16th Dec 2002
Location: Australia
Posted: 11th Sep 2003 06:57
I'm pretty sure you can do that too, and I'm also curious on how this is possible, I was thinking of prolly texturing using a .gif but then you'll get scewy colours...

DreamersScars-Toiletfreak-
If you need a animated chara go here... It isn't that great but it'll do as a tester model thingy http://users.tpg.com.au/users/cnkyk8k2/index.html
Toilet Freak
23
Years of Service
User Offline
Joined: 16th Dec 2002
Location: Australia
Posted: 11th Sep 2003 06:58
a animated texture would be most useful for facial expressions and eyes blinking etc, so if someone know how please tell.

DreamersScars-Toiletfreak-
If you need a animated chara go here... It isn't that great but it'll do as a tester model thingy http://users.tpg.com.au/users/cnkyk8k2/index.html
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 07:00
cant use gifs, Im sure there was a demo that had a cube with a video on how to do a program in 7 clicks or something.

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 07:30
WOOT I got it figured



lol it works, the animation is a little jerky, but I can fix that I think

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 11th Sep 2003 07:38
Don't you think the animated texture functionality in DBpro is not very useful? I mean, it would be a lot more useful if it support other format than AVI, since AVI doesn't have alpha channel. And without alpha channel, I can't create any animated texture with transparency. For instance, I wanna create an animated explosion textured on a billboarded plain.

Think again... how many times you don't actually required to use alpha channel when comes to texturing?

I hoped Lee realize that and put this in his update list.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 11th Sep 2003 07:41
One suggestion,

I would prefer if the animated texture in DBpro works like the way how animated sprite works, i.e. I specified an image with all the animation sequence, and supply the frame timing. By using this way, I can use an image with alpha channel (PNG and TGA) if I need animated texture with alpha transparency.

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 07:44
Actually the alpha channel comes with Texture Maker when you use it to create the AVI. Works and looks really good actually.

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 11th Sep 2003 07:48
Do you mean AVI can really have alpha channel?? Do you mind uploading that AVI (just a short one) for me to try it out?

Thanks!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 07:51
Sure... ill make a real small one, under a meg and email you the URL for DL

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 08:00
I emailed you from my hotmail with the link



http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 08:07
ok i might be wrong, the first avi looked transparent, but second isnt. I may have made it wrong, maybe not.

Ill keep playing

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 08:26
Damn i was wrong, GAH, I was sure it was transparent. There was even an alpha setting. Oh well. How do you do multiple BMPS?

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 11th Sep 2003 08:38
Right now, the way I am doing is to create a sequence of animated frames into several image files, e.g. fire01.tga, fire02.tga, fire03.tga, and so on, and switch the texture manually using texture object. Very messy eh? It gets even messier when trying to maintain the animation frame timing, and if your animation sequence is long (esp. when deal with smooth animation). All these are not hard, but just very messy if you have a lot of animated texture. Based on my intuition, DBpro can do something like how sprite animation works.

(Lee, are you hearing this?)

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 08:45
mnn I think I see how you do it. Ill play around. Thanks

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Falelorn
23
Years of Service
User Offline
Joined: 19th Jun 2003
Location: Canada
Posted: 11th Sep 2003 09:14
I figured out a way to do it, I load 403 images and loop them, and they run smooth, 60 FPS

I just added it to the main loop.

http://matedit.com/forums/index.php (other great DB forums)
Current Project - Legends of the Sword - On my WWW
Check out profile for more information
Bulleyes
23
Years of Service
User Offline
Joined: 3rd Nov 2002
Location: Cyberjaya, Malaysia
Posted: 11th Sep 2003 09:26
Ok, here is how it works:

1. First, you need to extract all the animation frames and export it as a series of image files. (There are several programs able to do this.)

2. Open every single image file in your favourite imaging program, and create an alpha channel for it. Most program can create alpha channel automatically by recognizing your luminance value. (Yes, this is indeed a very tedious tasks especially when there is a lot of images.)

3. Choose a range of image number reserved for that particular texture animation, say #100 till #170.

4. Preload all the images into that range.

5. Initialize a variable to keep track of your current animation frame, and set it to the first animation frame image number, e.g.



You noticed that I used float instead of integer. You will know why later when comes to keeping track of the animation timing.

6. Initialize another variable that store your animation timing. It will be the amount animation frame advancement per game loop execution. You must take SYNC RATE into account when calculating this. e.g.

- If you sync rate is at 60 frames per second.
- And you want your animation advances at 6 frames per second
- Thus this variable will have the value of 6/60 = 0.1, e.g.



- You can read this as, during every frame of the game loop, the animation advance 0.1 frame. Thus, after 10 times in the game loop, the animation will advance from the current frame to the next frame. Since the sync rate is at 60 FPS, you animation will be 6 FPS.

- You might already noticed, this is not a very accurate calculation to maintain the animated texture speed, since we didn't consider the delay in other computational tasks. We naively assumed that the game loop is always consistent at the specified SYNC RATE. This is tolerable if you don't required a super accurate timing for your animated texture.

7. In your game loop, it will look something like this.



Conslusion, this might not be the neatest solution available. You might want to optimize it further by don't texture the object if the current frame is same as previous. Now, it is obvious that this will eventually very messy when you have a lot of animated texture.

Good luck!

Bad Nose Entertainment - Where games are forged from the flames of talent and passion.

http://www.badnose.com/

Login to post a reply

Server time is: 2026-07-25 08:12:18
Your offset time is: 2026-07-25 08:12:18