Communitygithub.com

blender-camera-animations

在Blender中生成产品的相机动画——转盘、完美循环、慢速推近、滑动旋转、升降镜头、变速全循环,并渲染输出为视频。

blender-camera-animations 是什么?

该技能可自动为Blender场景中的3D模型生成六种专业级相机运动动画。用户只需指定镜头类型(如转盘、无缝循环、慢速推近、滑动旋转、升降镜头或动态全循环),AI助手便会通过Blender连接器的执行代码工具(如`execute_blender_code`)自动创建相机绑定、关键帧动画、光照和渲染设置,最终输出为1920x1080分辨率、24fps的透明背景PNG序列。技能内置了场景检查逻辑,可自动定位模型包围盒中心作为相机目标点,并支持通过4张低分辨率样张让用户确认产品正面。对于缺少光照的场景,还会自动添加一组“金色”产品布光。该技能适用于Blender 4.4+/5.x及更早版本,支持GPU加速渲染。用户可通过自然语言描述选择镜头,例如“展示所有角度”“制作GIF循环”“从低到高揭示产品”等,技能会根据描述自动设置默认时长(5秒或10秒)和关键帧动画参数。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/varad2343/claude-skills/tree/HEAD/plugins/blender-camera-animations/skills/blender-camera-animations

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Blender Camera Animations

Six cinematic camera moves for showcasing a 3D model already in the Blender scene. All Blender work goes through the Blender connector's execute-code tool (e.g. execute_blender_code); check results with a viewport screenshot.

Pick the shot

User saysShotDefault length
turntable, orbit, rotate around, all angles (default)Turntable5 s
loop, seamless, GIF, website embedPerfect loop5 s
zoom in, push in, close-up on logo, hero detailSlow zoom5 s
dolly, sweeping, move and rotateDolly-rotate5 s
crane, rise up, low to high, reveal / unveilCrane shot5 s
speed ramp, show every side incl. top/bottom, social heroDynamic full loop10 s

Defaults: 1920x1080, 24 fps, transparent background, output folder ~/Desktop/Blender Videos/ (create it). Ask only if the shot or focus detail is unclear.

Step 0 — Inspect the scene

Get the object list and the main mesh's world bounding-box center and size. Scale all distances below by the object's largest dimension (values assume a ~1 m object). Put the camera target empty at the bbox center, not (0,0,0), when the model isn't centered.

import bpy
from mathutils import Vector
meshes = [o for o in bpy.context.scene.objects if o.type == 'MESH']
pts = [o.matrix_world @ Vector(c) for o in meshes for c in o.bound_box]
mn = Vector((min(p.x for p in pts), min(p.y for p in pts), min(p.z for p in pts)))
mx = Vector((max(p.x for p in pts), max(p.y for p in pts), max(p.z for p in pts)))
print('center', (mn + mx) / 2, 'size', mx - mn)

For turntable/loops, find the product's front: render 4 low-res stills from -Y, +X, +Y, -X, show them, and ask which is the front. Default front = -Y.

Shared helpers (run first in every shot)

import bpy, math

def make_rig(name, target_loc, cam_loc, lens, parent=False):
    bpy.ops.object.empty_add(type='PLAIN_AXES', location=target_loc)
    tgt = bpy.context.active_object; tgt.name = name + 'Target'
    bpy.ops.object.camera_add(location=cam_loc)
    cam = bpy.context.active_object; cam.name = name + 'Cam'
    cam.data.lens = lens
    trk = cam.constraints.new(type='TRACK_TO')
    trk.target = tgt; trk.track_axis = 'TRACK_NEGATIVE_Z'; trk.up_axis = 'UP_Y'
    if parent:  # camera orbits when the target rotates
        cam.parent = tgt
        cam.matrix_parent_inverse = tgt.matrix_world.inverted()
    bpy.context.scene.camera = cam
    return tgt, cam

def iter_fcurves(obj):
    act = obj.animation_data.action
    if hasattr(act, 'layers') and len(act.layers):   # Blender 4.4+/5.x layered actions
        for layer in act.layers:
            for strip in layer.strips:
                for cb in strip.channelbags:
                    yield from cb.fcurves
    else:                                             # older Blender
        yield from act.fcurves

def set_interp(obj, mode):
    for fc in iter_fcurves(obj):
        for kp in fc.keyframe_points:
            kp.interpolation = mode

def set_range(frames, fps=24):
    s = bpy.context.scene
    s.frame_start, s.frame_end, s.render.fps = 1, frames, fps

The shots

C = target center. FRAMES = duration x fps.

Turntable — tgt, cam = make_rig('Turntable', C, (C.x, C.y-4.5, C.z+2.0), 50, parent=True). Keyframe tgt.rotation_euler (0,0,0) at frame 1 and (0,0,radians(360)) at FRAMES+1. set_interp(tgt, 'LINEAR') for constant speed.

Perfect loop — Same as turntable, camera distance 4.0, height 2.0. Critical: the 360° key goes at FRAMES+1 (never rendered) so the last frame flows into frame 1. Interpolation MUST be LINEAR. Don't keyframe camera distance, height or lens. Play the result on repeat to check the seam.

Slow zoom — Ask which detail to push toward (logo, texture) and put the target there. make_rig('SlowZoom', FOCUS, (1.5, -4.0, 3.0), 35). Keyframe camera location + cam.data.lens: frame 1 = (1.5,-4.0,3.0), 35 mm; FRAMES = (0.3,-1.8,1.2), 65 mm. Keep the default BEZIER for ease in/out; the lens change adds a subtle dolly-zoom.

Dolly-rotate — make_rig('Dolly', C, (2.5,-4.0,2.0), 40, parent=True). Frame 1: target rot 0, cam (2.5,-4.0,2.0), 40 mm. FRAMES: target rot Z = 90°, cam (1.5,-2.5,1.5), 50 mm. BEZIER.

Crane shot — make_rig('Crane', C, (1.0,-3.0,-0.2), 45). Frame 1: cam (1.0,-3.0,-0.2) looking up, 45 mm. FRAMES: cam (1.5,-4.0,3.5), 35 mm (rises and pulls back). BEZIER.

Dynamic full loop (240 frames) — make_rig('Dynamic', C, (0,-4.0,1.8), 45, parent=True). Close keys with a small change = slow linger; wide jumps = fast whip.

kf_z = [(1,0),(30,10),(45,90),(75,100),(90,180),(120,190),(135,270),(165,280),(180,330),(210,340),(225,355),(240,360)]
kf_x = [(1,0),(30,0),(75,15),(120,0),(135,-20),(165,-45),(180,-60),(210,-30),(240,0)]
for f, d in kf_z:
    tgt.rotation_euler[2] = math.radians(d); tgt.keyframe_insert('rotation_euler', index=2, frame=f)
for f, d in kf_x:
    tgt.rotation_euler[0] = math.radians(d); tgt.keyframe_insert('rotation_euler', index=0, frame=f)
for fc in iter_fcurves(tgt):
    for kp in fc.keyframe_points:
        kp.interpolation = 'BEZIER'; kp.easing = 'AUTO'

Lighting (if the scene has none)

Warm "golden" product rig: put the colour on the LIGHTS, not on the world or materials. Area lights (location, energy W, size, colour): Key (3,-3,4) 2000, 3, (1,.78,.45); Fill (-3,-2,3) 1000, 5, (1,.75,.4); Overhead (0,0,5) 800, 8, (1,.92,.75); Rim (0,4,2) 800, 3, (1,.65,.3); Side (4,0,0.5) 600, 2, (1,.8,.5). Aim each at the target with a Track To constraint. World background: neutral (0.95,0.95,0.95), strength 0.3.

Render

import bpy, os
s = bpy.context.scene
s.render.resolution_x, s.render.resolution_y = 1920, 1080
s.render.film_transparent = True
s.render.engine = 'CYCLES'; s.cycles.samples = 64; s.cycles.use_denoising = True
try: s.cycles.device = 'GPU'
except Exception: pass
s.render.image_settings.file_format = 'PNG'; s.render.image_settings.color_mode = 'RGBA'
out = os.path.expanduser('~/Desktop/Blender Videos/<shot>_frames/')
os.makedirs(out, exist_ok=True)
s.render.filepath = out

First render one still frame mid-animation and show it before the full sequence. A full animation render blocks Blender and the tool call will time out, so start it with bpy.ops.render.render('INVOKE_DEFAULT', animation=True) (or tell the user to press Ctrl+F12), then check the frames folder until all FRAMES PNGs exist. On a heavy mesh use EEVEE ('BLENDER_EEVEE' in 4.2+/5.x) or 32 samples. If Blender freezes, encode whatever frames finished.

Encode

With ffmpeg on the user's computer (or in the workspace after copying the frames over):

# ProRes 4444 with alpha (editing)
ffmpeg -y -framerate 24 -i "<frames>/%04d.png" -c:v prores_ks -profile:v 4444 -pix_fmt yuva444p10le "<out>/<shot>.mov"
# Web / social (no alpha)
ffmpeg -y -framerate 24 -i "<frames>/%04d.png" -c:v libx264 -pix_fmt yuv420p -crf 18 "<out>/<shot>.mp4"
# Transparent web loop
ffmpeg -y -framerate 24 -i "<frames>/%04d.png" -c:v libvpx-vp9 -pix_fmt yuva420p -b:v 0 -crf 30 "<out>/<shot>.webm"

If there's no ffmpeg, set Blender's output to FFmpeg video (H.264) where the version supports it, or deliver the PNG sequence.

Rules

  • Never delete the user's objects. Name every new object with the shot prefix so it can be removed again.
  • Loops: LINEAR only. Reveals and zooms: BEZIER.
  • Report the final file path and duration.

Individual skills in this repo

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

相关技能