The Scenegraph in my project is taking a lot of time per frame and causes some serious speed loss. I have 3 characters on armatures, adding each in succession increases the scengraph time from 0.2ms (at none) to 5ms to 16ms to 42ms when animating them. Changing the deform from Blender to BGE does not change much (2-3ms at most).
What is the best way to optimize this. reduce vertexcount (atm ~10.000 per character)? lower texture resolution (atm 1024x1024 for color, spec and normal)? any other options?
There are no modifiers on the meshes besides the armature.
10,000 per character is what’s causing it I think
If he were talking about the rasterizer, then maybe, but his problem is with the scenegraph. How many bones do your characters have? Are you using a lot of bone constraints like IK? What about bone parents?
i too kind of doubt the vertex count is the issue. i deleted arbitrairily half of each mesh and it still was the same.
yes, i’m using a couple IK chains (arms and feet mainly) and a fair amount of copy rotation/location constraints. 255 bones max per skeleton. I have some objects parented to bones (about 5 per skeleton)
Some things id like to test against performance:
B-Bones
Setting control bones to non-deforming
Reducing IK iterations
Reducing bone count
the curious thing is that the calculation time does not go up in a linear way, since one character only takes 5ms and 3 are way more than 15ms
255 bones per skeleton?! That sounds pretty darn high to me… My guess would be that this is more of an issue than the vertex count (although both added up together…)
Yea 255 bones does sound like a lot. If its a bipedal character you are rigging then I would be looking to reduce the number of bones to somewhere around 80. You do not have the luxury of using high numbers of bones within the game engine like you do for rendering animations or images.
Moguri mentioned that the rasterizer is potentially the problem here, which seems to be the bottleneck for the game engine. Is this whats holding the game engine back? It does always seem to be the component which takes most time to process, from looking at the profiler. I wonder how much funding it would take to get the devs to work on this? Any ideas?
edit: Adding ‘too many’ rigged characters to a scene does make the rasterizer grind to a halt. I added 30 rigged characters to a scene and was getting around 20fps, which is unplayable in most cases.
I was saying that the rasterizer propbably wasn’t the main bottleneck here since the OP mentioned a high scenegraph. The reason the scene graph is high in this case is that it has to calculate all of the poses for all of the skeletons in order to properly calculate the bone parents. If it weren’t for the bone parents, then the time would have shifted over to Animation.
80 bones is still pretty high, but a lot better than 255. The BGE piggy-backs off of Blender’s animation system, which is pretty slow.
yes rasterizer is doing fine.
Might work better to get the animation baked down to the bare binding bones and have the rig bones not be loaded into in the game engine, if i can get that done somehow.
I’ve reduced the iteration of all IK constraints from the default 500 to 50 resulting in a 18ms Scenegraph calculation time (from ~50ms).