(Solved) Performance: Five Actors Animate In Several Milliseconds

I’ve encountered a minor performance issue with my Actors.

Specifically, I have a scene that contains five actors. All are loaded from the same model, and have the same animations.

All have three bones–upper-back, neck, and head–controlled via “controlJoint”.

When these five actors are standing quietly, with their effectively-static “stand” animation looping, my frame-rate is well above 100, with a frame-time reported by PStats of about 8ms, if I recall correctly.

However, when these actors start moving, looping their walking animations, the frame-rate drops to around 70fps, with a frame-time reported by PStats of about 15ms.

Furthermore, if while they’re standing still I animate the three aforementioned controlled bones, once again the frame-rate drops to about 70fps, with a frame-time reported by PStats of about 15ms.

Are these values to be expected?

I’ll confess that such a drop in a scene that otherwise performs pretty well is a little concerning to me. 70fps might not be too bad–but that’s in a scene with plenty of time to spare per frame; a more-complex scene might be harder hit.

And is there anything that I might do about this? (Save for just neither animating the characters nor controlling their joints.)

[edit] Ah, I forgot to mention: PStats reports that about 5-6ms of the additional time is in “*->Animation->Armature”, within that primarily “Skinning”, but to a lesser degree in other categories as well.

[edit 2] Based on discussion elsewhere, I’m going to try reducing my perhaps-inadvisably-high vertex-count; I was perhaps a bit extravagant with this model. I intend to report back on my findings!

[edit 3] Hmm… Reducing the vertex-count from the original value of ~9 400 to ~3800 provides a small improvement of about two milliseconds, but no more, it seems. :/

How many joints does the model have?

Have you tried enabling hardware skinning?

The model has 73 bones in total, I believe. (Presuming that I have it correct that Panda “joints” are the same as Blender “bones”.) A significant proportion of those are in the hands.

My understanding is that, in order to get hardware skinning, I’d either have to use the auto-shader or implement it myself in custom shaders. (That said, please correct me if I’m mistaken!) Unfortunately, I’m using custom shaders, not the auto-shader.

I haven’t tried implementing hardware skinning in said custom shaders.

I think that I did try just enabling hardware skinning in the PRC-file, I suppose on the off-chance that it would work, but to no avail of course.

After reading the Vulkan 1.2 spec for about 13 hours today, I might be a bit tired. But you may be able to work from here: Hardware Skinning

I would suggest disabling your custom shader and overriding it with the auto-shader (as well as enabling hardware skinning, of course) for that model and seeing if your performance improves. Then you’ll know if it’s worth implementing it in your own shader (which I’d be happy to help you with).

Thank you both. :slight_smile:

Presuming that I did so correctly, it looks like hardware skinning does help, but not by a huge amount.

That said, I’ve already begun in earnest the process of simplifying my characters’ mesh, and while I was disappointed yesterday, I’m a little more positive with the results now. As was pointed out to me, at the frame-rates that I was reporting, a gain of 2ms isn’t nothing. And indeed, looking at my frame-rate meter today, I see that I’m getting around 90fps where before I was getting around 70fps.

So, I think that I’m going to call the matter there. I won’t mark any one post as the solution, as there are a number of solutions given here (and a part of the solution came via Twitter). However, I’ll update the title to say “Solved”, I think!

1 Like