How do I bake morph targets (blendshapes) into a head mesh?

The player can customize their characters face in Unreal Engine via morph targets aka blendshapes. Once they do that I have to continue using those morph targets aka blendshapes correct? Is there anyway to bake out the final head with the morph target changes and just use that finalized head mesh?

I’m worried that if I have 30-60 NPC’s on the screen and they’re all using morph targets (blendshapes) for unique faces it will be a performance nightmare, it would be better to just use a head mesh where the custom morph targets have been baked in right? In other words after you apply morph targets to a mesh, it would be better to save that head mesh out to a static mesh file so you can just reload it, this will eliminate having to use morph targets again which is a performance hit right?

**I can apply the morph targets in 3D Studio Max and bake out a finalized head mesh, but is it possible to do this in Unreal Engine? **

A few thoughts from me:

  1. Why do you need to keep using the facial variation shapes after a player has created the character? You shouldnt make those part of any facial animation system. They are additional offset shapes only used at character editor time. Then those values get saved and locked. No need to ever access them again on that particular character unless you have a way to do character edits after that by console command or as part of a game feature (i.e. skyrim)

  2. Again: you should plan a bit on how you want to tackle the unique npc face thing. It might be ok to do as I stated in point 1, but you could also do this process in maya or whatever 3d program you are using. Just have character artists make each npc by hand or if its not too important, just write a quick tool that can create random characters based on your facial variation morph library.

  3. The final question… well I dont know if its possible, but I would assume it isnt, at least not without going quite deep into game mechanics for which youd need c++. But its much simpler to do this in your 3d software.

Do additional offset shapes cause no performance penalty? Can I have 60 npc’s walking around with these offsets?

I’ll eventually test it :slight_smile:

Well with out context all things has some level of a performance hit that can become an exponential if overused and the need, ie with in context, of having 30-60 NPC’s on screen at the same time using morph targets I would say is a performance nightmare in the making.

In general.

A morph target is “unique” to the target mesh so unless applied to a single alpha character each and every NPC would need a matched morph target. IE if you have 60 NPC’s that needs a mouth open target then you would need to make 60 targets for each NPC.

For each character that needs a dialogue channel will require the full set of morph targets available as part of the export for the purpose of receiving authored animation data.

With 4.13 it’s now possible to included animated vertex data but there is no information that vertex animation is now GPU rendered unlike the standard of morphing data being CPU rendered. Generally the GPU only supports skeletal transform and rotation data so before you even hit 30 NPC’s I ould suspect that the FPS hit would make the game unplayable.

The memory footprint allowance for each character added will also be exponential in growth that even if hardware rendered could exceed the memory limits of the GPU.

That being said the question of adding the targets is not an issue as compared to the need to author the desired animation shapes as a data set and it’s the target shapes being animated that can become a further performance hinder to efficient work flow.

My educated opinion morph based animation is only suitable for non-game critical needs and limited to low detail mesh and not used as part of the primary character animation design.

A better option for video game facial control have a look at cluster or marker shaping.

As for live real time morphing this is on my list of things to test with 4.13 now supporting vertex based (aka point cache data) animation so the actual provable performance hit should become easier to prove or disprove but once again the maintenance cost is to high in my opinion.

P.S. Looks like morph targets are now hardware rendered in 4.13 :smiley:

Let’s say I have a character with 60 different head shape morphs for nose, eyes, cheek, etc. Is there anyway to save out the head after the morphs have been set? This way I can load the final head instead of re-applying 60 morph target settings.

It’s for an RPG game, the player customizes his hero’s head via morph targets, then I save those morph settings, but then I have to re-apply those morph settings. Wouldn’t it be better to bake out the final result after their done with character creation?