arkavo-org / arkavo-org/VRMMetalKit
MorphTargetCompute: dispatch over per-target affected vertex ranges
- Dominant language
- Swift
- Stars
- 6
- Forks
- 2
- Avg merge
- 18h 51m
- Merged PRs (30d)
- 26
Description
## Source
Romero perf review, item 5.
## Problem
Facial expressions typically touch 5–15% of a VRoid mesh's vertices (face + mouth region), but the morph compute kernel currently dispatches over every vertex. For a 40 k-vertex avatar with 4 k face-region vertices, the kernel does ~10× more work than necessary.
## Proposed change
Precompute at load time a per-morph-target affected-vertex index buffer (the subset of vertices that target writes). At dispatch time, run the kernel as an indirect dispatch over the union of active morphs' index buffers.
## Affected
- `Sources/VRMMetalKit/Renderer/Systems/VRMMorphTargetSystem.swift`
- `Sources/VRMMetalKit/Shaders/MorphTargetShader.metal`
## Related
- #150 — orthogonal "skip whole pass when weights unchanged" optimisation; this issue covers within-pass workload reduction.
- #127 — dead-code cleanup in MorphTargetCompute.metal
- #156 — measure before/after
Contributor guide
Research direction
Read Sources/VRMMetalKit/Renderer/Systems/VRMMorphTargetSystem.swift and Sources/VRMMetalKit/Shaders/MorphTargetShader.metal to trace morph loading and dispatch. Determine how affected vertex ranges and active morphs are represented, then implement the proposed indirect dispatch over their union. Done means the kernel processes only affected vertices while preserving morph output; use #156 for before/after measurement.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- computer-graphics, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100