Communitygithub.com

ComeOnOliver/skillshub

Blender에서 Python을 사용하여 모션 캡처 데이터를 가져오고, 처리하고, 리타겟팅합니다. BVH/FBX 모캡 파일 작업, 비디오 영상에서 카메라 및 객체 움직임 추적, 3D 카메라 경로 해결, 애니메이션 데이터 정리 등을 터미널에서 스크립트 가능하게 수행합니다.

skillshub란 무엇인가요?

이 스킬은 Blender 환경 내에서 모션 캡처(mocap) 데이터를 처리하기 위한 포괄적인 Python 기반 워크플로우를 제공합니다. 개발자는 BVH 및 FBX 파일을 손쉽게 가져오고, 서로 다른 아마추어 간에 모션을 리타겟팅하며(예: Mixamo에서 Rigify로), 키프레임 감소를 통해 원시 모캡 데이터를 정리할 수 있습니다. 또한 이 스킬은 비디오 푸티지에서 카메라 및 객체 움직임을 추적하고, 3D 카메라 경로를 해결하며, 추적 데이터를 객체에 적용하는 기능을 지원합니다. 이러한 모든 작업은 Blender의 Python API(bpy)를 통해 수행되므로 완전한 자동화와 CI/CD 파이프라인 통합이 가능하며, `blender --background --python script.py`와 같은 명령어로 헤드리스 실행이 가능합니다. 이 스킬은 Claude Code, Cursor, Codex와 같은 AI 에이전트와의 사용에 적합하며, AI 에이전트가 Blender 프로젝트 내에서 복잡한 모션 캡처 및 컴퓨터 비전 작업을 수행할 수 있도록 지원합니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/TerminalSkills/skills/blender-motion-capture

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

블렌더 모션 캡처

개요

Blender에서 Python을 사용하여 모션 캡처 데이터를 가져오고, 처리하고, 리타겟팅합니다. BVH/FBX 모캡 파일 작업, 비디오 영상에서 카메라 및 객체 움직임 추적, 3D 카메라 경로 해결, 애니메이션 데이터 정리 등을 터미널에서 스크립트 가능하게 수행합니다.

지침

1. BVH 모션 캡처 파일 가져오기

import bpy

bpy.ops.import_anim.bvh(
    filepath="/path/to/mocap.bvh",
    target='ARMATURE',
    global_scale=1.0,
    frame_start=1,
    use_fps_scale=False,
    rotate_mode='NATIVE',
    axis_forward='-Z', axis_up='Y'
)

armature = bpy.context.active_object
action = armature.animation_data.action
print(f"가져오기 완료: {armature.name}, 본 개수: {len(armature.data.bones)}, 프레임: {action.frame_range}")

2. 애니메이션이 포함된 FBX 가져오기

bpy.ops.import_scene.fbx(
    filepath="/path/to/mocap.fbx",
    use_anim=True,
    ignore_leaf_bones=True,
    automatic_bone_orientation=True,
    primary_bone_axis='Y', secondary_bone_axis='X'
)

3. 아마추어 간 모션 리타겟팅

from mathutils import Matrix

def retarget_motion(source_armature, target_armature, bone_mapping):
    """본 이름 매핑을 사용하여 애니메이션 리타겟팅: {target_bone: source_bone}"""
    source_action = source_armature.animation_data.action
    frame_start, frame_end = int(source_action.frame_range[0]), int(source_action.frame_range[1])

    if not target_armature.animation_data:
        target_armature.animation_data_create()
    new_action = bpy.data.actions.new(f"{source_action.name}_retarget")
    target_armature.animation_data.action = new_action

    for frame in range(frame_start, frame_end + 1):
        bpy.context.scene.frame_set(frame)
        for tgt_name, src_name in bone_mapping.items():
            src = source_armature.pose.bones.get(src_name)
            tgt = target_armature.pose.bones.get(tgt_name)
            if not src or not tgt:
                continue
            tgt.rotation_quaternion = src.rotation_quaternion
            tgt.keyframe_insert(data_path="rotation_quaternion", frame=frame)
            # 루트 본에만 위치 복사
            if src_name == list(bone_mapping.values())[0]:
                tgt.location = src.location
                tgt.keyframe_insert(data_path="location", frame=frame)

# 예: Mixamo → Rigify 매핑
mapping = {
    "spine": "mixamorig:Hips", "spine.001": "mixamorig:Spine",
    "spine.004": "mixamorig:Neck", "spine.006": "mixamorig:Head",
    "upper_arm.L": "mixamorig:LeftArm", "forearm.L": "mixamorig:LeftForeArm",
    "upper_arm.R": "mixamorig:RightArm", "forearm.R": "mixamorig:RightForeArm",
    "thigh.L": "mixamorig:LeftUpLeg", "shin.L": "mixamorig:LeftLeg",
    "thigh.R": "mixamorig:RightUpLeg", "shin.R": "mixamorig:RightLeg",
}

4. 모션 캡처 데이터 정리

def decimate_fcurve(fcurve, factor=0.5):
    """형태를 유지하면서 데이터를 줄이기 위해 키프레임 제거."""
    points = fcurve.keyframe_points
    total = len(points)
    keep_every = max(1, int(1.0 / factor))
    remove_indices = [i for i in range(total) if i % keep_every != 0 and i != 0 and i != total - 1]
    for i in reversed(remove_indices):
        points.remove(points[i])

armature = bpy.context.active_object
action = armature.animation_data.action
for fcurve in action.fcurves:
    decimate_fcurve(fcurve, factor=0.5)
    fcurve.update()

5. 비디오 모션 트래킹 및 카메라 해결

# 푸티지 로드
clip = bpy.data.movieclips.load("/path/to/footage.mp4")
scene = bpy.context.scene
scene.active_clip = clip

# 트래킹 설정
tracking = clip.tracking
settings = tracking.settings
settings.default_pattern_size = 21
settings.default_search_size = 71
settings.default_motion_model = 'AFFINE'

# 해결을 위한 카메라 설정
camera = tracking.camera
camera.sensor_width = 36.0
camera.focal_length = 50.0

# 카메라 모션 해결
bpy.ops.clip.solve_camera()
solve_error = tracking.reconstruction.average_error
print(f"해결 오류: {solve_error:.4f} px ({'양호' if solve_error < 0.5 else '개선 필요'})")

# 해결된 데이터로 씬 설정
bpy.ops.clip.setup_tracking_scene()

6. 추적된 모션을 객체에 적용

obj = bpy.data.objects["MyObject"]
constraint = obj.constraints.new(type='FOLLOW_TRACK')
constraint.clip = clip
constraint.track = tracking.tracks["Marker_01"]
constraint.use_3d_position = True
constraint.camera = scene.camera

# 제약 조건을 키프레임으로 베이크
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bpy.ops.nla.bake(
    frame_start=1, frame_end=clip.frame_duration,
    only_selected=True, visual_keying=True,
    clear_constraints=True, bake_types={'OBJECT'}
)

7. 애니메이션 데이터 내보내기

# BVH로 내보내기
bpy.ops.export_anim.bvh(
    filepath="/tmp/output_mocap.bvh",
    frame_start=int(action.frame_range[0]),
    frame_end=int(action.frame_range[1]),
    rotate_mode='NATIVE'
)

# 베이크된 애니메이션과 함께 FBX로 내보내기
bpy.ops.export_scene.fbx(
    filepath="/tmp/output_anim.fbx",
    use_selection=True, bake_anim=True,
    bake_anim_use_all_bones=True, add_leaf_bones=False
)

예제

예제 1: 모캡 라이브러리 배치 스캔

사용자 요청: "폴더에서 모든 BVH 파일을 가져와 본 개수와 프레임 범위를 나열해"

import bpy, glob, os

for filepath in sorted(glob.glob("/path/to/mocap_library/*.bvh")):
    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete()
    bpy.ops.import_anim.bvh(filepath=filepath, target='ARMATURE', global_scale=0.01, frame_start=1)
    arm = bpy.context.active_object
    if arm and arm.animation_data:
        action = arm.animation_data.action
        duration = (action.frame_range[1] - action.frame_range[0]) / bpy.context.scene.render.fps
        print(f"{os.path.basename(filepath)}: {len(arm.data.bones)}개의 본, {duration:.1f}초")

실행: blender --background --python scan_mocap.py

예제 2: 캐릭터에 모캡 적용 및 렌더링

사용자 요청: "BVH 파일을 가져와 내 리깅된 캐릭터에 적용하고 미리보기를 렌더링해"

import bpy

bpy.ops.wm.open_mainfile(filepath="/path/to/character.blend")
char_armature = bpy.data.objects["Armature"]

bpy.ops.import_anim.bvh(filepath="/path/to/walk_cycle.bvh", target='ARMATURE', global_scale=0.01)
mocap_armature = bpy.context.active_object
mocap_action = mocap_armature.animation_data.action

# 액션 전송 (본 이름이 일치할 때 작동)
if not char_armature.animation_data:
    char_armature.animation_data_create()
char_armature.animation_data.action = mocap_action

# 임시 아마추어 제거, 프레임 범위 설정, 카메라 추가, 렌더링
bpy.data.objects.remove(mocap_armature)
scene = bpy.context.scene
scene.frame_start, scene.frame_end = int(mocap_action.frame_range[0]), int(mocap_action.frame_range[1])
scene.render.filepath = "/tmp/mocap_preview/frame_"
bpy.ops.render.render(animation=True)

지침

  • BVH는 가장 간단합니다(계층 구조 + 모션이 있는 일반 텍스트). FBX는 더 풍부한 데이터(블렌드 셰이프, 여러 테이크)를 지원합니다.
  • 스케일이 중요합니다: BVH 파일은 종종 센티미터 단위를 사용합니다. cm 기반 파일의 경우 global_scale=0.01로 설정하세요.
  • 리타겟팅을 위해 본 이름 일치가 중요합니다. 각 소스 형식에 대한 매핑 사전을 구축하세요.
  • 리타겟팅 시 모든 본의 회전은 복사하지만 위치는 루트/엉덩이 본에 대해서만 복사하세요.
  • 가져온 모캡 데이터는 키프레임을 간소화하여 정리하세요. 원시 모캡은 모든 프레임에 키가 있어 편집이 어렵습니다.
  • 카메라 해결 품질은 마커 개수와 분포에 따라 달라집니다. 8개 이상의 잘 분포된 마커를 사용하고 오류를 0.5px 미만으로 유지하세요.
  • 내보내기를 위해 제약 조건을 키프레임으로 변환하려면 bpy.ops.nla.bake()를 사용하세요.
  • FBX에서 NLA 스트립과 제약 조건을 평탄화하려면 항상 bake_anim=True로 내보내세요.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

관련 스킬