Skip to content

Fix: Morph Target animations (Blend Shapes) fail to render when loading GLB files via ResourceLoader#9696

Merged
poweifeng merged 4 commits intogoogle:mainfrom
chenriji:main
Feb 13, 2026
Merged

Fix: Morph Target animations (Blend Shapes) fail to render when loading GLB files via ResourceLoader#9696
poweifeng merged 4 commits intogoogle:mainfrom
chenriji:main

Conversation

@chenriji
Copy link
Contributor

@chenriji chenriji commented Feb 7, 2026

  1. Problem Description When using the Filament engine to render a GLB file exported from Unity, Morph Target animations (e.g., facial expressions like "squinting eyes") fail to display, although they work correctly in the Unity Editor.

  2. Steps to Reproduce

In Unity (2022.3.11): Create a Prefab with Blend Shapes (Morph Targets) and an Animator to control them (e.g., an animation clip that makes the eyes squint).

Export: Use the UnityGLTF tool to export the model as a .glb file (including the Animator and Morph Target tracks).

In Filament: Load and play the animation.

Result: The skeletal animation (bone-based) may play, but the Morph Target effect (squinting) is missing or static.

  1. Root Cause Analysis The issue has been traced back to ResourceLoader.uploadBuffers. It appears that the Morph Target buffer data is not being correctly uploaded or mapped to the GPU during the resource loading phase, causing the vertex offset data to be inaccessible at runtime.

  2. Expected Behavior Morph Target animations should be correctly uploaded and rendered, allowing facial expressions and other blend-shape-based animations to display as expected, matching the source Unity animation.

chenriji and others added 3 commits July 25, 2025 19:38
…compiled to include the required GLSL or SPIR-V chunks for the vertex shader (variant=5, filtered=5)",Because the member variable mVariantFilter is not initialized, random values will appear on Windows 10 or others platform, which eventually causes some variants to be filtered out by this mVariantFilter.
  Morph targets were not working because ResourceLoader skipped all
  accessors without buffer_view. For morph targets, the data can be
  accessed directly via cgltf_accessor_unpack_floats().

  This fix properly unpacks and uploads morph target vertex data to the
  GPU, enabling blendshapes and facial deformation to work correctly.

Steps to Reproduce
1、In Unity (2022.3.11): Create a Prefab with Blend Shapes (Morph Targets) and an Animator to control them (e.g., an animation clip that makes the eyes squint).
2、Export: Use the UnityGLTF tool to export the model as a .glb file (including the Animator and Morph Target tracks).
3、In Filament: Load and play the animation.
4、Result: The skeletal animation (bone-based) may play, but the Morph Target effect (squinting) is missing or static.
@@ -234,9 +234,34 @@ inline void uploadBuffers(FFilamentAsset* asset, Engine& engine,
auto& slots = std::get<FFilamentAsset::ResourceInfo>(asset->mResourceInfo).mBufferSlots;
for (auto const& slot: slots) {
const cgltf_accessor* accessor = slot.accessor;
if (!accessor->buffer_view) {
// Morph target accessors may not have a buffer_view (data is directly in the accessor)
bool isMorphTarget = (slot.morphTargetBuffer != nullptr);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: const bool

@poweifeng poweifeng added the internal Issue/PR does not affect clients label Feb 10, 2026
@poweifeng poweifeng enabled auto-merge (squash) February 13, 2026 22:50
@poweifeng poweifeng merged commit 1ddd10f into google:main Feb 13, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Issue/PR does not affect clients

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants