turntable について
turntable は、選択した正面の角度から 360 度の製品紹介動画を作る Blender スキルです。カメラや照明の設定からレンダリング、動画エンコードまでを扱います。
主な機能
- 01360 度カメラの周回
- 024 方向から正面を選択
- 03カメラリグと照明の設定
- 04透明背景でのレンダリング
- 05PNG 連番を ffmpeg でエンコード
活用シーン
- 01製品の回転紹介動画を作成
- 02透明背景の製品動画をレンダリング
- 03製品の正面アングルを決定
MCP 対応
Blender MCP を介して Blender シーンを操作します。Blender MCP アドオンへの接続が必要です。
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ kevinbadi/ blender-skills --skill turntableインストール後、Claude Code で/turntableを入力して読み込まれたか確認します。
詳細
ターンテーブルカメラアニメーション
製品の周囲でカメラを360度回転させ、すっきりとした製品紹介動画を作成します。正面から開始し、シームレスにループします。
使用する場面
- ユーザーが製品のターンテーブル動画/回転動画を求めている
- ユーザーが「周囲を回転」「周回」「あらゆる角度から見せる」「ターンテーブル」と言っている
- 製品紹介動画での標準的な選択肢
前提条件
- Blender MCP:接続済み(ポート9876のblender-mcpアドオン)
- 3Dモデル:Blenderシーンにインポート済み
- 出力フォルダー:
~/Desktop/Blender Videos/(必要に応じて作成) - ffmpeg:動画エンコード用にインストール済み
パラメーター
| パラメーター | デフォルト | 説明 |
|---|---|---|
duration | 5 | 動画の長さ(秒) |
fps | 24 | 1秒あたりのフレーム数 |
camera_distance | 4.5 | オブジェクトの中心からの距離 |
camera_height | 2.0 | オブジェクトより上のカメラの高さ |
camera_lens | 50 | 焦点距離(mm) |
transparent_bg | true | 透明な背景 |
output_format | mov | mov(アルファ付きProRes 4444)またはwebm(アルファ付きVP9) |
手順
ステップ1:正面を特定する
異なるカメラ位置から低解像度のテストフレームを4枚レンダリングし、製品の正面を確認します。どの角度が正面かユーザーに尋ねます。
import bpy, math
from mathutils import Vector
obj = bpy.data.objects['<OBJECT_NAME>']
bbox = [obj.matrix_world @ Vector(c) for c in obj.bound_box]
center = sum(bbox, Vector()) / 8
RADIUS = 4.5
HEIGHT = 2.0
# Create temp camera
bpy.ops.object.camera_add()
cam = bpy.context.active_object
cam.name = 'TempCam'
bpy.context.scene.camera = cam
# Add track constraint to center
bpy.ops.object.empty_add(type='PLAIN_AXES', location=center)
target = bpy.context.active_object
target.name = 'TempTarget'
cam.constraints.new(type='TRACK_TO').target = target
# Render 4 angles
positions = {
'front': (center.x, center.y - RADIUS, HEIGHT),
'right': (center.x + RADIUS, center.y, HEIGHT),
'back': (center.x, center.y + RADIUS, HEIGHT),
'left': (center.x - RADIUS, center.y, HEIGHT),
}
for label, pos in positions.items():
cam.location = pos
bpy.context.scene.render.filepath = f'<OUTPUT>/facing_{label}.png'
bpy.ops.render.render(write_still=True)
4枚すべての画像をユーザーに見せ、どれが正面か尋ねます。
ステップ2:カメラリグを設定する
import bpy, math
# Create target empty at object center
bpy.ops.object.empty_add(type='PLAIN_AXES', location=(0, 0, 0))
target = bpy.context.active_object
target.name = 'TurntableTarget'
# Create camera at front-facing position (determined from Step 1)
# Default front = -Y axis
bpy.ops.object.camera_add(location=(0, -CAMERA_DISTANCE, CAMERA_HEIGHT))
cam = bpy.context.active_object
cam.name = 'TurntableCamera'
cam.data.lens = 50
# Track to target
track = cam.constraints.new(type='TRACK_TO')
track.target = target
track.track_axis = 'TRACK_NEGATIVE_Z'
track.up_axis = 'UP_Y'
# Parent camera to target for orbit
bpy.ops.object.select_all(action='DESELECT')
cam.select_set(True)
target.select_set(True)
bpy.context.view_layer.objects.active = target
bpy.ops.object.parent_set(type='OBJECT', keep_transform=True)
bpy.context.scene.camera = cam
ステップ3:360度回転をアニメーション化する
import bpy, math
TOTAL_FRAMES = DURATION * FPS # e.g. 5 * 24 = 120
scene = bpy.context.scene
scene.frame_start = 1
scene.frame_end = TOTAL_FRAMES
scene.render.fps = FPS
target = bpy.data.objects['TurntableTarget']
target.rotation_euler = (0, 0, 0)
target.keyframe_insert(data_path='rotation_euler', frame=1)
target.rotation_euler = (0, 0, math.radians(360))
target.keyframe_insert(data_path='rotation_euler', frame=TOTAL_FRAMES + 1)
# IMPORTANT: Linear interpolation for constant speed
# Blender 5.1 uses layered actions:
action = target.animation_data.action
strip = action.layers[0].strips[0]
for cb in strip.channelbags:
for fc in cb.fcurves:
for kp in fc.keyframe_points:
kp.interpolation = 'LINEAR'
ステップ4:ライティングを設定する
import bpy, math
# Warm sunset lighting on LIGHTS only (not on materials/world)
bpy.ops.object.light_add(type='AREA', location=(3, -3, 4))
k = bpy.context.active_object; k.name='GoldenKey'
k.data.energy = 2000; k.data.size = 3.0
k.data.color = (1.0, 0.78, 0.45)
k.rotation_euler = (math.radians(45), 0, math.radians(25))
bpy.ops.object.light_add(type='AREA', location=(-3, -2, 3))
f = bpy.context.active_object; f.name='WarmFill'
f.data.energy = 1000; f.data.size = 5.0
f.data.color = (1.0, 0.75, 0.4)
f.rotation_euler = (math.radians(40), 0, math.radians(-30))
bpy.ops.object.light_add(type='AREA', location=(0, 0, 5))
oh = bpy.context.active_object; oh.name='OverheadWash'
oh.data.energy = 800; oh.data.size = 8.0
oh.data.color = (1.0, 0.92, 0.75)
bpy.ops.object.light_add(type='AREA', location=(0, 4, 2))
r = bpy.context.active_object; r.name='WarmRim'
r.data.energy = 800; r.data.size = 3.0
r.data.color = (1.0, 0.65, 0.3)
r.rotation_euler = (math.radians(-40), 0, math.radians(180))
bpy.ops.object.light_add(type='AREA', location=(4, 0, 0.5))
sw = bpy.context.active_object; sw.name='SideGlow'
sw.data.energy = 600; sw.data.size = 2.0
sw.data.color = (1.0, 0.8, 0.5)
sw.rotation_euler = (math.radians(5), 0, math.radians(90))
ステップ5:レンダリングする
import bpy, os
scene = bpy.context.scene
scene.render.resolution_x = 1920
scene.render.resolution_y = 1080
scene.render.film_transparent = True
scene.render.engine = 'CYCLES' # better metallic reflections
scene.cycles.samples = 64
scene.cycles.use_denoising = True
scene.cycles.device = 'GPU'
scene.render.image_settings.file_format = 'PNG'
scene.render.image_settings.color_mode = 'RGBA'
# Neutral world for subtle reflections (not colored)
if not scene.world:
scene.world = bpy.data.worlds.new("World")
scene.world.use_nodes = True
bg = scene.world.node_tree.nodes.get('Background')
bg.inputs['Color'].default_value = (0.95, 0.95, 0.95, 1)
bg.inputs['Strength'].default_value = 0.3
frames_dir = os.path.expanduser('~/Desktop/Blender Videos/turntable_frames/')
os.makedirs(frames_dir, exist_ok=True)
scene.render.filepath = frames_dir
bpy.ops.render.render(animation=True)
ステップ6:動画をエンコードする
レンダリング中にMCPはタイムアウトします。すべてのフレームが揃うまでフレームディレクトリを確認し、その後エンコードします。
# ProRes 4444 with alpha (transparent)
ffmpeg -y -framerate 24 \
-i "~/Desktop/Blender Videos/turntable_frames/%04d.png" \
-c:v prores_ks -profile:v 4444 -pix_fmt yuva444p10le \
"~/Desktop/Blender Videos/turntable.mov"
Blender 5.1に関する注意事項
- レンダーエンジンの列挙値:
BLENDER_EEVEE(BLENDER_EEVEE_NEXTではありません) - FFMPEG出力形式はありません。PNGシーケンスとしてレンダリングし、ffmpegでエンコードします
- レイヤー化アクションAPI:fcurveにアクセスするには
action.layers[0].strips[0].channelbagsを使用します - 透明な背景には
film_transparent = Trueを設定します - 暖色はワールド/マテリアルではなく、ライトに設定します
コメント
Markdown 対応