Where in the C++ code are morph targets computed?

Hi all,

I am currently dissecting the unreal source code to try to understand the morph target system but so far I have learned very little.

I notice that the material system requires a bUsedWithMorphTargets flag to be set but I cannot identify where this flag is actually used and I also can’t figure out where exactly the morph target animation is computed.

What I am wondering is:

  • Are the blendshapes computed on the CPU or GPU?
  • Where can I find the code where the combination of blendshapes is computed?

Can anyone help answer these questions,
Best regards,

There are CPU and GPU versions of the blend shape renderer (depending on your target). The GPU entry point is in: UnrealEngine\Engine\Source\Runtime\Engine\Private\SkeletalRenderGPUSkin.cpp, in the ‘Update’ function. The morph target data calculation gets ultimate handled in UnrealEngine\Engine\Source\Runtime\Engine\Private\GPUSkinVertexFactory.cpp where you’ll find ‘Material->IsUsedWithMorphTargets()’ referenced.

The animated vertex data for the blend shape is calculated in UnrealEngine\Engine\Source\Runtime\Engine\Private\Components\SkinnedMeshComponent.cpp. ‘UpdateActiveVertexAnims’ is the entry point there.

thanks, thats what I needed