blender-scene-rendering について
blender-scene-renderingは、Blender 5.xのシーン設定、レンダリング、ファイル入出力、ビューポート、Python自動化を案内するスキルです。実行中のBlenderでは公式Blender MCP Serverの利用を推奨し、未接続時はスクリプトを代替手段とします。
主な機能
- 01レンダーエンジンと出力を設定
- 02サンプリングとカラー管理を案内
- 03ファイルのインポート、書き出し、リンク、追加
- 04シーンとビューポートの設定
- 05Pythonでバッチレンダリングを自動化
- 06一般的なレンダリング問題を診断
活用シーン
- 01CyclesまたはEEVEEのレンダリング設定
- 02シーンの出力形式と解像度の準備
- 03Blenderファイル間でアセットを移動
- 04複数シーンやカメラのレンダリングを自動化
MCP 対応
実行中のBlenderセッションの確認・変更、Python実行、結果検証には公式Blender MCP Serverを推奨します。サーバー未接続時はPythonスクリプトを代替手段として使います。
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ ra100/ blender-claude-plugin --skill blender-scene-renderingインストール後、Claude Code で/blender-scene-renderingを入力して読み込まれたか確認します。
同梱ファイルreferences/python_api.mdreferences/settings_reference.md
詳細
Blender シーン&レンダリングのエキスパート
概要
このスキルでは、Blender 5.x のシーン設定、レンダー設定、出力パイプライン、ファイルのインポート/エクスポート、リンク/追加、ビューポート設定、プロジェクトレベルの Python 自動化について、専門的なガイダンスを提供します。リファレンスファイルには、設定の完全なカタログと Python API のパターンが記載されています。
MCP を優先するアプローチ
実行中の Blender セッションでレンダー設定の変更、ファイルのインポート、カラー管理の設定、レンダリングの開始を行う場合は、公式の Blender MCP Server(Blender Lab、Blender 5.1 以降)を優先してください。MCP サーバーに接続されていない場合に限り、Python スクリプトの出力に切り替えてください。
検出方法: セッション開始時に、execute_blender_code、get_objects_summary、search_api_docs に一致する名前のツールがないか確認してください。これらは公式の blender-mcp サーバーに属しています。いずれかが利用できれば、MCP は使用可能です。
このスキルで使用するツール:
execute_blender_code— ライブセッションでbpyPython を実行(主要な操作)get_objects_summary、get_object_detail_summary— 変更前にシーンの状態を確認get_blendfile_summary_datablocks/_missing_files/_of_linked_libraries/_path_info/_usage_guess— ファイルの内容を一覧表示search_api_docs、get_python_api_docs、search_manual_docs— 呼び出す前に、正しい API/オペレーター名を確認get_screenshot_of_window_as_image/_as_json、get_screenshot_of_area_as_image— 視覚的な結果を確認jump_to_tab_by_name、jump_to_tab_by_space_type、jump_to_view3d_object_by_name、jump_to_view3d_object_data_by_name— UI を操作して変更を見える状態にするrender_thumbnail_to_path、render_viewport_to_path— 視覚的なフィードバックをすばやく取得
ワークフロー: get_* / search_* ツールで確認 → execute_blender_code で変更 → スクリーンショットまたは概要ツールで検証します。失敗箇所を特定しやすいよう、コードブロックは小さく、冪等にしてください。
セットアップについては、docs/blender-mcp-setup.md を参照してください。
タスクの判断ツリー
- 「レンダーを設定する/Cycles または EEVEE を設定する」 → 「レンダーエンジンの設定」を参照
- 「解像度/出力形式を変更する」 → 「出力設定」を参照
- 「サンプル数/ノイズ除去を調整する」 → 「サンプリングとノイズ除去」を参照
- 「カラー管理/Filmic/AgX」 → 「カラー管理」を参照
- 「ワールド/環境/HDRI を設定する」 → 「ワールドと環境」を参照
- 「FBX/glTF/OBJ/USD をインポートする」 → 「インポート/エクスポート」を参照
- 「別の .blend からリンクまたは追加する」 → 「リンクと追加」を参照
- 「単位/フレーム範囲/FPS を設定する」 → 「シーン設定」を参照
- 「ビュー レイヤー/レンダーパス」 → 「ビュー レイヤー」を参照
- 「ビューポートのシェーディング/オーバーレイ」 → 「ビューポート設定」を参照
- 「バッチレンダリング/出力を自動化する」 → 「バッチレンダリング」を参照
- 「レンダーがおかしい」 → 「デバッグ」セクションを参照
レンダーエンジンの設定
Cycles に切り替える
import bpy
scene = bpy.context.scene
scene.render.engine = 'CYCLES'
# Device: CPU or GPU
cycles = scene.cycles
cycles.device = 'GPU'
# GPU compute device type
prefs = bpy.context.preferences.addons['cycles'].preferences
prefs.compute_device_type = 'CUDA' # CUDA, OPTIX, HIP, METAL, ONEAPI
prefs.get_devices() # Refresh device list
for device in prefs.devices:
device.use = True # Enable all available devices
EEVEE に切り替える
import bpy
scene = bpy.context.scene
scene.render.engine = 'BLENDER_EEVEE' # Blender 4.x+/5.x EEVEE
eevee = scene.eevee
# Shadows
eevee.shadow_ray_count = 1
eevee.shadow_step_count = 6
# Ray tracing
eevee.use_raytracing = True
eevee.ray_tracing_method = 'SCREEN' # SCREEN or FULL
# Emission transparency (for emissive materials that need alpha blending)
# Set per-material: material.surface_render_method = 'BLENDED'
# Ambient Occlusion (baked into lighting in EEVEE)
Workbench(ソリッド/プレビュー)
import bpy
bpy.context.scene.render.engine = 'BLENDER_WORKBENCH'
出力設定
解像度とフレーム範囲
import bpy
render = bpy.context.scene.render
# Resolution
render.resolution_x = 1920
render.resolution_y = 1080
render.resolution_percentage = 100
# Frame range
scene = bpy.context.scene
scene.frame_start = 1
scene.frame_end = 250
scene.frame_step = 1
scene.frame_current = 1
# FPS
render.fps = 24
render.fps_base = 1.0 # Actual FPS = fps / fps_base
出力形式
import bpy
render = bpy.context.scene.render
render.filepath = "//output/render_" # // = relative to .blend file
# Image format
# Image format
render.image_settings.file_format = 'PNG' # PNG, JPEG, OPEN_EXR, OPEN_EXR_MULTILAYER, TIFF, BMP, HDR, FFMPEG, AVIF (5.1)
render.image_settings.color_mode = 'RGBA' # BW, RGB, RGBA
render.image_settings.color_depth = '16' # 8, 16 (PNG/TIFF), 16/32 (EXR)
render.image_settings.compression = 15 # PNG compression 0-100
# EXR settings
render.image_settings.file_format = 'OPEN_EXR'
render.image_settings.exr_codec = 'DWAA' # NONE, PXR24, ZIP, PIZ, RLE, ZIPS, DWAA, DWAB
render.image_settings.color_depth = '32'
# Video (FFmpeg)
render.image_settings.file_format = 'FFMPEG'
render.ffmpeg.format = 'MPEG4' # MPEG4, MKV, WEBM, AVI, QUICKTIME
render.ffmpeg.codec = 'H264' # H264, MPEG4, WEBM, PNG, HUFFYUV, DNXHD, FFV1
render.ffmpeg.constant_rate_factor = 'MEDIUM' # NONE, LOSSLESS, PERC_LOSSLESS, HIGH, MEDIUM, LOW, LOWEST
render.ffmpeg.audio_codec = 'AAC' # NONE, AAC, AC3, FLAC, MP2, MP3, OPUS, PCM, VORBIS
OpenEXR HTJ2K(5.1 の新機能)
- 新しい EXR コーデック:
render.image_settings.exr_codec = 'HTJ2K' - EXR ファイル向けの高スループット JPEG 2000 圧縮
- マルチレイヤー EXR 出力で、DWAA/DWAB より高い圧縮率を実現
動画のカスタム CRF(5.1)
- FFmpeg の
constant_rate_factorが整数値に対応し、より細かく制御できるようになりました - 例:
render.ffmpeg.constant_rate_factor = 'HIGH'、または CRF を数値で直接設定
AVIF 形式(5.1 の新機能)
render.image_settings.file_format = 'AVIF' render.image_settings.avif_compression = 50 # 品質 0~100
サンプリングとノイズ除去
Cycles のサンプリング
import bpy
cycles = bpy.context.scene.cycles
# Render samples
cycles.samples = 256
cycles.use_adaptive_sampling = True
cycles.adaptive_threshold = 0.01 # Lower = higher quality
cycles.adaptive_min_samples = 64
# Viewport samples
cycles.preview_samples = 32
cycles.use_preview_adaptive_sampling = True
# Time limit (0 = disabled)
cycles.time_limit = 0.0
# Seed
cycles.seed = 0
cycles.use_animated_seed = True # Different seed per frame
# Light paths
cycles.max_bounces = 12
cycles.diffuse_bounces = 4
cycles.glossy_bounces = 4
cycles.transmission_bounces = 12
cycles.volume_bounces = 0
cycles.transparent_max_bounces = 8
# Caustics
cycles.caustics_reflective = False
cycles.caustics_refractive = False
# Clamping (reduce fireflies)
cycles.sample_clamp_direct = 0.0 # 0 = disabled
cycles.sample_clamp_indirect = 10.0
ノイズ除去
import bpy
scene = bpy.context.scene
cycles = scene.cycles
# Render denoising
scene.cycles.use_denoising = True
scene.cycles.denoiser = 'OPENIMAGEDENOISE' # OPENIMAGEDENOISE or OPTIX
scene.cycles.denoising_input_passes = 'RGB_ALBEDO_NORMAL' # RGB, RGB_ALBEDO, RGB_ALBEDO_NORMAL
scene.cycles.denoising_prefilter = 'ACCURATE' # NONE, FAST, ACCURATE
# Viewport denoising
scene.cycles.use_preview_denoising = True
scene.cycles.preview_denoiser = 'OPENIMAGEDENOISE'
scene.cycles.preview_denoising_start_sample = 1
カラー管理
カラーマネジメントの設定
import bpy
cm = bpy.context.scene.view_settings
ds = bpy.context.scene.display_settings
# Display device
ds.display_device = 'sRGB' # sRGB, None
# View transform
cm.view_transform = 'AgX' # Standard, Filmic, AgX, Raw, False Color
cm.look = 'None' # None, AgX - Punchy, AgX - Golden, etc.
# Exposure and gamma
cm.exposure = 0.0
cm.gamma = 1.0
# Sequencer color space
bpy.context.scene.sequencer_colorspace_settings.name = 'sRGB'
一般的なビュー変換:
| 変換 | 用途 |
|---|---|
AgX | Blender 4.0+/5.x のデフォルト。広いダイナミックレンジに対応 |
Filmic | 従来のデフォルト。フォトリアリスティックなシーンに適しています |
Standard | sRGB を直接使用(UI 要素、非フォトリアリスティックな用途) |
Raw | 変換なし(データパス、マスク) |
ワールドと環境
HDRI 環境
import bpy
world = bpy.context.scene.world
if world is None:
world = bpy.data.worlds.new("World")
bpy.context.scene.world = world
world.use_nodes = True
nodes = world.node_tree.nodes
links = world.node_tree.links
nodes.clear()
# Background + Environment Texture
bg = nodes.new('ShaderNodeBackground')
env_tex = nodes.new('ShaderNodeTexEnvironment')
env_tex.image = bpy.data.images.load("//hdri/studio.exr")
mapping = nodes.new('ShaderNodeMapping')
tex_coord = nodes.new('ShaderNodeTexCoord')
output = nodes.new('ShaderNodeOutputWorld')
links.new(tex_coord.outputs['Generated'], mapping.inputs['Vector'])
links.new(mapping.outputs['Vector'], env_tex.inputs['Vector'])
links.new(env_tex.outputs['Color'], bg.inputs['Color'])
links.new(bg.outputs['Background'], output.inputs['Surface'])
bg.inputs['Strength'].default_value = 1.0
単色のワールド
import bpy
world = bpy.context.scene.world
world.use_nodes = True
nodes = world.node_tree.nodes
bg = nodes.get('Background')
bg.inputs['Color'].default_value = (0.05, 0.05, 0.05, 1.0)
bg.inputs['Strength'].default_value = 1.0
インポート/エクスポート
一般的なインポート操作
import bpy
# FBX
bpy.ops.import_scene.fbx(filepath="/path/to/model.fbx")
# glTF / GLB
bpy.ops.import_scene.gltf(filepath="/path/to/model.glb")
# OBJ
bpy.ops.wm.obj_import(filepath="/path/to/model.obj")
# USD
bpy.ops.wm.usd_import(filepath="/path/to/scene.usdc")
# Alembic
bpy.ops.wm.alembic_import(filepath="/path/to/cache.abc")
# STL
bpy.ops.wm.stl_import(filepath="/path/to/model.stl")
# SVG
bpy.ops.import_curve.svg(filepath="/path/to/graphic.svg")
一般的なエクスポート操作
import bpy
# FBX
bpy.ops.export_scene.fbx(
filepath="/path/to/export.fbx",
use_selection=True, # Export selected only
apply_scale_options='FBX_SCALE_ALL',
axis_forward='-Z',
axis_up='Y',
use_mesh_modifiers=True,
mesh_smooth_type='FACE',
add_leaf_bones=False,
bake_anim=True,
)
# glTF / GLB
bpy.ops.export_scene.gltf(
filepath="/path/to/export.glb",
export_format='GLB', # GLB (binary), GLTF_SEPARATE, GLTF_EMBEDDED
use_selection=True,
export_apply=True, # Apply modifiers
export_animations=True,
export_draco_mesh_compression_enable=False,
)
# OBJ
bpy.ops.wm.obj_export(
filepath="/path/to/export.obj",
export_selected_objects=True,
apply_modifiers=True,
export_uv=True,
export_normals=True,
export_materials=True,
)
# USD
bpy.ops.wm.usd_export(
filepath="/path/to/export.usdc",
selected_objects_only=True,
export_animation=True,
export_hair=True,
)
# Alembic
bpy.ops.wm.alembic_export(
filepath="/path/to/export.abc",
selected=True,
start=1,
end=250,
)
# STL
bpy.ops.wm.stl_export(
filepath="/path/to/export.stl",
export_selected_objects=True,
apply_modifiers=True,
)
リンクとアペンド
アペンド(現在のファイルにコピー)
import bpy
blend_path = "/path/to/library.blend"
# Append a single object
with bpy.data.libraries.load(blend_path) as (data_from, data_to):
data_to.objects = ["ObjectName"]
# Link appended objects to active collection
for obj in data_to.objects:
if obj is not None:
bpy.context.collection.objects.link(obj)
# Append specific data types
with bpy.data.libraries.load(blend_path) as (data_from, data_to):
data_to.materials = ["MaterialName"]
data_to.node_groups = ["NodeGroupName"]
data_to.collections = ["CollectionName"]
data_to.worlds = ["WorldName"]
リンク(参照して接続を維持)
import bpy
blend_path = "/path/to/library.blend"
with bpy.data.libraries.load(blend_path, link=True) as (data_from, data_to):
data_to.collections = ["CollectionName"]
# Link collection instance to scene
for coll in data_to.collections:
if coll is not None:
bpy.context.collection.children.link(coll)
# Make library override (editable linked data)
# Select linked object first
bpy.ops.object.make_override_library()
ライブラリの再読み込み/再配置
import bpy
for lib in bpy.data.libraries:
lib.reload() # Reload from disk
# Relocate a library to a new path
# lib.filepath = "/new/path/to/library.blend"
# lib.reload()
シーン設定
単位
import bpy
unit = bpy.context.scene.unit_settings
unit.system = 'METRIC' # NONE, METRIC, IMPERIAL
unit.scale_length = 1.0 # 1.0 = 1 Blender unit = 1 meter
unit.length_unit = 'METERS' # ADAPTIVE, KILOMETERS, METERS, CENTIMETERS, MILLIMETERS, MICROMETERS
unit.use_separate = True # Use separate units (e.g., 1m 50cm)
unit.temperature_unit = 'CELSIUS'
複数のシーン
import bpy
# Create new scene
new_scene = bpy.data.scenes.new("MyScene")
# Copy scene (Full Copy = independent copy of all data)
bpy.ops.scene.new(type='FULL_COPY') # NEW, EMPTY, LINK_COPY, FULL_COPY
# Switch active scene
bpy.context.window.scene = bpy.data.scenes["MyScene"]
# Delete scene
bpy.data.scenes.remove(bpy.data.scenes["MyScene"])
ビューレイヤー
ビューレイヤーの設定
import bpy
scene = bpy.context.scene
# Create view layer
vl = scene.view_layers.new("MyLayer")
# Enable/disable collections per layer
vl.layer_collection.children["CollectionName"].exclude = True
# Render passes
vl.use_pass_combined = True
vl.use_pass_z = True
vl.use_pass_normal = True
vl.use_pass_diffuse_color = True
vl.use_pass_glossy_color = True
vl.use_pass_emit = True
vl.use_pass_ambient_occlusion = True
vl.use_pass_shadow = True
vl.use_pass_mist = True
# Cryptomatte
vl.use_pass_cryptomatte_object = True
vl.use_pass_cryptomatte_material = True
vl.use_pass_cryptomatte_asset = True
ビューポートの設定
ビューポートのシェーディング
import bpy
# Access 3D viewport shading
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
for space in area.spaces:
if space.type == 'VIEW_3D':
shading = space.shading
# Shading type: WIREFRAME, SOLID, MATERIAL, RENDERED
shading.type = 'MATERIAL'
# Solid mode options
shading.light = 'STUDIO' # STUDIO, MATCAP, FLAT
shading.color_type = 'MATERIAL' # MATERIAL, SINGLE, OBJECT, RANDOM, VERTEX, TEXTURE
# Rendered mode options
shading.use_scene_lights_render = True
shading.use_scene_world_render = True
break
オーバーレイ
import bpy
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
for space in area.spaces:
if space.type == 'VIEW_3D':
overlay = space.overlay
overlay.show_overlays = True
overlay.show_floor = True
overlay.show_axis_x = True
overlay.show_axis_y = True
overlay.show_wireframes = False
overlay.show_face_orientation = False
overlay.show_stats = True
break
バッチレンダリング
すべてのカメラをレンダリング
import bpy
scene = bpy.context.scene
original_camera = scene.camera
for obj in bpy.data.objects:
if obj.type == 'CAMERA':
scene.camera = obj
scene.render.filepath = f"//output/{obj.name}_"
bpy.ops.render.render(write_still=True)
scene.camera = original_camera
複数のシーンをレンダリング
import bpy
for scene in bpy.data.scenes:
scene.render.filepath = f"//output/{scene.name}_"
bpy.ops.render.render(write_still=True, scene=scene.name)
アニメーションをレンダリング
import bpy
bpy.ops.render.render(animation=True) # Renders full frame range
デバッグ
レンダリングの問題
| 問題 | 原因 | 解決方法 |
|---|---|---|
| レンダリングが真っ黒になる | ライトがない、カメラの向きが間違っている | ライトを追加し、カメラの向きとクリッピングを確認します |
| レンダリングにノイズが多い | サンプル数が少ない | cycles.samples を増やし、デノイズを有効にします |
| ファイアフライ(明るいピクセル) | コースティクスまたは制限のないライト | sample_clamp_indirect = 10 を設定し、コースティクスを無効にします |
| 色が白っぽく見える | カラーマネジメントの設定が間違っている | ビュー変換を AgX または Filmic に設定します |
| 色が濃すぎる/コントラストが強すぎる | ビュー変換の不一致 | None ルックで AgX を試します |
| エクスポートしたファイルにテクスチャがない | テクスチャがパックされていない、またはパスが壊れている | エクスポート前に bpy.ops.file.pack_all() を実行するか、export_format='GLB' を使用します |
| インポート時のスケールが間違っている | アプリ間で単位が一致していない | scale_length またはインポート時のスケールオプションを調整します |
| リンクされたオブジェクトが更新されない | ライブラリが再読み込みされていない | bpy.data.libraries["lib"].reload() を実行します |
| ビューポートの動作が遅い | レンダーモードのオブジェクトが多すぎる | ソリッドに切り替え、サブディビジョンレベルを下げ、コレクションの表示を使用します |
| レンダーパスが不足している | ビューレイヤーでパスが有効になっていない | ビューレイヤーのプロパティでパスを有効にします |
| EEVEE と Cycles で見た目が異なる | 照明に関するエンジンの違い | レイトレーシングを有効にした EEVEE Next で差が縮まります |
参考ファイル
references/python_api.md— シーン/レンダリング/I/O 操作の Python API パターンを網羅references/settings_reference.md— すべてのレンダーエンジン設定、出力形式、カラーマネジメントオプション、インポート/エクスポート形式オプション
Blender 5.1 の変更点
OpenColorIO 2.5
- Blender 5.1 には OpenColorIO 2.5 が付属します
- 色空間の処理とディスプレイ変換が改善されました
- AgX やその他のビュー変換の精度が向上しました
Cycles のパフォーマンス
- 複雑なシーンのレンダリング速度が大幅に向上しました
- アダプティブサンプリングの収束が改善されました
EEVEE のパフォーマンス
- スクリーンスペースエフェクトのメモリ使用量を削減
- レイトレーシングの評価を高速化
ワールドノードのライトパス
- ライトパスノードがワールドノードツリーでも使用可能になりました(マテリアルだけではありません)
- 環境マテリアルでライトタイプごとのエフェクトを適用できます