Skip to content

Add Skeletal Animation Component#98

Merged
CubeBerry merged 25 commits intomainfrom
SkeletalAnimation
Apr 2, 2026
Merged

Add Skeletal Animation Component#98
CubeBerry merged 25 commits intomainfrom
SkeletalAnimation

Conversation

@doyoung413
Copy link
Copy Markdown
Collaborator

SkeletalAnimator Component:

  • Supports bone-based animation playback with up to 128 bones.
  • Implements linear blend skinning (LBS) with 4 weights per vertex.
  • Features smooth animation blending (crossfading).
  • Added Root Motion support with customizable baking options.

Animation State Machine:

  • Added SkeletalAnimationStateMachine for managing multiple animation states via keys.
  • Enables seamless state transitions with configurable blend durations.

Shader & Renderer Integration:

  • Updated Slang shaders (3D.slang, GBuffer.slang) to support skinning in both Vertex and Mesh shader pipelines.
  • Enhanced Vulkan renderer to handle bone matrix updates.

doyoung413 and others added 23 commits January 17, 2026 02:36
Implementation Details
- Added vertex data structures and shader logic for hardware skinning
- Integrated bone and weight data extraction into the model loading process
- Developed core components for bone interpolation and animation state management
- Created helper functions for bone data population and matrix conversion
- Implemented bone offset matrix normalization for proper vertex transformations

Vertex Structure Updates
- Extended ThreeDimension::Vertex with bone IDs and weights arrays
- Support up to 4 bone influences per vertex (MAX_BONE_INFLUENCE)
- Support up to 128 bones per mesh (MAX_BONES)
- Added BoneInfo structure containing bone ID and offset matrix
- Initialize bone IDs to -1 and weights to 0.0 by default

Rendering Pipeline
- Added bone IDs attribute at location 7 (ivec4)
- Added bone weights attribute at location 8 (vec4)
- Implemented skeletal data preservation during vertex quantization
- Added finalBones array to vertex uniform buffer
- Integrated with SkeletalAnimator component for runtime animation

Issues
- Skeletal animation loading is functional, but bone hierarchy display and
  mesh application are still in progress
- Bone positions appear incorrect, resulting in abnormal poses
Implementation Details
- Added vertex data structures and shader logic for hardware skinning
- Integrated bone and weight data extraction into the model loading process
- Developed core components for bone interpolation and animation state management
- Created helper functions for bone data population and matrix conversion
- Implemented bone offset matrix normalization for proper vertex transformations

Vertex Structure Updates
- Extended ThreeDimension::Vertex with bone IDs and weights arrays
- Support up to 4 bone influences per vertex (MAX_BONE_INFLUENCE)
- Support up to 128 bones per mesh (MAX_BONES)
- Added BoneInfo structure containing bone ID and offset matrix
- Initialize bone IDs to -1 and weights to 0.0 by default

Rendering Pipeline
- Added bone IDs attribute at location 7 (ivec4)
- Added bone weights attribute at location 8 (vec4)
- Implemented skeletal data preservation during vertex quantization
- Added finalBones array to vertex uniform buffer
- Integrated with SkeletalAnimator component for runtime animation

Issues
- Skeletal animation loading is functional, but bone hierarchy display and
  mesh application are still in progress
- Bone positions appear incorrect, resulting in abnormal poses
Removed redundant GlobalInverseTransform multiplication. Keeping the formula as globalTransformation * offset ensures correct scaling and prevents mesh tearing, especially for FBX models.
…Engine into SkeletalAnimation

# Conflicts:
#	Engine/shaders/glsl/3D.vert
#	Engine/source/BasicComponents/DynamicSprite.cpp
#	Engine/source/BasicComponents/SkeletalAnimator.cpp
#	Engine/source/ObjectManager.cpp
#	Engine/source/RenderManager.cpp
- Resolved the mesh explosion bug occurring during animation playback.
- Fixed incorrect PreRotation transformations.
- Note: Root Motion implementation is still a work in progress (WIP).
- Index caching for position/rotation/scale interpolation
- Removed heavy string allocations by caching dummy node state
- Reduced GetComponent and offset map lookups by passing encodeMatrix directly
- Cleaned up unused variables and functions
- Implemented new skeletal animation demo scene with dynamic lighting effects
- Replaced Physics3D debug meshes with ImGui line rendering
Implementation Details
- Added vertex data structures and shader logic for hardware skinning
- Integrated bone and weight data extraction into the model loading process
- Developed core components for bone interpolation and animation state management
- Created helper functions for bone data population and matrix conversion
- Implemented bone offset matrix normalization for proper vertex transformations

Vertex Structure Updates
- Extended ThreeDimension::Vertex with bone IDs and weights arrays
- Support up to 4 bone influences per vertex (MAX_BONE_INFLUENCE)
- Support up to 128 bones per mesh (MAX_BONES)
- Added BoneInfo structure containing bone ID and offset matrix
- Initialize bone IDs to -1 and weights to 0.0 by default

Rendering Pipeline
- Added bone IDs attribute at location 7 (ivec4)
- Added bone weights attribute at location 8 (vec4)
- Implemented skeletal data preservation during vertex quantization
- Added finalBones array to vertex uniform buffer
- Integrated with SkeletalAnimator component for runtime animation

Issues
- Skeletal animation loading is functional, but bone hierarchy display and
  mesh application are still in progress
- Bone positions appear incorrect, resulting in abnormal poses
Removed redundant GlobalInverseTransform multiplication. Keeping the formula as globalTransformation * offset ensures correct scaling and prevents mesh tearing, especially for FBX models.
Implementation Details
- Added vertex data structures and shader logic for hardware skinning
- Integrated bone and weight data extraction into the model loading process
- Developed core components for bone interpolation and animation state management
- Created helper functions for bone data population and matrix conversion
- Implemented bone offset matrix normalization for proper vertex transformations

Vertex Structure Updates
- Extended ThreeDimension::Vertex with bone IDs and weights arrays
- Support up to 4 bone influences per vertex (MAX_BONE_INFLUENCE)
- Support up to 128 bones per mesh (MAX_BONES)
- Added BoneInfo structure containing bone ID and offset matrix
- Initialize bone IDs to -1 and weights to 0.0 by default

Rendering Pipeline
- Added bone IDs attribute at location 7 (ivec4)
- Added bone weights attribute at location 8 (vec4)
- Implemented skeletal data preservation during vertex quantization
- Added finalBones array to vertex uniform buffer
- Integrated with SkeletalAnimator component for runtime animation

Issues
- Skeletal animation loading is functional, but bone hierarchy display and
  mesh application are still in progress
- Bone positions appear incorrect, resulting in abnormal poses
- Resolved the mesh explosion bug occurring during animation playback.
- Fixed incorrect PreRotation transformations.
- Note: Root Motion implementation is still a work in progress (WIP).
- Index caching for position/rotation/scale interpolation
- Removed heavy string allocations by caching dummy node state
- Reduced GetComponent and offset map lookups by passing encodeMatrix directly
- Cleaned up unused variables and functions
- Implemented new skeletal animation demo scene with dynamic lighting effects
- Replaced Physics3D debug meshes with ImGui line rendering
- Added finalBones array to shader uniform block and implemented skinning loop in 3D.slang.
- Updated VKRenderManager to register boneIDs (loc 7) and weights (loc 8) attributes.
- Wrapped shadow-related shader resources with #if defined(__hlsl__) to prevent validation errors on Vulkan.
- Adjusted WorldToScreen calculation for Vulkan NDC to correctly orient ImGui debug lines.
…Engine into SkeletalAnimation

# Conflicts:
#	Engine/source/ObjectManager.cpp
#	Engine/source/RenderManager.cpp
- Integrated skeletal animation skinning logic into Mesh Shaders (3D.slang, GBuffer.slang)
@CubeBerry CubeBerry added the enhancement New feature or request label Mar 31, 2026
@CubeBerry CubeBerry self-requested a review March 31, 2026 20:19
Copy link
Copy Markdown
Owner

@CubeBerry CubeBerry left a comment

Choose a reason for hiding this comment

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

image image

There is a problem that some duplicated finger meshes are rendered on OpenGL, Vulkan, and DirectX 12.

- Fixed an issue where specific mesh parts (ex:fingertips) would float in the air if they lacked animation tracks in the current clip.
- Updated the logic to calculate final bone matrices using the rig's boneIDMap instead of relying solely on SkeletalBone animation channels.
- This ensures all bones, including those without active animation data, correctly follow the skeletal hierarchy and offset transformations.
- Implemented dynamic root bone detection by traversing the skeleton hierarchy instead of relying on hardcoded name matching.
- Added support for standard animation hierarchies (ex: glTF) by providing fallbacks for missing FBX-specific dummy nodes (_$AssimpFbx$_).
@CubeBerry CubeBerry merged commit 202f03c into main Apr 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants