Skip to content

[Feature] GPU skinning #163

@vmarcella

Description

@vmarcella

Overview

Add GPU-based mesh skinning that deforms vertex positions based on bone
transforms for rendering animated characters.

Current State

No response

Scope

Goals:

  • Vertex shader skinning
  • Support up to 4 bone influences per vertex
  • Skin matrix uniform buffer
  • Integrate with existing pipeline system

Non-Goals:

  • CPU skinning
  • Morph targets/blend shapes
  • Dual quaternion skinning

Proposed API

ub struct SkinnedMesh {
mesh: Mesh,
joint_indices: Vec<[u8; 4]>, // per-vertex bone indices
joint_weights: Vec<[f32; 4]>, // per-vertex bone weights
}

pub struct SkinningData {
matrices: Vec<[[f32; 4]; 4]>, // MAX_BONES matrices
}

impl SkinningData {
pub fn from_pose(pose: &Pose, skeleton: &Skeleton) -> Self;
pub fn to_buffer(&self) -> Vec;
}

// Vertex shader receives joint_indices and joint_weights as attributes
// Uniform buffer contains skin matrices


### Acceptance Criteria

- [ ] Skinned mesh deforms with bone movement
- [ ] Multiple bone influences blend correctly
- [ ] Skin matrices uploaded each frame
- [ ] Shader correctly transforms vertices
- [ ] Example rendering animated character

### Affected Crates

lambda-rs

### Notes

- MAX_BONES typically 64-256
- Joint indices packed as u8 or u16
- Weight normalization (should sum to 1.0)

Metadata

Metadata

Assignees

No one assigned

    Labels

    animationAll things related to animationsenhancementNew feature or requestlambda-rsIssues pertaining to the core framework

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions