-
-
Notifications
You must be signed in to change notification settings - Fork 488
Ozz Animation Refactor #1914
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
yohjimane
wants to merge
235
commits into
dev
Choose a base branch
from
yohji/feat/ozz-animation
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Ozz Animation Refactor #1914
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61723d9 to
2fb7821
Compare
63fdece to
6de101e
Compare
5b1c6a4 to
1e6d4b1
Compare
090f7ec to
f3c89be
Compare
3fa559f to
15445fa
Compare
e38d9d8 to
94d0261
Compare
37dad2e to
e461644
Compare
cf02c99 to
5b56947
Compare
Major documentation reorganization to improve maintainability and clarity: STATUS Documents (Overview & Current State): - NEW: OZZ_KINEMATICS_INTEGRATION_STATUS.md Consolidated from: README.md, ozz_kinematics_integration.md, STARTUP_CONVERSION_STAGE.md Contains: Executive summary, current status, architecture overview, roadmap - KEPT: ECS_IK_REFACTOR_STATUS.md Already comprehensive IK/Ragdoll 6-phase implementation plan DETAILS Documents (Technical Deep Dives): - NEW: OZZ_KINEMATICS_INTEGRATION_DETAILS.md Consolidated from: ExtendedBoneRecordPlan.md, OzzMotionContainer_Refactor.md Contains: Extended bone metadata, shared motion container, performance optimizations - NEW: ECS_IK_REFACTOR_DETAILS.md Consolidated from: ECS_ARCHITECTURE_ANALYSIS.md, ECS_MIGRATION_PLAN.md Contains: Current architecture analysis, ECS migration strategy, EnTT integration Agent Documentation: - UPDATED: CLAUDE.md Merged with: AGENT_DOCS.md Contains: Session context, project guide, critical build info, implementation insights - NEW: CLAUDE_COMMANDS.md (renamed from AGENT_COMMANDS.md) Contains: Quick reference for all commands (testing, debugging, conversion) - NEW: CLAUDE_CONTEXT.md (extracted from AGENT_NEXT_STEPS.md) Contains: Performance patterns, threading, memory management, code organization Removed redundant files (10 files): - docs/README.md - docs/ozz_kinematics_integration.md - docs/STARTUP_CONVERSION_STAGE.md - docs/ExtendedBoneRecordPlan.md - OzzMotionContainer_Refactor.md - docs/ECS_ARCHITECTURE_ANALYSIS.md - docs/ECS_MIGRATION_PLAN.md - AGENTS.md, AGENT_NEXT_STEPS.md, AGENT_DOCS.md - fixes/ directory (old patch files) Result: 9 well-organized markdown files (down from 19) - 4 STATUS/DETAILS pairs for main topics - 3 agent documentation files - 2 tool-specific docs All technical information preserved - no data loss. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
…pport Implements interactive IK testing UI in ozz_animation_viewer with full support for simultaneous multi-limb IK control. IK Panel Features: - Individual limb enable/disable (Left Leg, Right Leg, Left Arm, Right Arm) - Enable All / Disable All buttons for legs and arms - Real-time target offset adjustment (X, Y, Z drag sliders) - IK parameter tuning (weight, soften, twist angle) - Status feedback (target reached / out of reach) - Panel visibility toggle via View menu IK Solver Improvements: - Per-limb rebuild strategy to handle skeleton hierarchy dependencies - Left/right limb auto-detection based on bind pose X position - Multi-limb simultaneous IK (all 4 limbs independently controlled) - Proper parent transform propagation between limb solves Technical Details: - Skeleton hierarchy issue: limbs share parent bones (pelvis, spine) - Solution: Rebuild models[] after each limb solve (4 rebuilds/frame) - Cost: ~0.08ms per character (4x LocalToModelJob @ ~0.02ms each) - Alternative single-rebuild approach failed due to stale parent transforms Files Modified: - src/xrAnimation/tools/ozz_animation_viewer.cpp - Added DrawIKPanel() with full UI controls - Added View menu with panel visibility toggles - Updated ViewerState with visibility flags - Fixed IK initialization to compute bind pose properly - src/xrAnimation/AnimationECS_IK.cpp - Implemented per-limb rebuild in IKSolverSystem::Update() - Added left/right auto-detection for legs and arms - Removed group-based rebuild (caused hierarchy issues) - src/xrAnimation/docs/ECS_IK_REFACTOR_STATUS.md - Updated current status with IK panel completion - Added technical implementation notes - Documented per-limb rebuild strategy and rationale 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add comprehensive architecture and implementation plan for refactoring skeleton debug rendering and IK gizmo rendering to use proper ECS patterns. Key improvements: - Abstract IDebugDrawContext interface for renderer independence - Move rendering logic from VulkanRenderer to ECS systems - Enable reuse in both ozz_animation_viewer (Vulkan) and xrGame (OpenGL/DX11) - Eliminate tight coupling and void* casting - Add SkeletonMetadata component for per-entity hierarchy storage Document includes: - Current state analysis with specific file locations - Proposed 3-layer architecture (Interface/Systems/Application) - 6 implementation phases with code examples - Engine integration strategy using existing DBG_DRAW functions - Testing strategy and estimated timeline (~5-6 hours) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Phases 1-3 of ECS debug rendering refactoring: Phase 1: Abstract Interface - Add IDebugDrawContext: Platform-agnostic debug drawing interface - Pure virtual methods: DrawLine, DrawSphere, DrawBoneShape, DrawAxes - Decouples ECS systems from specific renderers Phase 2: ECS Rendering Systems - Add SkeletonDebugRenderSystem: Renders skeleton bones using ECS components - Add IKGizmoRenderSystem: Renders IK target gizmos using ECS components - Move all rendering logic from VulkanRenderer/ozz_animation_viewer into systems - Systems accept IDebugDrawContext& for renderer-independent operation Phase 3: Metadata Component - Add SkeletonMetadata component: Per-entity skeleton hierarchy storage - Stores joint parent indices and ExtendedBoneMetadataCollection - Eliminates need for global metadata passing Benefits: - Renderer-independent: Works with Vulkan, OpenGL, DX11, or mock - Reusable: Same code works in ozz_animation_viewer and xrGame - Composable: Easy to add new debug visualizations - Testable: Can use mock IDebugDrawContext for unit tests Next phases: - Phase 4: Implement IDebugDrawContext in VulkanRenderer (adapter pattern) - Phase 5: Update call sites in ozz_animation_viewer - Phase 6: Remove old deprecated rendering code Related: ECS_DEBUG_PLAN.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Phase 4 of ECS debug rendering refactoring: Make VulkanRenderer implement IDebugDrawContext interface: - Add inheritance: class VulkanRenderer : public AnimationECS::IDebugDrawContext - Implement DrawLine() - forwards to debug_renderer_.DrawLine() - Implement DrawSphere() - forwards to debug_renderer_.DrawSphere() - Implement DrawBoneShape() - forwards to debug_renderer_.DrawBoneShape() - Implement DrawAxes() - forwards to debug_renderer_.DrawAxes() Benefits: - VulkanRenderer now satisfies IDebugDrawContext contract - All methods use simple adapter/forwarding pattern (no logic) - ECS rendering systems can now accept VulkanRenderer as debug context - Maintains clean separation: interface (ECS) → adapter (VulkanRenderer) → implementation (DebugRenderer) Next phases: - Phase 5: Update call sites in ozz_animation_viewer to use new ECS systems - Phase 6: Remove old deprecated rendering code Related: ECS_DEBUG_PLAN.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Replaced CPU-side per-bone geometry generation with proper GPU instancing:
**Before:**
- Generated ~37,000+ vertices CPU-side every frame
- 47 bones × (24 octahedron verts + 2 spheres × 384 verts each)
- Heavy CPU load, inefficient memory transfers
**After (True GPU Instancing):**
- Generate unit geometry ONCE at initialization:
- Unit octahedron: 24 vertices (generated once)
- Unit sphere: ~384 vertices (generated once)
- Per-frame: Only upload 47 transform matrices + colors (InstanceData)
- GPU draws: 2 draw calls total (one for octahedrons, one for spheres)
**Performance Improvement:**
- Vertex data uploaded: ~37,000 verts → 408 verts (unit geometry)
- Per-frame uploads: 47 × 80 bytes = 3,760 bytes (transforms + colors only)
- Draw calls: Same bone shape rendered 47 times with ONE draw call
**Implementation Details:**
1. **New Shaders** (src/xrAnimation/tools/renderer/shaders/bone_instanced.{vert,frag}):
- Per-vertex: position + normal (unit geometry)
- Per-instance: mat4 transform + vec4 color
2. **Unit Geometry Generation** (GenerateUnitOctahedron/GenerateUnitSphere):
- Called once in Initialize()
- Stored in GPU buffers permanently
3. **Instance Buffer Management**:
- Uploads per-instance transforms + colors each frame
- Combined buffer for bones and spheres (drawn with different firstInstance)
4. **Instanced Draw Calls**:
- vkCmdDraw(cmd, unit_octahedron_vertex_count, bone_count, 0, 0)
- vkCmdDraw(cmd, unit_sphere_vertex_count, sphere_count, 0, bone_count)
**Files Changed:**
- src/xrAnimation/tools/renderer/DebugRenderer.{h,cpp}: GPU instancing implementation
- src/xrAnimation/tools/renderer/shaders/bone_instanced.{vert,frag}: Instanced shaders
- src/xrAnimation/tools/CMakeLists.txt: Added shader compilation for bone_instanced
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>
73e2fba to
c047d9e
Compare
- Skip struct/object types before type validation - Add support for uint and void shader variable types - Only process D3D_CT_CBUFFER (not structured buffers as cbuffers) - Improve error messages with variable details Fixes compute shader compilation errors where RWStructuredBuffer was incorrectly parsed as a constant buffer, causing "size must be multiple of 16 bytes" errors. Structured buffers are UAVs/SRVs, not cbuffers. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
0d20e18 to
b97914c
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
AI
Artificial Intelligence
External (3rd party)
This issue is related to external component used by our project.
Game assets
A feature or an issue that involves gamedata change
Renderer
UI
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
temporary pull request to see what claude code can cook up