Is it somehow possible to disable bones on a skeleton so they are not processed and (in theory) improve performance?
Currently, the UE4 mannequin contains 68 bones and I read that more bones = less performance.
I know I could create lower LOD copies in 3dsmax but I’m wondering if I can somehow (dynamically) change the bone count of individual crowd characters during runtime so the fingers, hand and feet bones of distant characters aren’t processed (which won’t be noticable).
This could skip around 30 bones and reduce processing by 40%.
I looked in the persona graph and r-clicked a bone but there isn’t anything like a disable option.
So, is it possible or does such functionality not exist?
There is no function to disable bones, per se, but what you can do to reduce processing is to have different animations for the lower res LODs. The main cost in animation processing comes from all the vertex transform information from all the vertices influenced by the bone they are weighted to rather than just the bone transform information.
Hence there are two ways to reduce processing for the lower res LODs sharing the same skeleton:
- Using a lower poly mesh will automatically result in less vertices being transformed in the animation
- Use animations that do not transform vertices of extremities, like fingers and toes, that you cannot see from afar
Regarding suggestion 1 above, the low res version could have “mitten” hands instead of fingers with few vertices and still have the same skeleton underneath.
Use animations that do not transform vertices of extremities, like fingers and toes, that you cannot see from afar.
Yes. That is what I have been working on to day as I suspected the functionality I wanted would not be available now or in the future.
Using a lower poly mesh will automatically result in less vertices being transformed in the animation.
I first switched from the high poly UE4_mannequin to the low poly UE4_mobile_mannequin but that had absolutely no effect on performance. I’m assuming that (in this case) the mannequin polys is not the main bottleneck.
I then did a test where I set all crowd agents to ‘not visible’ to confirm that the animation * num_agents what the bottleneck. However, my FPS/ms did not change at all. I expected the performance to go back up to optimal but it was as if the crowd was still being calculated/processed even though I coudn’t see them.
Is this what you would expected?
Perhaps plugging in an actual model will less bones will be a more valid test case.
The information is still being calculated even though you cannot see it, so yes, this is expected behavior.
I did not realize you were working with crowds, in which case you could create a skeleton with less bones and retarget animations to your new skeleton, as long as the bones remain in the same heirarchical order.
I don’t know what your system specs are, but here’s a video where another user has crowds of 400 of the mannequin working fine with very little fps loss (You may be able to pick up some tips there):
Unreal Engine AI Crowd Example Video
Ah yes, that was the video that made be believe it was possible (I followed the tutorial last week).
“I don’t know what your system specs are”
My system is 3 years old so not super powerful.
So far, I have hacked the mannequin model down to 2 bones (root and pelvis) for my 100 character test, but only got a 10FPS boost. zoombapup’s videos don’t show FPS so it’s hard to compare.
When I scale up to 400 characters (2 bone) I’m running at FPS:24 ms:40
When I scale up to 400 characters (68 bone) I’m running at FPS:12 ms:80
So, as you stated, the bone count is important.
I’ll try and find out zoombapup’s system spec as an additional point of reference.
Fyi, I haven’t yet tweaked anythingin the Engine->Crowd Manager properties so I’m not sure if I can further optimise the per-agent checks.
Tried various minimal ‘Crowd Manager’ settings, no real difference.
Your graphics card seems fine, however, you don’t list your CPU or the amount of RAM, which are also factors.
For comparison, I get a consistent 70-72fps with a hundred Mannequins running around fully visible on the following system:
- Windows 7 Professional 64-bit
- PROCESSOR: Intel(R) Xeon(R) CPU E5-1607 v2 @ 3.00GHz (4CPUs),
- RAM: 32GB RAM
- DIRECTX: DirectX 11
- VIDEO CARD: NVIDIA GeForce GTX 770
Finally when you strip the mannequin model down to 2 bones, have you tried to see a difference with using a box for the mesh instead of the mannequin model? Try this and if you see a considerable increase in fps, this will demonstrate that your system is having difficulty processing the movement of all the vertices, even if they are not, in fact, animated beyond moving from one point to another guided by the root bone.
“Your graphics card seems fine, however, you don’t list your CPU or the amount of RAM, which are also factors”
Intel(R) Core™ i7-3770K CPU @ 3.50GHz (8 CPUs), ~3.9GHz
I have more CPU but less Sys RAM.
[NVidia GTX 6670 vs 770]
You probably have more bandwidth and clock-cycles but somehow I don’t think that would account for your massive 70-72fps performance :-/
Would you happen to have a basic (stripped down) packaged.exe of your crowd so I can do a more direct comparison? If not, then no worries.
“when you strip the mannequin model down to 2 bones, have you tried to see a difference with using a box for the mesh instead of the mannequin model?”
Gained 7 FPS.
Your machine specs seem comparable, especially to my home
machine. To be clear, my test was with 100 mannequins a while ago, I see it says “400” agents, which I guess is how many boxes are there… Admittedly I’d expect a greater than 7FPS increase. I’ll try some tests. In the meantime, what fps do you get with 100 agents?
100 UE4_Mannequin_mobile agents
Full screen (1080) PIE:
45FPS / 22ms
100 UE4_Mannequin_mobile agents I get
Full screen (1080) PACKAGED EXE:
60FPS / 16ms
400 UE4_Mannequin_mobile agents
Full screen (1080) PIE:
12FPS / 80ms
400 UE4_Mannequin_mobile agents I get
Full screen (1080) PACKAGED EXE:
18FPS / 56ms
"I’ll try some tests. "
I could not track down the old top down project where I had 100 guys chasing the hero it -it was likely the mobile blue guy and there were no textures, just the default gray. With the current mannequin and 100 enemy, I was only getting 38-40 FPS as you see here:
So the take away is, your machine is performing normally. If you want to have a crowd of around 400, you’ll need to optimize the animations with fewer bones, compress the animation, and have lower-poly skeletal meshes.
I’ve done some tests with my rig and I’ve discovered its not the amount of bones that makes a rig heavier.
In my scene I spawned 300 rigs (blueprint with skeletal mesh component with animation blueprint)
I compared a skeleton with 150 joints in it of which 30 where actually skinned to the model to a skeleton of 50 joints of which 30 skinned to the model. The difference was 1 ms.
Then I compared a rig with 58 joints that where all influencing the model to a rig with the same amount of joints but only half of them influenced the model. The difference was 7 ms.
It seems whats more important is how many bones are actually skinned to the model.
So for now I would recommend using the same skeleton but for each consecutive lod, merge the skin weights so less joints actually influence the model.
Anyone looking to reduce animation cost by using less bones, this is the real answer.