Skip to content

A posed skinned model is a mesh of its own - #182

Merged
yujiaxu-ops merged 13 commits into
mainfrom
skinned-own-mesh
Nov 21, 2026
Merged

yujiaxu-ops merged 13 commits into
mainfrom
skinned-own-mesh

Conversation

@yujiaxu-ops

@yujiaxu-ops yujiaxu-ops commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Models in the same pose (the same clip and time) shared one mesh, found by the build. One of them taking another pose had to leave it, and that rebuilt the scene; a rebuild then grouped whichever models happened to be in one pose. A model alone in its pose was no mesh at all: world-space triangles, skinned on the CPU.

Now every posed skinned model is an instance of a mesh of its own, skinned by the pass at each new pose, never shared.

  • Another clip or time is in place, whatever the other models do.
  • Hidden and shown in place by its instance. Hidden, a new pose skins nothing; shown, it is skinned as it is posed then, where it stands.
  • What the pass reads of a model is still one copy for all its placements.
  • Gone: the grouping, its key, the switch that turned it off.

Still a rebuild: a skinned model added or removed; one hidden when the scene was built, shown; every pose under software traversal. Still world-space triangles skinned on the CPU: a model with emitting triangles. Each its own step.

Measured

A crowd of 150 walkers in 8 walk phases, hardware traversal, the builds in turn at 60 fps after a run thrown away:

a frame, ms before #181 (8 shared meshes, CPU skin) main (8 shared, the pass) this (150 meshes, the pass)
the commit 2.9 2.1 3.3
the BLAS builds 0.25 0.23 0.6

With the CPU skin the same 150 meshes cost 20 ms of commit (40 fps): the reason the pass came first.

GPU time a frame at 1080p on twelve scenes, two alternated pairs against main after a run thrown away: all within 0.8 % (the crowd, a mesh a walker: +0.2 and +0.3 %). The quality figures against the offline references are main's.

Checks

  • New tests: two models in one pose are two meshes skinned from one copy of the model's corners, posed again in place, and one posed alone in place; one hidden, posed and moved while hidden, shown, each against a build's picture (under software traversal, hidden and shown by a rebuild); four models of two files, each mesh's triangles, attributes and BLAS input on the GPU against the CPU skin, one posed alone and the others' left as they were, one moved alone.
  • The unit tests and the render tests, natively and under software traversal, beside main's on the same machine: 210 unit tests pass both ways; 264 render tests natively; under software traversal the 23 that fail on main, and no other.
  • 10 mutations of the new logic: nine fail a test natively, the tenth (a model hidden where it has no instance to mask) under software traversal.
  • Not run on Vulkan yet.

🤖 Generated with Claude Code


Note

Medium Risk
Touches scene build, GPU skinning, and live edit/commit for animated models; crowd performance shifts toward more BLAS rebuilds, but coverage is broad (inplace + render tests).

Overview
Every posed skinned model now owns a dedicated deforming mesh instead of being grouped with others that share the same clip and time. The build no longer uses PoseGroup / THREERT_POSE_SHARE grouping; each placement gets a scene::Skinned record, MeshKind::Skinned, and its own BLAS that the GPU skinning pass updates per pose change.

Live commit paths follow that model: repose_groups becomes repose_skinned (one job per model), and show_meshes can hide/show a skinned instance in place—pose updates while hidden are deferred until show, when the mesh is re-skinned to the current animation. Software traversal still flattens deforming meshes and may rebuild on hide/show when there is no instance to mask.

Docs and tests reflect the behavior: roadmap notes more BLAS work for large crowds (e.g. 150 walkers), and inplace/render tests assert two models in the same pose are two meshes sharing one skin source, with new coverage for per-model pose, hide/show, and GPU-vs-CPU skin parity.

Reviewed by Cursor Bugbot for commit 54cde25. Bugbot is set up for automated code reviews on this repo. Configure here.

yujiaxu-ops and others added 12 commits November 20, 2026 19:28
…hored tangent follows its joints

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A new shared pose sent every triangle of its mesh: 180 bytes each, skinned on the CPU. Now the CPU sends the pose's
matrices and a compute pass skins the mesh from its model's corners: triangles, shading attributes, BLAS input.
The CPU keeps no triangles of such a pose; a click or a query skins the mesh when it asks.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Models in the same pose shared one mesh, and one of them taking another pose rebuilt the scene. Now a model's mesh
is its own, skinned by the pass at each new pose: another clip or time is in place whatever the others do, and the
model is hidden and shown in place by its instance.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A posed model the scene did not call movable was moved by skinning it again where it stands. One that is an instance
of a deforming mesh was not moved at all: no pose had changed, and nothing rebuilt. Its move is recorded as a move
now; the renderer moves an instance and skins world-space triangles again.

The test's fixture: 72 triangles (two blocks of the pass), a joint turned about an axis that is neither the
normals' nor the tangents', a node that mirrors its mesh, a clip that turns it back. The test: two model files in
two poses (two sources, two jobs), a model moved alone, posed and moved at once, after the scene's buffers grew,
and a pose that mirrors other primitives.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
A mesh's triangles were in its model's order, and first in the GPU's, in every scene the tests had: corners left in
the model's order, and a job counted from the pool's start, passed. The fixture's materials now go light, grey,
light, and the scene has a rect light's card before the meshes.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
# Conflicts:
#	renderer/src/live/inplace_tests.rs
…e rebuild

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@yujiaxu-ops
yujiaxu-ops marked this pull request as ready for review November 21, 2026 09:22
@yujiaxu-ops
yujiaxu-ops changed the base branch from gpu-skinning to main November 21, 2026 09:30
# Conflicts:
#	docs/ROADMAP.md
#	renderer/src/gpu.rs
#	renderer/src/live/edits.rs
#	renderer/src/live/mod.rs
#	renderer/src/scene.rs
@yujiaxu-ops
yujiaxu-ops merged commit 044bfe5 into main Nov 21, 2026
9 checks passed
@yujiaxu-ops
yujiaxu-ops deleted the skinned-own-mesh branch November 21, 2026 09:55
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.

1 participant