Morph target fixes for CMF Viewer#6
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes morph-target animation playback in the CMF Viewer by (1) binding animation morph-target channels to the corresponding per-mesh morph weights, and (2) correctly handling packed tangents (including legacy packed tangents) during the geometry prepass morphing compute stage.
Changes:
- Propagate the currently selected animation to each
MeshRenderableso it can map animation curve indices to mesh morph-target indices and drive morph weights. - Extend geometry prepass
Elementmetadata withusage, and update the compute shader to treat packed tangents specially during morph application. - Add shader-side tangent packing helpers (legacy + quaternion-based) and orthonormalization utilities.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/viewer/rendering/renderable/model.cpp | Pushes active animation changes down into meshes (clears/sets animation mapping). |
| src/viewer/rendering/renderable/mesh.h | Adds SetAnimation(...) API to allow per-mesh morph curve mapping setup. |
| src/viewer/rendering/renderable/mesh.cpp | Builds a curveIndex→morphTargetIndex mapping and applies sampled curve weights to the prepass + UI state. |
| src/viewer/rendering/renderable/geometryprepass.h | Extends element metadata to include vertex attribute usage. |
| src/viewer/rendering/renderable/geometryprepass.cpp | Populates usage for vertex elements to enable usage-dependent compute behavior. |
| src/viewer/assets/shaders/packed_tangent.inc | Adds packing + orthonormalization helpers for packed tangents (legacy + non-legacy). |
| src/viewer/assets/shaders/geometryprepass.comp | Uses usage to correctly morph packed tangents (legacy vs non-legacy) and re-pack results. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ccp-intern
approved these changes
Jun 25, 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.
Fix animations of morph targets: bind animation curves to morph target weights
Fix packed tangent handling for meshes with morph targets in the geometry prepass