I don’t really have an issue, because I just seem to have solved it, but I was definitely having an issue, here’s what I wrote about it:
“”"
So, as mentioned by Asynchronous Loading — Panda3D Manual under Animation loading, in order to get actors bind anims async, so do something like “actor.bindAllAnims(allowAsyncBind=True)”, we ned to run egg-optchar with -preprocess, so if I have a BAM file, it needs to be converted by bam2egg and then get pre-processed with egg-optchar which barely has any documentation, then it should be converted back with egg2bam, but during the process, things like joint names, texture stages, and possibly other things can be lost…
“”"
turns out, manually constructing “AnimPreloadTable” is better
even though it says in the documentation (AnimPreloadTable — Panda3D Manual):
This table records data about a list of animations for a particular model, such as number of frames and frame rate. It’s used for implementating asynchronous binding.
**This table is normally built by an offline tool, such as egg-optchar**.
It is MUCH better to run a headless panda as preprocessing, measure the anims, save to a data file, then at runtime, just before “actor.bindAllAnims(allowAsyncBind=True)”, construct a correct “AnimPreloadTable”. This makes anims bind instantly, which helps a lot in case of a timing-critical actor load (for example in-frame loading of actors with multiple (or even many!) anims)
An alternative solution might be to simply bake all anims into 1 bam file (import, bind, export bam)
This and other optimizations such as:
- loading the model separately off the main thread, then attaching to the actor
- loading textures off the main thread (by retargeting the built-in texture of the loaded model to different texture file)
- precompressing textures into the gpu-native .dds format to help with the gpu upload
can cut the full actor frame impact from ~50 ms burst to 5-10 ms spread across multiple frames
So on one hand, the good news is there are great ways to optimize a Panda3D program ![]()
On another hand maybe here is a question for those that go deep in the C++ code. Why does anim binding take so long, if framerate and frame count is not provided? How come providing these 2 simple values in a AnimPreloadTable saves ~5 ms per anim, by allowing async bind? Why is doing this a pre-requisite for async bind? Can the documentation in Asynchronous Loading — Panda3D Manual be updated to mention AnimPreloadTable for future reference?
I’m really enjoying the progress made with Panda3Dd so far, and it’s great to uncover more and more optimizations and features like this.
cheers!