Communitygithub.com

ComeOnOliver/skillshub

Importa, procesa y retargetea datos de captura de movimiento en Blender usando Python. Trabaja con archivos BVH/FBX, rastrea movimiento de cámara y objetos desde video, resuelve trayectorias 3D y limpia datos de animación, todo desde la terminal.

¿Qué es skillshub?

Esta habilidad permite a un agente de IA trabajar con datos de captura de movimiento (mocap) directamente en Blender, utilizando scripts de Python ejecutados desde la terminal. Es ideal para desarrolladores y artistas técnicos que necesitan automatizar flujos de trabajo de animación, como importar archivos BVH y FBX, retargetear animaciones entre diferentes armaduras, limpiar datos de animación mediante decimación de keyframes, y realizar seguimiento de movimiento de cámara a partir de video para resolver trayectorias 3D. Soporta las plataformas Blender y sus APIs de Python, y se integra con otros sistemas mediante exportación a formatos estándar. La habilidad se basa en documentación detallada (SKILL.md) que incluye ejemplos concretos y fragmentos de código listos para usar, lo que facilita su implementación en proyectos reales de animación y producción de contenido.

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

Preguntar en tu IA favorita

Abre un nuevo chat con esta habilidad de agente ya precargada.

Documentación

Captura de Movimiento en Blender

Resumen

Importa, procesa y retargetea datos de captura de movimiento en Blender usando Python. Trabaja con archivos BVH/FBX, rastrea movimiento de cámara y objetos desde video, resuelve trayectorias 3D y limpia datos de animación, todo desde la terminal.

Instrucciones

1. Importar archivos BVH de captura de movimiento

import bpy

bpy.ops.import_anim.bvh(
    filepath="/ruta/al/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"Importado: {armature.name}, Huesos: {len(armature.data.bones)}, Fotogramas: {action.frame_range}")

2. Importar FBX con animación

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

3. Retargetear movimiento entre armaduras

from mathutils import Matrix

def retarget_motion(armadura_fuente, armadura_destino, mapeo_huesos):
    """Retargetear animación usando un mapeo de nombres de huesos: {hueso_destino: hueso_fuente}"""
    accion_fuente = armadura_fuente.animation_data.action
    inicio_fotograma, fin_fotograma = int(accion_fuente.frame_range[0]), int(accion_fuente.frame_range[1])

    if not armadura_destino.animation_data:
        armadura_destino.animation_data_create()
    nueva_accion = bpy.data.actions.new(f"{accion_fuente.name}_retarget")
    armadura_destino.animation_data.action = nueva_accion

    for fotograma in range(inicio_fotograma, fin_fotograma + 1):
        bpy.context.scene.frame_set(fotograma)
        for nom_dest, nom_fuente in mapeo_huesos.items():
            fuente = armadura_fuente.pose.bones.get(nom_fuente)
            destino = armadura_destino.pose.bones.get(nom_dest)
            if not fuente or not destino:
                continue
            destino.rotation_quaternion = fuente.rotation_quaternion
            destino.keyframe_insert(data_path="rotation_quaternion", frame=fotograma)
            # Copiar ubicación solo para el hueso raíz
            if nom_fuente == list(mapeo_huesos.values())[0]:
                destino.location = fuente.location
                destino.keyframe_insert(data_path="location", frame=fotograma)

# Ejemplo de mapeo Mixamo → Rigify
mapeo = {
    "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. Limpiar datos de captura de movimiento

def diezmar_curva_f(curva_f, factor=0.5):
    """Eliminar fotogramas clave para reducir datos manteniendo la forma."""
    puntos = curva_f.keyframe_points
    total = len(puntos)
    conservar_cada = max(1, int(1.0 / factor))
    indices_eliminar = [i for i in range(total) if i % conservar_cada != 0 and i != 0 and i != total - 1]
    for i in reversed(indices_eliminar):
        puntos.remove(puntos[i])

armadura = bpy.context.active_object
accion = armadura.animation_data.action
for curva_f in accion.fcurves:
    diezmar_curva_f(curva_f, factor=0.5)
    curva_f.update()

5. Seguimiento de movimiento por video y resolución de cámara

# Cargar material grabado
clip = bpy.data.movieclips.load("/ruta/al/material.mp4")
escena = bpy.context.scene
escena.active_clip = clip

# Configurar seguimiento
seguimiento = clip.tracking
config = seguimiento.settings
config.default_pattern_size = 21
config.default_search_size = 71
config.default_motion_model = 'AFFINE'

# Configuración de cámara para resolución
camara = seguimiento.camera
camara.sensor_width = 36.0
camara.focal_length = 50.0

# Resolver movimiento de cámara
bpy.ops.clip.solve_camera()
error_resolucion = seguimiento.reconstruction.average_error
print(f"Error de resolución: {error_resolucion:.4f} px ({'Bueno' if error_resolucion < 0.5 else 'Necesita refinamiento'})")

# Configurar escena a partir de datos resueltos
bpy.ops.clip.setup_tracking_scene()

6. Aplicar movimiento rastreado a objetos

obj = bpy.data.objects["MiObjeto"]
restriccion = obj.constraints.new(type='FOLLOW_TRACK')
restriccion.clip = clip
restriccion.track = seguimiento.tracks["Marcador_01"]
restriccion.use_3d_position = True
restriccion.camera = escena.camera

# Hornear restricción a fotogramas clave
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. Exportar datos de animación

# Exportar como BVH
bpy.ops.export_anim.bvh(
    filepath="/tmp/salida_mocap.bvh",
    frame_start=int(accion.frame_range[0]),
    frame_end=int(accion.frame_range[1]),
    rotate_mode='NATIVE'
)

# Exportar como FBX con animación horneada
bpy.ops.export_scene.fbx(
    filepath="/tmp/salida_anim.fbx",
    use_selection=True, bake_anim=True,
    bake_anim_use_all_bones=True, add_leaf_bones=False
)

Ejemplos

Ejemplo 1: Escaneo por lotes de biblioteca mocap

Solicitud del usuario: "Importar todos los archivos BVH de una carpeta, listar recuentos de huesos y rangos de fotogramas"

import bpy, glob, os

for ruta_archivo in sorted(glob.glob("/ruta/a/biblioteca_mocap/*.bvh")):
    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete()
    bpy.ops.import_anim.bvh(filepath=ruta_archivo, target='ARMATURE', global_scale=0.01, frame_start=1)
    brazo = bpy.context.active_object
    if brazo and brazo.animation_data:
        accion = brazo.animation_data.action
        duracion = (accion.frame_range[1] - accion.frame_range[0]) / bpy.context.scene.render.fps
        print(f"{os.path.basename(ruta_archivo)}: {len(brazo.data.bones)} huesos, {duracion:.1f}s")

Ejecutar: blender --background --python escanear_mocap.py

Ejemplo 2: Aplicar mocap a personaje y renderizar

Solicitud del usuario: "Importar un archivo BVH, aplicarlo a mi personaje riggeado y renderizar una vista previa"

import bpy

bpy.ops.wm.open_mainfile(filepath="/ruta/al/personaje.blend")
armadura_personaje = bpy.data.objects["Armature"]

bpy.ops.import_anim.bvh(filepath="/ruta/al/ciclo_caminar.bvh", target='ARMATURE', global_scale=0.01)
armadura_mocap = bpy.context.active_object
accion_mocap = armadura_mocap.animation_data.action

# Transferir acción (funciona cuando los nombres de huesos coinciden)
if not armadura_personaje.animation_data:
    armadura_personaje.animation_data_create()
armadura_personaje.animation_data.action = accion_mocap

# Eliminar armadura temporal, establecer rango de fotogramas, añadir cámara, renderizar
bpy.data.objects.remove(armadura_mocap)
escena = bpy.context.scene
escena.frame_start, escena.frame_end = int(accion_mocap.frame_range[0]), int(accion_mocap.frame_range[1])
escena.render.filepath = "/tmp/vista_previa_mocap/fotograma_"
bpy.ops.render.render(animation=True)

Directrices

  • BVH es el formato más simple (texto plano con jerarquía + movimiento). FBX soporta datos más ricos (blend shapes, múltiples tomas).
  • La escala es importante: los archivos BVH suelen usar centímetros. Establece global_scale=0.01 para archivos basados en cm.
  • La coincidencia de nombres de huesos es crítica para el retargeting. Construye un diccionario de mapeo para cada formato fuente.
  • Para retargetear, copia rotaciones para todos los huesos pero solo ubicación para el hueso raíz/cadera.
  • Limpia el mocap importado diezmando fotogramas clave: el mocap crudo tiene fotogramas en cada clave, lo que dificulta la edición.
  • La calidad de la resolución de cámara depende del número y distribución de marcadores. Usa 8+ marcadores bien distribuidos, mantén el error por debajo de 0.5 px.
  • Usa bpy.ops.nla.bake() para convertir restricciones a fotogramas clave para exportación.
  • Siempre exporta con bake_anim=True en FBX para aplanar tiras NLA y restricciones.

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

Skills relacionados