Fix: Morph Target animations (Blend Shapes) fail to render when loading GLB files via ResourceLoader#9696
Merged
poweifeng merged 4 commits intogoogle:mainfrom Feb 13, 2026
Merged
Conversation
…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.
poweifeng
approved these changes
Feb 9, 2026
| @@ -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); | |||
z3moon
approved these changes
Feb 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
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.
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.
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.