Chasester_aka_you | 2010-02-19 19:54
Animation Falling From the Sky -- Revised Aug 25 2010 --
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


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 @$$ :)



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.


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.


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:
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.


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. 


Your Humble Master

 (2 votes)
MovieShader.txt590 bytes
User login
Users on Quadropolis
1 guest & no users online
Created 2021-11-05 01:27
4 weeks 1 day ago
points ]
 (4 votes)
Created 2020-12-10 12:49
51 weeks 1 day ago
points ]
 (4 votes)
Created 2012-08-30 04:30
9 years 14 weeks ago
points ]
 (1 vote)
Created 2019-10-16 01:26
2 years 7 weeks ago
points ]
 (1 vote)
Created 2021-06-17 22:42
24 weeks 1 day ago
points ]
 (3 votes)
Created 2020-11-30 04:00
1 year 4 days ago
points ]
 (1 vote)
Created 2021-05-24 00:01
27 weeks 5 days ago
points ]
 (10 votes)
Created 2019-12-05 20:57
1 year 52 weeks ago
points ]
 (2 votes)
Created 2020-12-20 03:04
49 weeks 6 days ago
points ]
 (3 votes)
Created 2020-12-04 12:05
52 weeks 23 hours ago
points ]
 (2 votes)
Created 2020-12-03 17:12
1 year 18 hours ago
points ]
 (3 votes)
Created 2020-06-13 21:05
1 year 24 weeks ago
points ]
 (5 votes)
Created 2020-01-23 12:57
1 year 45 weeks ago
points ]
 (8 votes)
Created 2020-10-11 13:46
1 year 7 weeks ago
points ]
 (7 votes)
Created 2018-12-04 15:12
3 years 20 hours ago
points ]
 (4 votes)
Created 2020-10-22 00:50
1 year 6 weeks ago
points ]
 (2 votes)
Created 2020-11-22 21:21
1 year 1 week ago
points ]
 (4 votes)
Created 2020-11-18 21:08
1 year 2 weeks ago
points ]
 (3 votes)
Created 2020-11-15 18:16
1 year 2 weeks ago
Created 2020-11-15 07:21
1 year 2 weeks ago
Who's new
  • letic86
  • WASP
  • Im_Percynator
  • micai