Chasester_aka_you | 2010-02-19 19:54
Animation Falling From the Sky -- Revised Aug 25 2010 --
18
points ]
 (2 votes)

Animation Falling From the Sky

Lets define some terms: READ FIRST

Fr: frame rate
Ss: user defined as the square size for the user particular movie
Wd: width
Ln: lenth
Cs: cube size--the size of the cube in a texture in pixles-- smallest 8x8
Px: pixel--one square of one color in a picture
Mts: Max texture size--the largest size that cube can import-- set at 4096 or 2^12.
Cell: defined as one piece (as a square) that displays part of the movie-- this will be later converted into a texture. 
Grid: defined as a set of cells (squares) that define one overall movie
Pixelated: the effect when you see little boxes of color. Like a low quality pic or mov
Pic: picture
Mov: Moive, Video, or other movie like multimedia
Multi piece texture movie: a movie divided with a grid creating cells which are imported into cube and pieced back together 
Min: Minutes 
st8-^2: a term which means a number greater than 8 and is a power of 2  (ie 8,16,32,64 ect)


Note: all cubes are 8x8 px and incress by *2 or st8-^2.
Note: Quick interpretation assumes that you have flash 8 or greater. If you do not have flash read below

 

Quick ez interpretation

    1:  Take a video and import into flash
    2:  Cut it into peices (based on the cart at the bottom)--you will divide your movie in a grid fashion--even pieces. 
    3:  Export each frame of each piece as a jpg or gif sequence
    4:  Make sure to but these in folders that are the piece number.
    5:  Make a new folder called current.
    6:  Take all the jpg from the folder 1 (the first piece or grid cell) and copy them in the current folder.
    7:  Then take all the pieces and lay them to make one texture (frame 1 upper left and last in lower right).
    8:  Export as jpg.
    9:  Now copy the jpgs from folder 2 and pasted them over the pics in folder current (over top the images in folder one
    10: Go to the library and select all the images 
    11: Right click and select refresh (I do believe)
    12: Export as jpg
    13: Do the above 4 steps until all the folders are done
    14: These are your textures.
    15: Take the textures and save them in a folder with your name on it.
    16: Make a config file with the map name.
    17: Define all the textures using the texture 0 command (i.e. texture 0 "myname/1.jpg" ... )
    18: Above the texture command define that the textures are using the Movie shader (the attatched file).
    19: Note you will have to exec the file on start so you can add the attached code to the bottom of the stdshader (data/stdshader).
    20: To define a shader put this code in: setshader MovieShader
    21: Note: the name MovieShader is dependent on what you name the attached code in the stdshader.cfg
    22: Now that the shader is set make sure to set the vars that are defined in comments (look at the code)
    23: The textures should work like all other textures. So simply line them in order and they should look good 

See example: CFE's Movie Map
This was set by Chris, using my article (and my help) :)

Tips And Tricks

☻ When making the first texture, use the align functions (window-align). Lay down all the horizonals then use the distribute command. Then group each row and distribute vertically. Note: make sure that the top and bottoms are perfectly aligned before you distribute or you will have gaps.
☺ Before exporting each image piece (or cell) of the movie change the stage size to the size you need this way you dont make to much or to little.
☻ Use the properties window to change the x y wd ln (this will make it more accurate.
☺ Export as jpg sequence not gif sequence (gif has a lower color depth--which means less colors to choose from-- it will make it look pixelated).
☻ Dont export at a fps lower then 12 or higher then 30.
  

Without Flash

Use any program that allows you to edit movies. Windows Media Player will work:
     
    1: Import the movie into the program.
    2: Start on the first frame and export each frame.
    3: Note if you want to have multi piece texture movie you will have to divide the movie before you export.
    4: Put each piece into a different folder. 
    5: Go to a pic edit program (use gimp--its free)
    6: Import all the pictures in one folder.
    7: Lay the pics out--first frame upper left--last frame lower right.
    8: Export as a jpg.
    9: repeat steps 7-8 until there are no more folders.

Start at step number 14.

Graph And Cells For Your Movie

Note: this is a graph that you need to look at.
First find the length of your movie in min.

   ln	        px x px
140 min	        8 x 8
9 min	        32 x 32
34 sec	        128 x 128
2 sec	        512 x 512

Now you need to figure out how much space you want your animation to take in cube. Take a grid size according to the cart and plot out the space you want the movie to cover in cube.

Ss     ingame grid size number
8                1
32               2
128              3
512              4
♪ The easiest way to find your grid size is to scroll down your grid size to the bottom (g + downscroll) thats 1. 1 g + upscroll is 2 and one more 3 etc.
♫ Now count how many wd you want. Count the number of cells in game. These will translate to the same grid cells when doing the process.

Figure out the ratio of your movie 16:9 (rectangle) or 5:4 (square). Note it is best to use something that 9 or 4 can fit in. You need to figure out how many height that is. So simply divide your in game cell count by the width ratio and multiply by the hieght ratio---

ht = wd
N    gc

Note N is the ht count and gc is the ingame count.
If you do not know how to do this simply cross multiply here

i.e.

 
If your in game count is 8 cells and you are working with 5:4 ratio. If i 8/4*5 i get 10. Now i need to put a 10x8 grid over my video and then render each cell separately.

If now your in game count is 18 cells and you are working with 16:9 ratio. If i 18/9*16 i get 32. Now i need to put a 32x18 grid over my video and then render each cell separately.

Note: YOU MUST come out with an even number-- you can not half a cell-- it would be a pain in the @$$ :)

Explaination

Problem

We need to take a picture and convert it to a movie. To do this we must trick the mind by flashing images by the eyes at such a rate that it looks like it is moving. Cube does not allow us to use any file type but image files. So we must use some type of code to solve the problem.

Solution

To solve the problem we must use a combination of code and texture format. Baby Rabbit came up with the code. Now we must apply the code to the texture.

The Code

To understand how to make a format for the code we must understand the code. The code takes an image scales it to a section (starting in the top left corner) of the texture and displays this area. Then it moves one cell over (cell means a distance of x value). When it reaches the end of the row it down one cell and back to the left side. Thus sliding thru the texture. If we can do this fast enough then we can trick the mind to think that it is a movie.

Formating

 
So what we need to do is to make our movies frames line up with the frame that the code displays. So we simply line frame 1 next to frame 2 etc until we get to the end of the texture and then we drop down and go to the left side and continue. We do this until the image is done.

Max Size Problem

Cube has a make size of 4096px. This does not seem like a problem until you have to display 30 images a second. To solve this we are going to cut our video into pieces. We will call these cells or pieces. These cells get exported as separate textures so that we do not reach above are make texture space. The smaller each cell the longer the image can go on. The cap is around 1hr 1/2 at about 30 fps. But if we divide it up too much we will run into the problem that we have too many textures to lay out which becomes a nightmare. It is best advised to keep your movies less then 9 min, because a game is only 10 or 15 min long and if you use 9 you can stay in the 2 grid size which will make it easier.

Charts and Graphs

Ok so to explain the tables and how they work and how i got the numbers.
First chart:

   ln	        px x px
140 min	        8 x 8
9 min	        32 x 32
34 sec	        128 x 128
2 sec	        512 x 512

The formula is:
(((Ms/Ss)^2)/Fr)/60
Note:
Ss: squ size
Ms: max size
Fr: frame rate
60: because there are 60 seconds in a min
---------------------------------------------
The formula takes the Ms which is a const set at 4096 and divides by a Ss. Ss is a set of the following: Ss[8,32,128,512]. These are st8-^2. This gives you how many Ss's you can fit in a strait row down your texture, but a square has two sides. So we square the sides because the sides of a square are equal. Thus more or less we found the area of the cube as the Ss was the unit of measurement. Then we divide by the fr. This is because we need to know how many images we need to display in one second. Now we have the amount of seconds that we can run our video, we divide by 60, cuz there are 60 sec in a min. Note: to find hours divide by 60 again.
Second chart:

Ss     ingame grid size number
8                1
32               2
128              3
512              4

This comes from the cube code. This is simply the amount of px that each texture takes when a particular grid size is used.
---------------------------------------------------------------------------------------------------------------------

Conclusion

The above should give you a complete understanding of the medthod in which you create movies. If you have any question post them, if you have any areas of the explaination you would like me to expond opon leave a comment. If you have question about programs (other than flash) to use for this process, leave a comment. :0 And if you have any ways to improve the process please comment. 

Thanx 

Your Humble Master
chasester

18
points
 (2 votes)
AttachmentSize
MovieShader.txt590 bytes
User login
Users on Quadropolis
1 guest & no users online
30
points ]
 (3 votes)
Created 2019-05-17 21:51
5 years 30 weeks ago
30
points ]
 (3 votes)
Created 2020-06-13 21:05
4 years 26 weeks ago
20
points ]
 (2 votes)
Created 2021-05-24 00:01
3 years 29 weeks ago
8
points ]
 (1 vote)
Created 2024-06-02 14:26
28 weeks 15 hours ago
8
points ]
 (1 vote)
Created 2024-06-02 22:13
28 weeks 8 hours ago
vampirefrog
Created 2024-04-11 22:25
35 weeks 3 days ago
vampirefrog
29
points ]
 (4 votes)
Created 2010-05-30 10:00
14 years 29 weeks ago
Gangler
36
points ]
 (4 votes)
Created 2020-10-22 00:50
4 years 8 weeks ago
Zoocata
10
points ]
 (1 vote)
Created 2024-02-11 21:20
44 weeks 9 hours ago
vampirefrog
10
points ]
 (1 vote)
Created 2023-07-23 20:02
1 year 20 weeks ago
36
points ]
 (4 votes)
Created 2020-12-10 12:49
4 years 6 days ago
Created 2023-12-12 23:34
1 year 4 days ago
Zoocata
Created 2023-11-27 23:00
1 year 2 weeks ago
20
points ]
 (2 votes)
Created 2023-10-01 15:21
1 year 10 weeks ago
9
points ]
 (1 vote)
Created 2023-06-13 17:54
1 year 26 weeks ago
Zoocata
27
points ]
 (3 votes)
Created 2023-05-05 20:58
1 year 32 weeks ago
Zoocata
18
points ]
 (2 votes)
Created 2023-03-02 01:40
1 year 41 weeks ago
Getridou
Created 2023-01-29 23:27
1 year 45 weeks ago
Created 2023-01-19 19:36
1 year 47 weeks ago
Getridou
Created 2023-01-10 17:10
1 year 48 weeks ago
Who's new
  • ColdIV
  • Aidan
  • Hunk
  • letic86
  • BATMAN