Ragdoll rendering: skeletal mesh deformation from bone transforms #29

Open
opened 2026-03-18 09:30:31 +00:00 by kit · 0 comments
Owner

Currently entities using MDL models are rendered as rigid meshes in their rest pose (T-pose). Bone transforms are baked into vertex positions at load time (mdl/loader.js computeBoneWorldTransforms), and the entire mesh moves as a single rigid body based on entity position/rotation.

For ragdolls (and eventually animated entities), we need to deform the mesh using per-bone transforms.

Server side

  • Read per-bone transforms (position + quaternion) from ragdoll entities via the engine
  • Include bone data in the entity snapshot binary format
  • Only needs to apply to entities with active ragdoll physics (not all entities)

Client side

  • Switch from baked rest-pose vertices to GPU skinning (bone matrices as uniforms or a texture)
  • Build the mesh with bone indices and weights preserved from VVD data
  • Apply per-bone transforms each frame instead of a single rigid body transform

Notes

  • VVD files already contain bone indices and weights per vertex — we just discard the skinning relationship during the bake step
  • Source engine ragdolls use vphysics bone simulation, so the bone transforms come from the physics system rather than animation sequences
  • This is a prerequisite for proper animation support later (same skinning pipeline, different source of bone transforms)
Currently entities using MDL models are rendered as rigid meshes in their rest pose (T-pose). Bone transforms are baked into vertex positions at load time (`mdl/loader.js` `computeBoneWorldTransforms`), and the entire mesh moves as a single rigid body based on entity position/rotation. For ragdolls (and eventually animated entities), we need to deform the mesh using per-bone transforms. ### Server side - Read per-bone transforms (position + quaternion) from ragdoll entities via the engine - Include bone data in the entity snapshot binary format - Only needs to apply to entities with active ragdoll physics (not all entities) ### Client side - Switch from baked rest-pose vertices to GPU skinning (bone matrices as uniforms or a texture) - Build the mesh with bone indices and weights preserved from VVD data - Apply per-bone transforms each frame instead of a single rigid body transform ### Notes - VVD files already contain bone indices and weights per vertex — we just discard the skinning relationship during the bake step - Source engine ragdolls use `vphysics` bone simulation, so the bone transforms come from the physics system rather than animation sequences - This is a prerequisite for proper animation support later (same skinning pipeline, different source of bone transforms)
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kit/gmod-web-stream#29
No description provided.