The new 3.0 MetaHumans: 40% performance gains? Tutorial inside.

Quick update: I’ve been doing performance testing between deleting bones & LODing them with Skeletal Mesh LOD settings data asset.

Deleting bones provides the exact same performance result as phasing them out in the LOD data asset settings for the skeletal mesh. This is both a good thing and a bad thing.

The good:

8% Frame time reduction on scene with 35 LOD 0 Metahumans. Just by deleting extra finger bones that you will not notice are gone. Bone deletion works on LOD 0, but bone LODs only work for LODs >= 1. I need to do animation testing to make sure that the deletion of the bones in the hand can be done safely without the need to retarget anims.

Bone LODs are very powerful. I don’t have to worry about vertex weights being lost midair and then automatically being stuck to the root bone, breaking everything. It’s less risky than deleting bones, but you can only affect LOD one and above. They have allowed me to continue further in this effort. Without snapping my brain in half with more python.

The script has allowed me to test different settings. Much faster with zero crashes. Whether you want to delete bones or try different bone LOD settings, this script will save you a ton of time. You can delete bones, replace vertex weights, save bone LOD settings & bone lists (of bones to phase out per-LOD) to .txt file, load said list of bones and settings into the unreal asset with 1 click. So during my testing I was trying to phase out many different kinds of bones using the LOD settings. Thanks to my script, all I had to do was copy the name of the bone from the tree and paste that name into txt file. After saving, I, type one command into the python console and the LOD settings data asset inside of unreal engine gets loaded with the entire list of bones. For every single LOD for as many LODs as you need.

The script is good to learn from if you want to do python in unreal. I had to do simple things such as I’m getting reference to an asset in your content browser all the way to modifying. Editor properties and stuff with literally zero documentation. So you will probably be able to learn something if you’re used to reading code. I implemented txt file settings for termination criteria. Maximum percent of vertices. Maximum percent of triangles, whatever you need, you could easily look it up and just replace two words and pretty much inject any settings into any asset you want to.

It’s good for my ego. Because all of the time I spend making these scripts has not gone for nothing! :crazy_face:. I’ve decided I’m ustmake one big video where I show all of the stuff that I found that can optimize the MetaHuman or any other skeletal mesh. People can take it and run with it. Most of the information will be complete, but some of it will be incomplete leads for info purposes.

The bad:

After modifying the skeleton bones or weights, You have to reweight or regenerate the skeletal mesh LODs. Luckily this has been automated in unreal engine for sometime, but the results are barely passable. This is my biggest concern. The Meta human, when freshly imported, comes with 4 LODs, and they are beautiful symmetrical. Nice curved vertex arrangement so the body folds nicely. But i’m sure these LODs were not generated inside of UE. The default LOD settings have LOD 1 with a vertex % of 1, Which would make the geometry not reduced at all. My script has a function called flushLODs, which deletes all of the LODs & regenerates them based on your settings. So I have been able to retest extremely fast, yet I have not found one setting that allows the metahuman’s regenerated skeletal mesh LODs to look anything better than gravel. See my above posts for visual understanding. There is a setting for ‘bones to prioritize’ which can reduce geometry reduction around specific bones when generating LODs. The problem is I want to delete as many bones as possible. So I can’t prioritize a bone at a high LOD if I’ve already deleted that bone at a lower LOD. I feel I am forced to strike a balance between the ease of deleting bones and the bad result of autogenerated LODs.

The head. Don’t really need to say much about this one. It’s merely just a big unknown. I’m not concerned with compatibility as there is a setting that maintains geometry complexity around breaks and seams in the mesh. So when i’m regenerating all of these meshes for the metahuman, their body parts still match at high LODs. I might pop back into the fortnite editor to see if I can figure out exactly what face bones are being disabled with the UEFN exclusive meta human optimization tool. If I can’t find an easy solution to layer on top of the ones I currently have, i’m not gonna spend much time on the head or face at all. The hair performs well enough with cards & The face still looks beautiful at LOD 3. Worst case scenario I crank up the head LOD & no one is the wiser. I could use the script to create a second head for NPCs, with little or no function. Some of the catch-all solutions that have been proven to work via plugins should allow me to curb some of the performance cost of the face and head without getting stuck in the weeds for another three months.

There are diminishing returns when it comes to deleting bones. For example: I can delete all sorts of corrective bones in the left side of body and get (X) ms decrease. But when I add the right side duplicates to the delete list, I get less than (X*2) ms decrease. This is also observed when stacking the many modifications & plugins on top of one another. I can understand this scenario happening if I stack a plugin on top of bone deletion, as less bones existing is going to make a skeletal mesh optimization plugin work for less things. I guess deleting bones is only teasing at the many skeletal mesh related tasks slowing down the game thread.

My final solution is going to include many different settings, plugins and modifications. I still need to test the bones per vertex setting. Hopefully, it’s a nice little sprinkle on top of performance. I’m looking forward to finishing this soon. Like I said, I’ll make a cute little youtube video when im satisfied; showing the latest Metahuman optimization techniques.

2 Likes