この作業から始める
照明の発光だけを取り出して仕上げたい
3つのリングと左右の縦灯で構成したライブステージ。発光だけを抜き出した画像と、床の反射を含む完成画を見比べられます。
Blender 5.3.0
作品用のモデルやテクスチャのダウンロードは不要です。下の教材で、形を組むところからカメラで撮るところまでを3回に分けて進めます。各段階で手を止めて、形や材質を自分の画面で確認できます。
製品名を押すと各解説書が開きます。Blenderの「編集」→「プリファレンス」→「アドオン」で上記の製品を有効にします。
作業中のファイルを保存し、「ファイル」→「新規」→「全般」を開きます。画面上の「Scripting」を開き、テキストエディターの「新規」を押します。下の「教材コード」を開いて全文をコピーし、テキストエディターに貼り付けます。
import bpy
import importlib
import math
import random
from math import cos, sin, pi, tau
from mathutils import Vector, Quaternion
def product_module(path):
base, _, sub = path.partition('.')
actual = next((a.module for a in bpy.context.preferences.addons if a.module.rsplit('.', 1)[-1] == base), None)
if actual is None:
raise RuntimeError('Enable the required SmartTools extension in Preferences: ' + base)
return importlib.import_module(actual + ('.' + sub if sub else ''))
def product_symbol(path, name):
module = product_module(path)
if hasattr(module, name):
return getattr(module, name)
return importlib.import_module(module.__name__ + '.' + name)
def drawing(scene):
def bx(name, loc, dim, m, r=0.04):
bpy.ops.mesh.primitive_cube_add(size=1, location=loc)
o = bpy.context.object
o.dimensions = dim
bpy.ops.object.transform_apply(location=False, rotation=False, scale=True)
return finish(o, name, m, r)
def finish(o, name, m, r=0):
o.name = name
o.data.materials.append(m)
if r:
be = o.modifiers.new('Highlight radius', 'BEVEL')
be.width = r
be.segments = 4
be.harden_normals = True
o.modifiers.new('Planar normals', 'WEIGHTED_NORMAL')
return o
def line(name, coords, r, m):
cu = bpy.data.curves.new(name, 'CURVE')
cu.dimensions = '3D'
cu.resolution_u = 16
cu.bevel_depth = r
cu.bevel_resolution = 4
sp = cu.splines.new('BEZIER')
sp.bezier_points.add(len(coords) - 1)
for (p, c) in zip(sp.bezier_points, coords):
p.co = c
p.handle_left_type = 'AUTO'
p.handle_right_type = 'AUTO'
o = bpy.data.objects.new(name, cu)
scene.collection.objects.link(o)
cu.materials.append(m)
return o
def mat(name, c, metal=0, rough=0.4, em=0):
m = bpy.data.materials.new(name)
m.use_nodes = True
b = m.node_tree.nodes.get('Principled BSDF')
b.inputs['Base Color'].default_value = (*c, 1)
b.inputs['Roughness'].default_value = rough
b.inputs['Metallic'].default_value = metal
if em:
b.inputs['Emission Color'].default_value = (*c, 1)
b.inputs['Emission Strength'].default_value = em
return m
def aim(o, p):
o.rotation_euler = (Vector(p) - o.location).to_track_quat('-Z', 'Y').to_euler()
def light(name, pos, target, power, col, w, h=None):
d = bpy.data.lights.new(name, 'AREA')
d.energy = power
d.color = col
d.shape = 'RECTANGLE'
d.size = w
d.size_y = h or w
o = bpy.data.objects.new(name, d)
scene.collection.objects.link(o)
o.location = pos
aim(o, target)
def shoot(pos, target, scale, lens=None):
cd = bpy.data.cameras.new('Art direction')
cam = bpy.data.objects.new('Art direction', cd)
scene.collection.objects.link(cam)
scene.camera = cam
cam.location = pos
aim(cam, target)
if lens:
cd.lens = lens
else:
cd.type = 'ORTHO'
cd.ortho_scale = scale
bpy.context.view_layer.update()
cd.smart_camlight_settings.rig_target_distance = (Vector(target) - cam.location).length
assert bpy.ops.smart_camlight_suite.create_camera_rig(camera_name=cam.name) == {'FINISHED'}
assert any((c.type == 'TRACK_TO' and c.target for c in cam.constraints))
world = bpy.data.worlds.new('Ambient')
scene.world = world
world.use_nodes = True
world.node_tree.nodes['Background'].inputs[0].default_value = (0.26, 0.34, 0.44, 1)
world.node_tree.nodes['Background'].inputs[1].default_value = 0.27
scene.render.engine = 'CYCLES'
scene.cycles.samples = 24
scene.cycles.use_denoising = True
scene.render.threads_mode = 'FIXED'
scene.render.threads = 5
scene.render.resolution_x = 1120
scene.render.resolution_y = 730
scene.render.resolution_percentage = 100
scene.render.image_settings.color_mode = 'RGB'
def cone(name, loc, r1, r2, h, m, segments=16):
bpy.ops.mesh.primitive_cone_add(vertices=segments, radius1=r1, radius2=r2, depth=h, location=loc)
return finish(bpy.context.object, name, m)
def model_line(name, points, r, m):
return line(name, points, r, m)
planner = product_symbol('smart_render_suite', 'planner')
comp = product_symbol('smart_composite_suite', 'builders')
planner.apply_pass_bundle(scene, 'COMPOSITE')
assert scene.view_layers[0].use_pass_emit
floor = mat('Stage lacquer', (0.012, 0.015, 0.026), 0.57, 0.27)
ribs = mat('Anodised truss', (0.024, 0.03, 0.043), 0.74, 0.24)
lilac = mat('Lilac LED', (0.5, 0.13, 0.98), 0.12, 0.3, 4.0)
amber = mat('Amber LED', (1, 0.23, 0.035), 0.09, 0.28, 4)
cyan = mat('Ice LED', (0.08, 0.65, 0.94), 0.12, 0.32, 3)
bx('Black-box stage', (0, 0, -0.21), (28, 18, 0.4), floor, 0.1)
bx('Backdrop', (0, 3.6, 3), (25, 0.23, 8), floor, 0)
yield
for j in range(3):
bx('Performance riser', (0, 1.8 - j * 0.6, 0.38 - j * 0.12), (8.2, 0.72, 0.22), ribs, 0.03)
bx('Riser front strip', (0, 1.42 - j * 0.6, 0.4 - j * 0.12), (8.0, 0.027, 0.027), lilac, 0.01)
for j in range(3):
xx = (j - 1) * 2.61
cy = 2.11 - 0.24 * (j % 2)
zz = 2.12 + 0.22 * (j % 2)
for (radius, material, thick) in [(1.41, ribs, 0.11), (1.33, amber if j == 1 else lilac, 0.047), (1.19, cyan if j == 1 else amber, 0.025)]:
model_line('Suspended light ring', [(xx + radius * cos(tau * i / 96), cy, zz + radius * sin(tau * i / 96)) for i in range(97)], thick, material)
for side in (-1, 1):
for i in range(7):
x = side * (4.18 + i * 0.29)
h = 1.5 + i * 0.42
bx('Vertical light wing', (x, 1.82, h * 0.5), (0.09, 0.08, h), ribs, 0.02)
bx('Wing LED', (x, 1.76, h * 0.5), (0.036, 0.025, h), cyan if i % 2 else lilac, 0.012)
for j in range(3):
bx('Speaker cabinet', (side * 5.62, 1.05, 2.53 + j * 0.43), (0.64, 0.46, 0.39), ribs, 0.04)
light('Floor wash', (side * 3.1, -0.6, 0.35), (side * 2, 2, 2.7), 360, (0.47, 0.12, 0.91) if side < 0 else (0.96, 0.23, 0.08), 2.0)
light('Cabinet rim', (0, -2, 5), (0, 1, 1), 240, (0.63, 0.75, 1), 4)
shoot((0.65, -11.8, 4.0), (0, 1.5, 1.97), 1, 33)
yield
tree = bpy.data.node_groups.new('Orbit: stage finish', 'CompositorNodeTree')
scene.compositing_node_group = tree
tree.interface.new_socket(name='Image', in_out='OUTPUT', socket_type='NodeSocketColor')
src = tree.nodes.new('CompositorNodeRLayers')
out = tree.nodes.new('NodeGroupOutput')
emission = next((s for s in src.outputs if s.name in ('Emit', 'Emission')))
tree.links.new(emission, out.inputs['Image'])
glare = tree.nodes.new('CompositorNodeGlare')
comp._configure_glare(glare, 'FOG_GLOW', 0.8, 0.5, 'HIGH')
tree.links.new(src.outputs['Image'], glare.inputs['Image'])
tree.links.new(glare.outputs['Image'], out.inputs['Image'])
yield
course_key = 'SmartTools lesson / orbit-stage'
session = bpy.app.driver_namespace
current = session.get(course_key)
if not current or current[0] != bpy.context.scene:
for required in ['smart_camlight_suite', 'smart_composite_suite', 'smart_render_suite']:
product_module(required)
scene = bpy.data.scenes.new('Study / orbit-stage')
bpy.context.window.scene = scene
current = [scene, drawing(scene), 0]
session[course_key] = current
if current[2] < 3:
next(current[1])
current[2] += 1
current[0]['Lesson step'] = current[2]
bpy.context.view_layer.update()
テキストエディター上部の ▶「スクリプト実行」を1回ずつ、合計3回押します。1回目で教材専用シーンに切り替わります。各回の間に、3Dビューにカーソルを置き「Home」で全体を表示できます。

「ビュー」→「カメラ」→「アクティブカメラ」で上の掲載画像と構図を見比べます。「レンダー」→「画像をレンダリング」(F12)を選び、表示された画像の「画像」→「名前を付けて保存」でPNGを保存します。教材シーンを後から編集するには、.blendファイルも保存します。
「Compositing」でレンダーレイヤーのImageからGlareへ渡る接続をたどります。グレアノードを選びMで一時的に無効にすると、リングの外側ににじむ光を比較できます。
途中でファイルを閉じた場合は、新規ファイルで教材を最初から実行してください。
発光パスを有効にして光源の形を確認し、合成ではリングの周囲ににじみを加えました。
Smart Renderで発光パスを有効にし、リングが取り出せることを確認。完成画では元のレンダーにSmart Compositeのグローを通し、床の反射と光のにじみを一緒に残しました。
パスごとの書き出しノードを組む「レンダーエレメントを準備」合成用のパス設定を適用し、発光成分を単独で書き出しました。
同じステージを発光・法線・完成画の順に並べました。Smart Renderで合成用のパスをまとめて有効にすると、リングの光と面の向きをそれぞれ別の画像として扱えます。
空だったコンポジットに、ビューレイヤーの画像をファイルに書き出すノードが作られました。ボタンの「ビューティーのみ」では 1 本、「クイックセット」で「合成」を読み込むと、その分の線がノードに足されます。右のノードの入力の名前(Beauty_####、ZDepth_#### など)がそのままファイル名になり、#### の所にフレーム番号が入ります。3D ビューの見た目は変わりません。
実画面で確かめるグレアのFog Glowで発光面の縁に柔らかい光を加えました。
SmartTools Composite の操作を見る ↗全機能と操作解説前の図ではスザンヌの輪郭がくっきりしていますが、後の図では輪郭の周りに丸く光がにじみ、影の縁にも色がかかっています。
実画面で確かめる注視点を使ってカメラを固定し、制作途中と完成画を同じ視点で撮影しました。
SmartTools CamLight の操作を見る ↗全機能と操作解説2027年1月1日発売予定。表示は税込・買い切り価格です。
照明の発光だけを取り出して仕上げたい
掲載した単品の合計 ¥3,660
この作品で使った収録製品
SmartTools Render · SmartTools Composite · SmartTools CamLight
セットで掲載機能を揃える場合 ¥4,980
掲載機能だけなら、単品の合計が¥1,320安くなります。
ほかに含まれる製品例
SmartTools Paint · SmartTools Shader