Skip to content

Conversation

@yohjimane
Copy link
Contributor

temporary pull request to see what claude code can cook up

@yohjimane yohjimane requested a review from Masterkatze as a code owner July 11, 2025 20:31
@github-actions github-actions bot added the External (3rd party) This issue is related to external component used by our project. label Jul 11, 2025
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch from 61723d9 to 2fb7821 Compare July 11, 2025 22:58
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch 3 times, most recently from 63fdece to 6de101e Compare September 19, 2025 01:04
@github-actions github-actions bot added the Game assets A feature or an issue that involves gamedata change label Sep 19, 2025
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch from 5b1c6a4 to 1e6d4b1 Compare September 20, 2025 06:45
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch 4 times, most recently from 090f7ec to f3c89be Compare September 29, 2025 17:12
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch 2 times, most recently from 3fa559f to 15445fa Compare October 1, 2025 21:44
@Xottab-DUTY Xottab-DUTY force-pushed the dev branch 2 times, most recently from e38d9d8 to 94d0261 Compare October 6, 2025 01:24
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch from 37dad2e to e461644 Compare October 7, 2025 05:53
@github-actions github-actions bot added UI AI Artificial Intelligence labels Oct 8, 2025
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch 6 times, most recently from cf02c99 to 5b56947 Compare October 12, 2025 22:56
yohjimane and others added 18 commits October 13, 2025 21:18
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]>
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch from 73e2fba to c047d9e Compare October 14, 2025 04:18
yohjimane and others added 10 commits October 14, 2025 15:32
- 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]>
@yohjimane yohjimane force-pushed the yohji/feat/ozz-animation branch from 0d20e18 to b97914c Compare October 15, 2025 08:20
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

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

2 participants