Optimizing Animations

Couple of questions about using the animations created by egg-texture-cards.exe:

  1. How do I speed up load times? I’m using two animations currently (one for fire, one for explosions) and each is about 35 images and totals 1.5 MB. They add about 5 seconds to the load time when I start a level. I have already converted them to bam. If I load, say a box, instead of the animations, the load time goes from about 7 seconds to 2. Or is this something I should be loading when the program first starts up and then use something like copyTo?

  2. How do I improve frame rate when I am using many of the same animation at the same time? The level has a wall of flame which is just the flame animated card tiled vertically about 15 times.

  1. Here are five different ideas.

1a. You could put:

model-cache-dir /my/cache/dir
model-cache-textures 1

in your Config.prc file, which would cache the texture images and might help load time (after the first time).

1b. Simply converting the egg to bam might help. But using the cache directory, above, would achieve the same improvement (after the first time).

1c. You could instead try:

preload-textures 0
allow-incomplete-render 1

to tell Panda not to load the actual texture data until it is rendered, and furthermore not to delay rendering just because the texture is still unloaded. This will mean the cards will initially appear in a solid color, then the color will be loaded later.

1d. How large are your texture images? Do they need to be that large? You could reduce them to improve load time. Also, are they a power of two size? If not, Panda will be forced to rescale them to a power of two at load time, which is really slow. Reducing them to a power of two will make them load much faster (but this is also handled automatically by 1a).

1e. You could simply use egg-palettize to reduce the 35 separate textures into a single texture, which will load much faster.

  1. 15 of these sorts of cards shouldn’t have that much of an effect on performance, so you should probably investigate where the performance drain really is. PStats would help you with that. If it really is something to do with rendering 15 of these cards, you could consider using a fewer number of larger cards instead. To get the same effect, you could simply pre-generate cards with lots of little flames each, instead of one flame on each one.

David

Is there any tutorial for this ?
I shall definetly use it!
(Tried to follow your video but I miserably abonded the project because of the bad sound, on this one it was possible to guess what you were writting on the board)

Short answer:

mkdir result
touch textures.txa
egg-palettize -d result -opt -nodb myfile.egg

That is, create an empty directory to hold the result, and create an empty textures.txa to control the process.

Use “egg-palettize -h” to list more command-line options, and “egg-palettize -H” to describe what you can put in the textures.txa to exercise more control. But for a single egg file, this will suffice.

David

I had a problem when I use this, when I entered “touch textures.txa”, it said that “touch” is not recognized as an internal or external command.

Just create an empty file named textures.txa.

David

you could also use something like this.

discourse.panda3d.org/viewtopic … =tilesheet