Skip to content

Morph target fixes for CMF Viewer#6

Merged
filipppavlov merged 3 commits into
mainfrom
viewer-morph-normal-fix
Jun 25, 2026
Merged

Morph target fixes for CMF Viewer#6
filipppavlov merged 3 commits into
mainfrom
viewer-morph-normal-fix

Conversation

@filipppavlov

Copy link
Copy Markdown
Contributor

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

Copilot AI review requested due to automatic review settings June 24, 2026 15:13

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 MeshRenderable so it can map animation curve indices to mesh morph-target indices and drive morph weights.
  • Extend geometry prepass Element metadata with usage, 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.

Comment thread src/viewer/rendering/renderable/mesh.cpp
Comment thread src/viewer/rendering/renderable/geometryprepass.cpp
@filipppavlov filipppavlov merged commit de513ee into main Jun 25, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants